Skip to content

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

@MirKml

Description

@MirKml

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions