From 22a43b3d9c3d54d7ff1a7dba4406d7b399baf3aa Mon Sep 17 00:00:00 2001 From: Christian Benincasa Date: Thu, 23 May 2024 13:11:48 -0400 Subject: [PATCH] Fix TS declaration file build errors. Fixes #150 (#151) --- index.d.ts | 7 +++---- package.json | 3 ++- tsconfig.json | 8 ++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 tsconfig.json diff --git a/index.d.ts b/index.d.ts index 72e48ca..c7ab56c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,5 @@ import { EventEmitter } from 'events' -import workerThreads from 'worker_threads' +import * as workerThreads from 'worker_threads' interface ThreadStreamOptions { /** @@ -76,9 +76,8 @@ declare class ThreadStream extends EventEmitter { * @param args the arguments to be passed to the event handlers. * @returns {boolean} `true` if the event had listeners, `false` otherwise. */ - emit(eventName: string | symbol, ...args: any[]): boolean { - return super.emit(eventName, ...args); - } + emit(eventName: string | symbol, ...args: any[]): boolean; + /** * Post a message to the Worker with specified data and an optional list of transferable objects. * diff --git a/package.json b/package.json index 09f0ea3..9d6a570 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "why-is-node-running": "^2.2.2" }, "scripts": { - "test": "standard && npm run transpile && tap \"test/**/*.test.*js\" && tap --ts test/*.test.*ts", + "build": "tsc --noEmit", + "test": "standard && npm run build && npm run transpile && tap \"test/**/*.test.*js\" && tap --ts test/*.test.*ts", "test:ci": "standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts", "test:ci:js": "tap --no-check-coverage --timeout=120 --coverage-report=lcovonly \"test/**/*.test.*js\"", "test:ci:ts": "tap --ts --no-check-coverage --coverage-report=lcovonly \"test/**/*.test.*ts\"", diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..35dd65f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "esModuleInterop": true + }, + "files": [ + "index.d.ts" + ], +} \ No newline at end of file