Skip to content

Commit

Permalink
chore: turns out i didnt need jank
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfrangu committed Jul 9, 2024
1 parent eeb4849 commit 86d8c16
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 73 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"test": "vitest run",
"test:watch": "vitest",
"update": "yarn upgrade-interactive",
"build": "tsc -p src --noEmit && yarn clean && tsup && tsc -p src --emitDeclarationOnly && tsx scripts/post-build.mts",
"prepack": "yarn build",
"build": "tsc -p src --noEmit && yarn clean && tsup",
"clean": "node scripts/clean.mjs",
"typecheck": "tsc -p src --noEmit",
"bump": "cliff-jumper",
Expand All @@ -47,7 +48,6 @@
"@sapphire/eslint-config": "^5.0.5",
"@sapphire/prettier-config": "^2.0.0",
"@sapphire/ts-config": "^5.0.1",
"@types/node": "^20.14.10",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"@vitest/coverage-c8": "^0.33.0",
Expand All @@ -59,7 +59,6 @@
"lint-staged": "^15.2.7",
"prettier": "^3.3.2",
"tsup": "^8.1.0",
"tsx": "^4.16.2",
"typedoc": "^0.26.2",
"typedoc-plugin-mdn-links": "^3.2.1",
"typescript": "^5.5.2",
Expand Down
15 changes: 0 additions & 15 deletions scripts/post-build.mts

This file was deleted.

15 changes: 12 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ export class AsyncEventEmitter<
listener: AsyncEventEmitterListenerForEvent<AsyncEventEmitter<Events>, K>,
): this;

public removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this {
public removeListener<K extends string | symbol>(
eventName: K,
listener: AsyncEventEmitterListenerForEvent<AsyncEventEmitter<Events>, K>,
): this {
validateListener(listener);

const events = this._events;
Expand Down Expand Up @@ -448,7 +451,10 @@ export class AsyncEventEmitter<
...args: GetAsyncEventEmitterEventParameters<AsyncEventEmitter<Events>, K>
): boolean;

public emit(eventName: string | symbol, ...args: any[]): boolean {
public emit<K extends string | symbol>(
eventName: K,
...args: GetAsyncEventEmitterEventParameters<AsyncEventEmitter<Events>, K>
): boolean {
let doError = eventName === 'error';

const events = this._events;
Expand Down Expand Up @@ -1003,7 +1009,10 @@ function handleMaybeAsync(emitter: AsyncEventEmitter<any>, result: any) {

if (typeof the === 'function') {
the.call(result, undefined, (error: any) => {
emitter.emit('error', error);
// Emit on next tick
setTimeout(() => {
emitter.emit('error', error);
}, 0);
});
}

Expand Down
2 changes: 1 addition & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const sharedConfig: Options = {
},
splitting: false,
keepNames: true,
dts: false,
dts: true,
sourcemap: true,
treeshake: false,
outDir: 'dist',
Expand Down
52 changes: 1 addition & 51 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1135,15 +1135,6 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:^20.14.10":
version: 20.14.10
resolution: "@types/node@npm:20.14.10"
dependencies:
undici-types: "npm:~5.26.4"
checksum: 10/672892cf94d0d95cf052f11271990686a0fd204cd1e5fe7a4ef240e5315e06711765dc47b9ec98627d3adac18b8c92bb7e2d8db21d18faa20bc3e3203a143e79
languageName: node
linkType: hard

"@types/parse-json@npm:^4.0.0":
version: 4.0.0
resolution: "@types/parse-json@npm:4.0.0"
Expand Down Expand Up @@ -1379,7 +1370,6 @@ __metadata:
"@sapphire/eslint-config": "npm:^5.0.5"
"@sapphire/prettier-config": "npm:^2.0.0"
"@sapphire/ts-config": "npm:^5.0.1"
"@types/node": "npm:^20.14.10"
"@typescript-eslint/eslint-plugin": "npm:^7.14.1"
"@typescript-eslint/parser": "npm:^7.14.1"
"@vitest/coverage-c8": "npm:^0.33.0"
Expand All @@ -1391,7 +1381,6 @@ __metadata:
lint-staged: "npm:^15.2.7"
prettier: "npm:^3.3.2"
tsup: "npm:^8.1.0"
tsx: "npm:^4.16.2"
typedoc: "npm:^0.26.2"
typedoc-plugin-mdn-links: "npm:^3.2.1"
typescript: "npm:^5.5.2"
Expand Down Expand Up @@ -2494,7 +2483,7 @@ __metadata:
languageName: node
linkType: hard

"esbuild@npm:^0.21.3, esbuild@npm:^0.21.4, esbuild@npm:~0.21.5":
"esbuild@npm:^0.21.3, esbuild@npm:^0.21.4":
version: 0.21.5
resolution: "esbuild@npm:0.21.5"
dependencies:
Expand Down Expand Up @@ -3106,15 +3095,6 @@ __metadata:
languageName: node
linkType: hard

"get-tsconfig@npm:^4.7.5":
version: 4.7.5
resolution: "get-tsconfig@npm:4.7.5"
dependencies:
resolve-pkg-maps: "npm:^1.0.0"
checksum: 10/de7de5e4978354e8e6d9985baf40ea32f908a13560f793bc989930c229cc8d5c3f7b6b2896d8e43eb1a9b4e9e30018ef4b506752fd2a4b4d0dfee4af6841b119
languageName: node
linkType: hard

"git-cliff-darwin-arm64@npm:1.4.0":
version: 1.4.0
resolution: "git-cliff-darwin-arm64@npm:1.4.0"
Expand Down Expand Up @@ -5147,13 +5127,6 @@ __metadata:
languageName: node
linkType: hard

"resolve-pkg-maps@npm:^1.0.0":
version: 1.0.0
resolution: "resolve-pkg-maps@npm:1.0.0"
checksum: 10/0763150adf303040c304009231314d1e84c6e5ebfa2d82b7d94e96a6e82bacd1dcc0b58ae257315f3c8adb89a91d8d0f12928241cba2df1680fbe6f60bf99b0e
languageName: node
linkType: hard

"restore-cursor@npm:^2.0.0":
version: 2.0.0
resolution: "restore-cursor@npm:2.0.0"
Expand Down Expand Up @@ -5990,22 +5963,6 @@ __metadata:
languageName: node
linkType: hard

"tsx@npm:^4.16.2":
version: 4.16.2
resolution: "tsx@npm:4.16.2"
dependencies:
esbuild: "npm:~0.21.5"
fsevents: "npm:~2.3.3"
get-tsconfig: "npm:^4.7.5"
dependenciesMeta:
fsevents:
optional: true
bin:
tsx: dist/cli.mjs
checksum: 10/841ccbace3dc0c42704bb5c4cea47e1f4cd313aa4719fd4531e5ed40bb862b02349c76f7c56c53b64207eebbb1c2ac2e117482aabfbf197a30fbc0b2584b60be
languageName: node
linkType: hard

"type-check@npm:^0.4.0, type-check@npm:~0.4.0":
version: 0.4.0
resolution: "type-check@npm:0.4.0"
Expand Down Expand Up @@ -6116,13 +6073,6 @@ __metadata:
languageName: node
linkType: hard

"undici-types@npm:~5.26.4":
version: 5.26.5
resolution: "undici-types@npm:5.26.5"
checksum: 10/0097779d94bc0fd26f0418b3a05472410408877279141ded2bd449167be1aed7ea5b76f756562cb3586a07f251b90799bab22d9019ceba49c037c76445f7cddd
languageName: node
linkType: hard

"unicorn-magic@npm:^0.1.0":
version: 0.1.0
resolution: "unicorn-magic@npm:0.1.0"
Expand Down

0 comments on commit 86d8c16

Please sign in to comment.