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

No types available for redux/es/redux.mjs #4279

Closed
justinfagnani opened this issue Feb 6, 2022 · 4 comments
Closed

No types available for redux/es/redux.mjs #4279

justinfagnani opened this issue Feb 6, 2022 · 4 comments

Comments

@justinfagnani
Copy link

Prior Issues

#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

redux@4.1.2

@markerikson
Copy link
Contributor

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 :(

@timdorr
Copy link
Member

timdorr commented Feb 6, 2022

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

@justinfagnani
Copy link
Author

justinfagnani commented Feb 7, 2022

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.

@markerikson
Copy link
Contributor

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

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

No branches or pull requests

3 participants