-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Auto-importEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisYou can do this
Milestone
Description
Bug Report
🔎 Search Terms
- isolatedModules
- type
- import
🕗 Version & Regression Information
It's happening in 5.1.3, but it's surely been present since the 4.x version where "moduleResolution": "NodeNext"
was supported.
💻 Code
See example below. The tsconfig should have the following configuration:
"isolatedModules": true,
"moduleResolution": "NodeNext",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
🙁 Actual behavior
When typing out the code on the last line and accepting the suggested import, you get the following import:
import { SomeType } from "apackage";
@a
const s: SomeType;
This import won't compile with this TS project configuration.
🙂 Expected behavior
Instead, you should get an import like this, since explicit type imports are required (compiler error) when isolatedModules
is set to true
, when moduleResolution
is set to NodeNext
and using decorators.
import type { SomeType } from "apackage";
@a
const s: SomeType;
Today, the workaround is to use an eslint rule to help auto-fix these issues.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Auto-importEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisYou can do this