microsoft / microsoft/TypeScript

exports subpath with array types is not autocompleting

Open
#63,231 5 comments 0 reactions 0 assignees View on GitHub
Needs More Info
Dominant language
Go
Stars
111k
Forks
14.3k
PR merge metrics
PR metrics pending

Description

Does this issue occur when all extensions are disabled?: Yes

- VS Code Version: 1.109.5
- OS Version: Windows 11

This issue should apply to all OS. It's about JavaScript/TypeScript language server handling import paths.

When a dependency uses array form in the export path, e.g. in [@repobuddy/storybook](https://github.com/repobuddy/storybook/blob/main/libs/storybook/package.json):

```jsonc
{
"exports": {
".": {
"types": [
"./esm/index.d.ts",
"./src/index.ts"
],
"default": "./esm/index.js"
},
"./manager": {
"types": "./esm/manager/index.d.ts",
"default": "./esm/manager/index.js"
},
"./storybook-addon-tag-badges": {
"types": [
"./esm/storybook-addon-tag-badges/index.d.ts",
"./src/storybook-addon-tag-badges/index.ts"
],
"default": "./esm/storybook-addon-tag-badges/index.js"
},
}
}
```

The import can resolve correctly, e.g.:

```tsx
import type { Meta, StoryObj } from '@repobuddy/storybook/storybook-addon-tag-badges'
```

But the path completion does not show the subpath:

Image

Contributor guide

Open the contributing guide

Research direction

Start with TypeScript's language-server handling of package.json exports and reproduce the example from @repobuddy/storybook, comparing scalar and array forms of the types entry. Verify completion for the @repobuddy/storybook/storybook-addon-tag-badges import, and consider the issue done when the subpath appears while the import still resolves correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
54/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.