microsoft / microsoft/TypeScript

Automatic Type Acquisition should give the ability to prioritize jsconfig.json types over node_modules types

Open
#37,826 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Feature request

Visual Studio Code should download @types/jest with this jsconfig.json configuration :

{
    "typeAcquisition": {
        "include": [
            "jest"
        ]
    }
}

But Automatic Type Acquisition give priority to Jest types coming from node_modules :

[23:20:24.533] Explicitly included types: ["jest"]
[23:20:24.534] Typing names in '/data/www/jest-vscode-ata/package.json' dependencies: ["jest"]
[23:20:24.578] Searching for typing names in /data/www/jest-vscode-ata/node_modules; all files: [...]
[23:20:24.632]     Package 'jest' provides its own types.

Provided Jest types seems to be useless and they are not globally available. Automatic Type Acquisition should give the ability to prioritize jsconfig.json configuration over node_modules types.

Configuration

  • VSCode Version: 1.43.2
  • OS Version: Debian 10 / Xfce 4.12

Demo repository

Workaround

  • Installing @types/jest as dev dependency fix the issue but typing should be Automatic Type Acquisition responsibility
  • Installing Jest globally and removing it from dev dependency fix the issue but Jest should be listed as dev dependency

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Automatic Type Acquisition behavior described in the issue, the jsconfig.json typeAcquisition.include setting, and the demo repository's npm install and index.test.js reproduction. Trace how explicitly included Jest types are resolved against node_modules; done means the configuration can prioritize the requested types and IntelliSense works in the demo.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.