Skip to content

Missing subfolder path completions with wildcard typesVersions #47952

Closed
@kim3er

Description

@kim3er

Bug Report

Sub folders of a folder listed in typeVersions, do not resolve in VS Code's autocomplete. I originally believed the issue to be related to Support for NodeJS 12.7+ package exports.

🔎 Search Terms

typeVersions
autocomplete

🕗 Version & Regression Information

This is using Visual Studio Code 1.64.2 and TypeScript 4.5.5. I believe this bug to not be a revision, and is not resolved in TypeScript 4.7.0.

⏯ Playground Link

Code required relationship between two projects, so used Github instead.

Github repo

💻 Code

We have an internal package, written in TS, transpiled to a sub folder called 'dest'. The package.json of the package looks like:

{
  ...
  "type": "module",
  "exports": {
    "./*": "./dest/*"
  },
  "typesVersions": {
    "*": {
      "*": [
        "dest/*"
      ]
    }
  },
  ...
}

We're able to consume the package in our projects, like this:

import { something } from 'test-package/something'; // Actual file './dest/something.js'

This works. Our code is transpiled correctly. We get autocomplete on the import path, and typing on the imported whatever, within VS Code.

Until, we attempt to access a sub folder within the 'dest' folder. Within a subfolder, like:

import { somethingElse } from 'test-package/sub-folder/something-else'; // Actual file './js/sub-folder/something-else.js'

In this instance, we get everything from above, except autocomplete on the import path. The file still resolves, and we get typing. Our build script still runs, the files is just invisible.

This is using Visual Studio Code 1.64.2 and TypeScript 4.5.5. Both project and package have the following tsconfig.json:

{
  ...
    "target": "ES2016",
    "module": "ESNext",
  ...
}

🙁 Actual behavior

Autocomplete does not resolve the scripts with the sub folder.

Demo

🙂 Expected behavior

Autocomplete should resolve the scripts within a sub folder.

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions