redux icon indicating copy to clipboard operation
redux copied to clipboard

No types available for redux/es/redux.mjs

Open justinfagnani opened this issue 3 years ago • 3 comments

Prior Issues

https://github.com/reduxjs/redux/pull/3143

What is the current behavior?

redux/es/redux.mjs does not have any associated typings.

Steps to Reproduce

Import redux/es/redux.mjs in a TypeScript file:

import {createStore} from 'redux/es/redux.mjs';

tsc reports:

Could not find a declaration file for module 'redux/es/redux.mjs'. 

What is the expected behavior?

No error and types are found.

Environment Details

[email protected]

justinfagnani avatar Feb 06 '22 00:02 justinfagnani

Hmm. Why does TS not pick up the types file from the typings key as always?

Tbh everything related to use of ESM as a delivery mechanism still confuses me at this point :(

markerikson avatar Feb 06 '22 00:02 markerikson

ESM support is coming, but is only in the experimental builds at the moment: https://www.typescriptlang.org/docs/handbook/esm-node.html

timdorr avatar Feb 06 '22 03:02 timdorr

tsc doesn't know that /es/index.mjs is related to the types exported in package.json. I think you can just put an index.d.ts file next to index.mjs and it'll be picked up.

justinfagnani avatar Feb 07 '22 17:02 justinfagnani

This should be fixed in the 5.0 alphas, I think.

markerikson avatar Apr 16 '23 19:04 markerikson