-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueHelp WantedYou can do thisYou can do this
Milestone
Description
π Search Terms
isolatedDeclarations
, quick fix, class
π Version & Regression Information
- This is the behavior in every version I tried
β― Playground Link
π» Code
import { Volume } from 'memfs';
export const foo = new Volume();
π Actual behavior
The "Add annotation of type Volume" quick fix produces broken code:
import { Volume } from 'memfs';
import { Volume } from 'memfs/lib/volume';
export const foo: Volume = new Volume();
The "Add satisfies and an inline type assertion with Volume" quick fix produces broken code:
import { Volume } from 'memfs';
import { Volume } from 'memfs/lib/volume';
export const foo = (new Volume()) satisfies Volume as Volume;
In both cases the quick fix adds another import which creates a TS error due to the duplicate name. If you remove the added import then there is a different error because Volume
in this instance is actually a variable that aliases the class declaration -- so it cannot be used as a type.
π Expected behavior
The quick fix should produce working code.
Additional information about the issue
This might be a unique edge case due to the horrid types in memfs
-- IDK why they re-export the class via a variable -- that's seriously cooked.
Copilot
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueHelp WantedYou can do thisYou can do this