Skip to content

Better errors for non-exported types #29624

Closed
@DanielRosenwasser

Description

@DanielRosenwasser
// @filename a.ts

declare function foo(): any

declare function bar(): any;

export { bar };

// @filename b.ts

import { foo, bar } from "./a";

Currently we provide the following error messages:

Module '"./a"' has no exported member 'foo'.
Module '"./a"' has no exported member 'bar'.

We could instead provide the errors:

Module '"./a"' declares 'foo' locally, but it is not exported.
Module '"./a"' declares 'bar' locally', but it is exported as 'baz'.

Also using the

'{0}' is declared here.

related span.

Later on, we could provide quick fixes to respectively

  • Export foo from ./a.
  • Correct the usage of bar to baz.

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 thisSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions