dnt icon indicating copy to clipboard operation
dnt copied to clipboard

typecheck for code with import.meta.dirname polyfill doesn't work

Open MirKml opened this issue 5 months ago • 0 comments

When I have some code with import.meta.dirname, type check for generated code doesn't work. Deno 2.4.2 Node 22.17.1

@types/node >= 22.16.3

error

[dnt] Type checking ESM...
src/_dnt.polyfills.ts:195:35 - error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'string | URL'.

195                   : createRequire(parentURL)).resolve(specifier),
                                      ~~~~~~~~~

error: Uncaught (in promise) Error: Had 1 diagnostics.
          throw new Error(`Had ${diagnostics.length} diagnostics.`);
                ^
    at getProgramAndMaybeTypeCheck (https://jsr.io/@deno/dnt/0.42.3/mod.ts:480:17)
    at build (https://jsr.io/@deno/dnt/0.42.3/mod.ts:366:17)
    at eventLoopTick (ext:core/01_core.js:178:7)
    at async file:...scripts/build_npm.ts:9:1

cc @Gaubee as main author of polyfill

MirKml avatar Jul 29 '25 12:07 MirKml