microsoft / microsoft/TypeScript

Support loading remote types

Ouverte
#63,115 5 commentaires 2 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Awaiting More Feedback Suggestion
Langage dominant
Go
Étoiles
111k
Forks
14.3k
Merge moyen
2 j 4 h
PR mergées (30 j)
132

Description

### 🔍 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

Guide de contribution

Ouvrir le guide de contribution

Par oĂč commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela Ă©vite que deux personnes fassent le mĂȘme travail.
  3. Forkez le dépÎt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Aucun fichier, test ou point d’entrĂ©e n’est nommĂ©. Commencez par examiner l’exemple ts-import proposĂ© et la solution de contournement indiquĂ©e pour package.json, puis Ă©tudiez comment TypeScript rĂ©sout actuellement les dĂ©pendances de type uniquement. Le travail sera considĂ©rĂ© comme terminĂ© lorsqu’un design convenu et une implĂ©mentation du chargement de fichiers .d.ts distants seront dĂ©finis, y compris le comportement pour le cas d’utilisation d’une configuration basĂ©e sur une URL.

Rédigé par le modÚle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
typescript
Domaine
compilers
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Active
Clarté
À clarifier
Accessibilité débutants
30/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.