microsoft / microsoft/TypeScript

Support loading remote types

Đang mở
#63,115 5 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Awaiting More Feedback Suggestion
Ngôn ngữ chính
Go
Star
111k
Fork
14.3k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
132

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Không có tệp, bài kiểm thử hoặc điểm vào nào được nêu tên. Hãy bắt đầu bằng việc xem xét ví dụ ts-import được đề xuất và giải pháp thay thế package.json đã nêu, sau đó tìm hiểu cách TypeScript hiện đang phân giải các dependency chỉ dành cho kiểu. Công việc được xem là hoàn tất khi có thiết kế đã được thống nhất và phần triển khai để tải các tệp .d.ts từ xa, bao gồm hành vi được xác định cho trường hợp sử dụng cấu hình dựa trên URL.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
compilers
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
30/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.