microsoft / microsoft/TypeScript
Support loading remote types
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
### 🔍 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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Es werden keine Dateien, Tests oder Einstiegspunkte genannt. Beginne mit der Prüfung des vorgeschlagenen ts-import-Beispiels und des angegebenen package.json-Workarounds und untersuche anschließend, wie TypeScript derzeit reine Typabhängigkeiten auflöst. Als abgeschlossen gilt die Vereinbarung über ein Design und dessen Implementierung zum Laden entfernter .d.ts-Dateien, einschließlich eines definierten Verhaltens für den konfigurationsbasierten Anwendungsfall mit URL.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Aktiv
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 30/100