microsoft / microsoft/TypeScript

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

Offen
#37,826 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem im Issue beschriebenen Verhalten von Automatic Type Acquisition, der Einstellung typeAcquisition.include in jsconfig.json und der Reproduktion im Demo-Repository mit npm install und index.test.js. Verfolge, wie explizit eingeschlossene Jest-Typen gegen node_modules aufgelöst werden; fertig ist es, wenn die Konfiguration die angeforderten Typen priorisieren kann und IntelliSense im Demo funktioniert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, typescript, vscode
Bereich
developer-experience, tooling
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.