microsoft / microsoft/TypeScript

Support for custom Automatic Type Acquisition scopes.

Aperta
#23,952 5 commenti 4 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

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)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia individuando l'implementazione dell'acquisizione automatica dei tipi e la gestione di typeAcquisition in tsconfig, quindi traccia il modo in cui vengono attualmente risolti gli scope dei pacchetti di dichiarazioni. Definisci il comportamento di configurazione per searchScopes, incluso l'ordine e le sovrascritture di @types, e aggiungi una copertura che dimostri che viene selezionato il primo scope di dichiarazione corrispondente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, typescript
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.