From 472c07c0a898b9cd026f925e85c1af54e021ba06 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 8 Sep 2023 10:43:44 +0100 Subject: [PATCH] Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- scripts/copy-res.ts | 2 +- src/@types/cpx.d.ts | 8 ++++++-- tsconfig.json | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/copy-res.ts b/scripts/copy-res.ts index 5954bc05ae..cf3a0477a0 100755 --- a/scripts/copy-res.ts +++ b/scripts/copy-res.ts @@ -165,7 +165,7 @@ function watchLanguage(lang: string, dest: string, langFileMap: Record; const makeLang = (): void => { if (makeLangDebouncer) { clearTimeout(makeLangDebouncer); diff --git a/src/@types/cpx.d.ts b/src/@types/cpx.d.ts index f1980d932a..d9c4d632e3 100644 --- a/src/@types/cpx.d.ts +++ b/src/@types/cpx.d.ts @@ -15,12 +15,16 @@ limitations under the License. */ import "cpx"; -import type EventEmitter from "events"; declare module "cpx" { - export class Cpx extends EventEmitter { + export class Cpx { public constructor(source: string, outDir: string, options?: object); + public on(eventName: "copy", fn: (event: { srcPath: string; dstPath: string }) => void): void; + public on(eventName: "remove", fn: (event: { path: string }) => void): void; + public on(eventName: "watch-ready", fn: () => void): void; + public on(eventName: "watch-error", fn: (error: Error) => void): void; + /** * Copy all files that matches `this.source` pattern to `this.outDir`. * diff --git a/tsconfig.json b/tsconfig.json index 5762df78d4..c707ebaa54 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,5 +26,8 @@ "./test/**/*.ts", "./test/**/*.tsx", "./scripts/*.ts" - ] + ], + "ts-node": { + "files": true + } }