Skip to content

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

Description

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

Activity

  1. DanielRosenwasser commented on Feb 28, 2020

    @DanielRosenwasser
    Member

    export * doesn't include default exports

  2. DanielRosenwasser commented on Feb 28, 2020

    @DanielRosenwasser
    Member

    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.

  3. 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[/+] on Feb 28, 2020
  4. rpgeeganage commented on Feb 29, 2020

    @rpgeeganage
    Contributor

    Can I take this?

  5. DanielRosenwasser commented on Mar 27, 2020

    @DanielRosenwasser
    Member

    Sorry I missed that Ruwan Pradeep Geeganage (@rpgeeganage) - but thanks for fixing this Oleksandr Tarasiuk (@a-tarasyuk)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Error MessagesThe issue relates to error messagingExperience EnhancementNoncontroversial enhancementsFixedA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions