From b3c8447bbaf4ba90da86284d6a64c0b9ade23b8c Mon Sep 17 00:00:00 2001 From: Okiki Ojo Date: Sun, 22 Mar 2026 18:41:30 -0400 Subject: [PATCH] chore: update build configuration to enable Node-oriented type-checking and adjust compiler options Signed-off-by: Okiki Ojo --- helpers/operations/timing.ts | 2 +- scripts/build_npm.ts | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/helpers/operations/timing.ts b/helpers/operations/timing.ts index c1de209..2138b31 100644 --- a/helpers/operations/timing.ts +++ b/helpers/operations/timing.ts @@ -140,7 +140,7 @@ export function delayEach( transform(chunk, state, controller) { // Schedule delayed emission for this specific item const timeout = setTimeout( - (_chunk) => { + (_chunk: typeof chunk) => { controller.enqueue(_chunk); state.pendingTimeouts.delete(timeout); clearTimeout(timeout); diff --git a/scripts/build_npm.ts b/scripts/build_npm.ts index e1e8f06..0a81726 100644 --- a/scripts/build_npm.ts +++ b/scripts/build_npm.ts @@ -53,16 +53,24 @@ await build({ outDir: "./npm", shims: { deno: false }, - // Skip dnt's extra Node-oriented type-check pass. The Deno-native source has - // already been validated with `deno check **/*.ts`, so re-checking the - // transformed npm output here would mostly duplicate that verification while - // switching to Node-specific type resolution rules. - typeCheck: false, + // Keep dnt's Node-oriented type-check pass enabled so the transformed npm + // package is validated against the closest Node surface this dnt release can + // express, not just Deno's default type environment. + typeCheck: 'both', + compilerOptions: { + // dnt 0.42.3 cannot express an ES2024 target yet, so Promise.withResolvers + // still has to come from an ESNext lib even though Node 24 supports it at + // runtime. Keep the future-facing libs narrow to the features this package + // actually uses. + target: 'Latest', + lib: ['ES2023', 'DOM', 'DOM.Iterable', 'ESNext', 'ESNext.Promise', 'ESNext.Disposable'], + }, // The Deno test suite imports jsr:@std/testing and other Deno-specific test // utilities. Running those files through Node would pull Deno-only types into // the npm build graph for reasons unrelated to the published library surface. test: false, + rootTestDir: './tests', package: { name: readConfigString("name"), @@ -98,7 +106,7 @@ await build({ provenance: true, }, engines: { - node: ">=20", + node: ">=24", }, }, -- 2.51.2