Skip to content

Missing subfolder & files path completions with wildcard exports #48652

Closed
@TheMrZZ

Description

@TheMrZZ

Bug Report

Sub folders and files of a folder listed in exports do not resolve in VS Code's autocomplete.
Also, the modules aren't displayed with a subfolder icon. The files should be displayed with a file icon, but they're not displayed at all.

For this example, I'm using a library named sandstone and a tests folder. I'm trying to import sandstone submodules from tests.

Expected paths & icons:
image

Actual paths & icons:
image

When reaching a submodule (submodules have several .ts files), it gets even weirder. Expected paths:
image

Actual paths:
image
You can see the submodule appears as a submodule of itself.

Despite autocompletion not working, the code runs fine. However, auto imports don't work either. Live demo (ignore the Copilot suggestions):

imports_work.mp4

🔎 Search Terms

typescript, exports, field, package.json, exports map, autocompletion, paths, import, auto import, icons, 4.7 beta

🕗 Version & Regression Information

  • I was unable to test this on prior versions because it's a new 4.7 feature.

💻 Code

Sandstone's package.json:

{
  "name": "sandstone",
  // ...
  "main": "dist/index.js",
  "module": "dist/index.mjs",
  "types": "dist/index.d.ts",
  "exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.mjs",
      "default": "./dist/index.js"
    },
    "./*": {
      "types": "./dist/*.d.ts",
      "import": "./dist/*.mjs",
      "default": "./dist/*.js"
    },
    "./arguments": {
      "types": "./dist/arguments/index.d.ts",
      "import": "./dist/arguments/index.mjs",
      "default": "./dist/arguments/index.js"
    },
    "./commands": {
      "types": "./dist/commands/index.d.ts",
      "import": "./dist/commands/index.mjs",
      "default": "./dist/commands/index.js"
    },
    "./core": {
      "types": "./dist/core/index.d.ts",
      "import": "./dist/core/index.mjs",
      "default": "./dist/core/index.js"
    },
    "./flow": {
      "types": "./dist/flow/index.d.ts",
      "import": "./dist/flow/index.mjs",
      "default": "./dist/flow/index.js"
    },
    "./pack": {
      "types": "./dist/pack/index.d.ts",
      "import": "./dist/pack/index.mjs",
      "default": "./dist/pack/index.js"
    },
    "./variables": {
      "types": "./dist/variables/index.d.ts",
      "import": "./dist/variables/index.mjs",
      "default": "./dist/variables/index.js"
    }
  }
}

Tests' tsconfig.json:

{
  "compilerOptions": {
    "declaration": true,
    "module": "commonjs",
    "moduleResolution": "nodenext",
    "target": "es2020",
    "strict": false,
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "allowSyntheticDefaultImports": true,
    "noEmit": true,
    "skipLibCheck": true,
    "outDir": "build"
  },
  "include": [
    "src/**/*"
  ]
}

🙁 Actual behavior

Only the hardcoded submodules appear in the autocompletion. The submodule appears as a submodule of itself.

🙂 Expected behavior

Since there is a wildcard export, all submodules of submodules & all files should appear in the autocompletion. The submodule shouldn't appear as a submodule of itself.

Metadata

Metadata

Assignees

Labels

Domain: Completion ListsThe issue relates to showing completion lists in an editorExperience EnhancementNoncontroversial enhancementsFix AvailableA PR has been opened for this issueSuggestionAn idea for TypeScript

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions