-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Auto-importHelp WantedYou can do thisYou can do this
Description
Bug Report
π Search Terms
- Auto-import
- Code Fix
- Quick Fixes
- Completion
π Version & Regression Information
- This is a expected behavior about auto import or code fix.
β― Playground Link
π» Code
// node_modules/my-pkg/package.json
{
"name": "my-pkg",
"version": "1.0.0",
"main": "lib", // some node_modules may use directory to be the entry point, and node.js can handle it (will use the lib/index file)
"module": "lib"
}
// node_modules/my-pkg/lib/index.js
export function foo() {};
// index.ts
foo();π Actual behavior
When apply code fix using vscode at foo, it will suggest import { foo } from 'my-pkg/lib', which my-pkg/lib is not the best path name.

π Expected behavior
Just like focus at the my-pkg position, we can find the main file xxx/my-pkg/lib/index.js, on the other hand Auto-import should work too.
We expect it to be import { foo } from 'my-pkg'
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Auto-importHelp WantedYou can do thisYou can do this
