Skip to content

Commit

Permalink
Use non node types and generic events export
Browse files Browse the repository at this point in the history
Also fix the types paths
  • Loading branch information
jdalrymple committed Dec 19, 2023
1 parent 4f3a4df commit aa6d1a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}
}
},
"types": "./index.d.ts",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
Expand Down
4 changes: 2 additions & 2 deletions src/RateLimit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class RateLimit {

private delay: number;

private timeouts: NodeJS.Timeout[] = [];
private timeouts: ReturnType<typeof setTimeout>[] = [];

constructor(
rate: number,
Expand All @@ -27,7 +27,7 @@ export class RateLimit {
this.delay = uniformDistribution ? interval / rate : interval;
}

async apply(): Promise<NodeJS.Timeout> {
async apply(): Promise<ReturnType<typeof setTimeout>> {
await this.sema.acquire();

const tm = setTimeout(() => this.sema.release(), this.delay);
Expand Down
2 changes: 1 addition & 1 deletion src/Sema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EventEmitter } from 'node:events';
import { EventEmitter } from 'events';
import { Deque } from './Deque';

const DEFAULT_INIT_VALUE = '1';
Expand Down

0 comments on commit aa6d1a1

Please sign in to comment.