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

Fix TS2306 “not a module” errors in type definitions #16

Merged
merged 1 commit into from
Sep 8, 2024

Conversation

andersk
Copy link

@andersk andersk commented Mar 6, 2023

Fixes TypeScript errors like this when substituting source-map-js for source-map using pnpm overrides.

node_modules/.pnpm/css-minimizer-webpack-plugin@4.2.2_dpcjkp5o5ztxuvt4quwwvenemi/node_modules/css-minimizer-webpack-plugin/types/index.d.ts:141:28 - error TS2306: File '/srv/zulip/node_modules/.pnpm/source-map-js@1.0.2/node_modules/source-map-js/source-map.d.ts' is not a module.

141 type RawSourceMap = import("source-map").RawSourceMap;
                               ~~~~~~~~~~~~

Fixes TypeScript errors like this when substituting source-map-js for
source-map using pnpm overrides.

    node_modules/.pnpm/css-minimizer-webpack-plugin@4.2.2_dpcjkp5o5ztxuvt4quwwvenemi/node_modules/css-minimizer-webpack-plugin/types/index.d.ts:141:28 - error TS2306: File '/srv/zulip/node_modules/.pnpm/source-map-js@1.0.2/node_modules/source-map-js/source-map.d.ts' is not a module.

    141 type RawSourceMap = import("source-map").RawSourceMap;
                                   ~~~~~~~~~~~~

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
@7rulnik
Copy link
Owner

7rulnik commented Mar 24, 2024

@andersk Hi! It's not clear to me: why it wasn't a problem before 1.0.2?

@andersk
Copy link
Author

andersk commented Mar 24, 2024

@7rulnik This was broken by the incorrect usage of declare module that was added in #13, which was merged in 1.0.2.

See the reproduction recipe in #24.

@7rulnik
Copy link
Owner

7rulnik commented Mar 24, 2024

Ahhh, my bad! For some reason, I read 1.0.2 as 1.2.0 and was really confused about it. Sorry!
I will take a look into it a bit later!

@andersk andersk mentioned this pull request Aug 28, 2024
@7rulnik 7rulnik merged commit 9403576 into 7rulnik:patch-0.6.1 Sep 8, 2024
@7rulnik
Copy link
Owner

7rulnik commented Sep 8, 2024

Thanks for PR and sorry for waiting!
Published as https://www.npmjs.com/package/source-map-js/v/1.2.1

@andersk andersk deleted the ts-module branch September 8, 2024 18:05
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 this pull request may close these issues.

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