microsoft / microsoft/TypeScript

Support for custom Automatic Type Acquisition scopes.

Offen
#23,952 5 Kommentare 4 Reaktionen 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

Search Terms

Automatic type acquisition scopes, custom type acquisition, acquire types from custom scope

Suggestion

The ability to specify in .tsconfig and/or IDE settings additional scopes to search beyond @types for type acquisition.

Use Cases

Private repositories with large amounts of JavaScript code and a small number of TypeScript developers who wish to produce accurate typings, and a high barrier to entry to modifying/adding declaration files to the JavaScript projects. This mirrors the public ecosystem with say, react and @types/react.

Examples

A new string array parameter of scopes to search for:

{
  "typeAcquisition": {
    "searchScopes": [
      "@companyname-types",
      "@types"
    ]
  }
}

This would also allow overriding the @types scope. The first scope with a matching declaration should win.

Checklist

My suggestion meets these guidelines:
[X] This wouldn't be a breaking change in existing TypeScript / JavaScript code
[X] This wouldn't change the runtime behavior of existing JavaScript code
[X] This could be implemented without emitting different JS based on the types of the expressions
[X] This isn't a runtime feature (e.g. new expression-level syntax)

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 damit, die Implementierung der automatischen Typakquise und die Behandlung von typeAcquisition in tsconfig zu lokalisieren, und verfolge anschließend, wie die Scopes von Deklarationspaketen derzeit aufgelöst werden. Lege das Konfigurationsverhalten für searchScopes fest, einschließlich der Reihenfolge und der @types-Überschreibungen, und füge Tests hinzu, die zeigen, dass der erste passende Deklarations-Scope ausgewählt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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