7rulnik / source-map-js

Consume and generate source maps.
Other
92 stars 13 forks source link

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

Closed andersk closed 1 week ago

andersk commented 1 year ago

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;
                               ~~~~~~~~~~~~
7rulnik commented 5 months ago

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

andersk commented 5 months ago

@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 commented 5 months ago

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!

7rulnik commented 1 week ago

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