microsoft / microsoft/TypeScript
Support loading remote types
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
### 🔍 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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
未指定任何文件、测试或入口点。先审阅提议的 ts-import 示例和所述的 package.json 变通方案,然后调查 TypeScript 目前如何解析仅包含类型的依赖项。完成的要求是就加载远程 .d.ts 文件达成一致的设计并完成实现,其中包括为基于 URL 的配置用例定义行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 活跃
- 描述清晰度
- 需要澄清
- 新手友好度
- 30/100