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

[1.0.2 regression] TypeScript error TS2306: File '…/source-map.d.ts' is not a module #24

Open
andersk opened this issue Mar 22, 2024 · 0 comments · May be fixed by #16
Open

[1.0.2 regression] TypeScript error TS2306: File '…/source-map.d.ts' is not a module #24

andersk opened this issue Mar 22, 2024 · 0 comments · May be fixed by #16

Comments

@andersk
Copy link

andersk commented Mar 22, 2024

$ npm i source-map@npm:source-map-js@1.2.0 typescript

added 2 packages in 2s

$ echo 'import * as SourceMap from "source-map"' > test.ts

$ npx tsc test.ts 
test.ts:1:28 - error TS2306: File '/tmp/node_modules/source-map/source-map.d.ts' is not a module.

1 import * as SourceMap from "source-map"
                             ~~~~~~~~~~~~


Found 1 error in test.ts:1

This worked in 1.0.1 and regressed in 1.0.2. I explained the reason at #13 (review): the declare module syntax is only for stubbing third-party modules. To declare modules in the current package, you should just write a separate .d.ts file for each .js file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant