Skip to content

Add type declarations for nodenext module resolution #117

@d3m1d0v

Description

@d3m1d0v

I use prosemirror-utils package in project with typescript@5. When I set compiler options module:nodenext and moduleResolution:nodenext in tsconfig.json, build fails:

error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("prosemirror-utils")' call instead.

My guess is that typescript finds *.cjs scripts, expects *.d.cts and does not find them.
So, probably solution is to add *.d.cts for type declaration for commonjs environment

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