Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using addRelativeDeclarationExtensions, the extension should be based on the extension of the output file #264

Open
cjpearson opened this issue Dec 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@cjpearson
Copy link

Environment

[email protected]
node 20.9.0

Reproduction

  • Set the output extension to mjs or cjs, enable outputting declarations and enable addRelativeDeclarationExtensions
  • Have a file which imports from another file
  • Build and review the definitions

Describe the bug

When compiling a .ts file to .mjs or .cjs, the declaration for the file should be .d.mts or .d.cts accordingly. Additionally, when the declarations include imports with extensions (required for node16), the extension also needs to match. It should be .js in .d.ts files, .cjs in .d.cts files and .mjs in .d.mts files.

Right now the feature just looks at the input file. Typescript would compile a .mts file to .mjs, but since mlly also allows explicitly defining the output extension, it should use that option as the source of truth here as well.

Additional context

#134

Logs

No response

@cjpearson cjpearson added the bug Something isn't working label Dec 13, 2024
cjpearson added a commit to cjpearson/mkdist that referenced this issue Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant