Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Wrong error message when trying to named-import an export= (or CJS) export #36909

Copy link
Copy link
@andrewbranch

Description

@andrewbranch
Issue body actions

TypeScript Version: 3.8 RC – nightly

Search Terms: declares locally but not exported

Code

// a.ts
class Foo {}
export = Foo;

// b.ts
import { Foo } from './a';

Expected behavior:
Module "./a" has no exported member 'Foo' (pre-3.8 message), or better yet, using context to pick between one of these specialized messages:

  • TS, module kind < es2015, allowSynthetic off: 'Foo' can only be imported by using 'import Foo = require(...)' or by turning on the 'allowSyntheticDefaultImports' flag and using a default import.
  • TS, module kind < es2015, allowSynthetic on: 'Foo' can only be imported by using 'import Foo = require(...)' or a default import.
  • TS or JS, module kind >= es2015, allowSynthetic off: 'Foo' can only be imported by turning on the 'allowSyntheticDefaultImports' flag and using a default import.
  • TS or JS, module kind >= es2015, allowSynthetic on: 'Foo' can only be imported by using a default import.
  • JS, module kind < es2015, allowSynthetic off: 'Foo' can only be imported by using a 'require' call or by turning on the 'allowSyntheticDefaultImports' flag and using a default import.
  • JS, module kind < es2015, allowSynthetic on: `'Foo' can only be imported by using a 'require' call or by using a default import.'

Actual behavior:

Module '"./a"' declares 'Foo' locally, but it is not exported.

Playground Link: https://www.typescriptlang.org/play/?ts=Nightly#code/CYUwxgNghgTiAEBbA9sArhBByKX4G8AoASBAA8AHZGAFwPgF8TIoBnV+AMWWXqdMrU6AXi48A3ISaFQLOElQZsAIzxFiAeg3wAsoszwsAIihG8s6HA5ZuyPBGRgoECAE8ANPGVo6ASz8cAHbIdORUtCDAAHQkvojhdPhivAzwAGYwyIiGuJJMQA

Related Issues: PR: #36187

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messaging

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.