-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
A follow up on #2485. When importing anything from @reduxjs/[email protected]
, typescript cannot resolve types when tsconfig.json
's moduleResolution
is set to node16
or nodenext
.
I found that adding the extension .js
to the declaration imports resolved the issue. For example....
In my file: ./node_modules/@reduxjs/toolkit/dist/index.d.ts
export { createSlice, } from './createSlice';
-> export { createSlice, } from './createSlice.js';
Two suggestions for a fix: First, maybe the easiest, is add a post build script to add the extensions to the output. Or second, a search and replace to add the extensions to the all the relevant source files. Want to get some thoughts on a direction before attempting a PR. Maybe there's a better way.
I tried looking to see if typescript can just add them while compiling... but didn't find anything that could.