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

Improve error when default-importing from a module that export *s from a module with a default export #37092

Closed
bluelovers opened this issue Feb 27, 2020 · 4 comments · Fixed by #37212
Labels
Domain: Error Messages The issue relates to error messaging Experience Enhancement Noncontroversial enhancements Fixed A PR has been merged for this issue Good First Issue Well scoped, documented and has the green light Help Wanted You can do this

Comments

@bluelovers
Copy link
Contributor

bluelovers commented Feb 27, 2020

TypeScript Version: 3.7.x-dev.201xxxxx

Search Terms:

Code

https://github.com/bluelovers/ws-react/blob/master/packages/react-use-localstorage/index.ts

export * from './core/v4';
//import createStorageHook from './core/v4';
//export default createStorageHook

//console.log(exports.default)
import createStorageHook from './src/core';

Expected behavior:

know "src/core" has default import

Actual behavior:

Error:(2, 8) TS1192: Module '"src/core"' has no default export.

Playground Link:

Related Issues:

#37090

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Feb 28, 2020

export * doesn't include default exports

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Feb 28, 2020

That should be what this issue is - that the error message is bad. We should detect the export * and hint that an export * doesn't create a default export.

@DanielRosenwasser DanielRosenwasser added Domain: Error Messages The issue relates to error messaging Experience Enhancement Noncontroversial enhancements Good First Issue Well scoped, documented and has the green light Help Wanted You can do this labels Feb 28, 2020
@DanielRosenwasser DanielRosenwasser changed the title TS1192: Module '"src/core"' has no default export. Improve error when default-importing from a module that export *s from a module with a default export Feb 28, 2020
@rpgeeganage
Copy link
Contributor

Can I take this?

@DanielRosenwasser
Copy link
Member

Sorry I missed that @rpgeeganage - but thanks for fixing this @a-tarasyuk!

@DanielRosenwasser DanielRosenwasser added the Fixed A PR has been merged for this issue label Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Error Messages The issue relates to error messaging Experience Enhancement Noncontroversial enhancements Fixed A PR has been merged for this issue Good First Issue Well scoped, documented and has the green light Help Wanted You can do this
Projects
None yet
3 participants