atlassian / atlassian/prosemirror-utils

Add type declarations for `nodenext` module resolution

Open
#117 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
522
Forks
62
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with tsconfig.json and the package's existing *.cjs scripts and declaration files to trace how TypeScript 5 resolves the package under nodenext. Reproduce the reported build failure, then verify that CommonJS consumers resolve the added *.d.cts declarations and that the nodenext build succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.