microsoft / microsoft/TypeScript

Support loading remote types

Aperta
#63,115 5 commenti 2 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

It would be great if TypeScript supported importing type definitions in config files directly from a remote URL (akin to JSON’s $schema), enabling typed configs without forcing consumers to install and maintain purely type-level dependencies in package.json

### ✅ Viability Checklist

- [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. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- [x] This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- [x] This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals

### ⭐ Suggestion

-

### 📃 Motivating Example

Example:

`// @ts-import "http://example.com/Definitions-1.2.0/Library.d.ts"`

### 💻 Use Cases

1. What do you want to use this for?
For tools config ts files
3. What shortcomings exist with current approaches?

- Type-only dependencies are unnecessarily coupled to package management
Even when a library is consumed purely at the type level, users are required to declare and version it in package.json. This inflates dependency graphs, increases maintenance overhead, and introduces update and security workflows for artifacts that have no runtime relevance.
- Ergonomics for library and framework authors
Tool authors lack a lightweight, declarative way to publish stable, versioned configuration contracts.

5. What workarounds are you using in the meantime? Import in the package.json

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

Non vengono indicati file, test o punti di ingresso. Inizia esaminando l'esempio ts-import proposto e la soluzione alternativa indicata per package.json, quindi analizza come TypeScript risolve attualmente le dipendenze costituite esclusivamente da tipi. Il lavoro sarà considerato completato quando saranno concordati un design e un'implementazione per il caricamento di file .d.ts remoti, incluso il comportamento definito per il caso d'uso della configurazione basata su URL.

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

Valutazione

Stack tecnologico
typescript
Ambito
compilers
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Attiva
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.