Clarifying recommendation for when to publish types to DefinitelyTyped vs bundled
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- documentation
Hướng nghiên cứu
Bắt đầu với packages/documentation/copy/en/declaration-files/Publishing.md, đặc biệt là phần hướng dẫn quanh các dòng 11–16, và so sánh cách diễn đạt của phần này với phần làm rõ được đề xuất trong issue. Hoàn thành nghĩa là tài liệu phân biệt rõ ràng giữa các type được tích hợp sẵn và hướng dẫn của DefinitelyTyped cho cả các dự án TypeScript và JavaScript.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Per #2804, I am creating a new issue to replace #2032 with renewed clarity and purpose.
When publishing types, there are essentially two standard ways to do so:
Reading this, to me, "Otherwise" suggests that packages should only bundle their types if they were automatically generated.
This nicely covers two use cases:
- Source is in TypeScript. Published package is compiled to JavaScript alongside type definitions.
- Source is not in TypeScript. Package users independently publish and maintain types for the package.
I think a 3rd intermediate case is missing:
- Source is not in TypeScript. Code maintainer willing to add, maintain, and publish type definitions alongside source.
I've had passing conversations with maintainers that seemed to me to be under the impression that publishing manually created types separately was the preferred way to do it, seemingly because of this phrasing. Some even suggested doing this for TypeScript packages...
As far as I can tell, there is basically no downside to publishing accurate types along with source code, besides a marginal increase bundle size. The improved developer experience is well worth it and the types get compiled away for any real publishing. I would also think DefinitelyTyped would prefer if others did not rely on DT as it centralizes type issues in their respective packages and handles mismatched version issues intrinsically.
Suggestion for new phrasing
Including up-to-date types in published packages is always preferred. Bundling types improves developer experiences and reduces occurrence of common bugs and issues. If your types are generated by your source code, or you are keeping them up to date manually, we recommend you publish them with your published code bundle. Both TypeScript and JavaScript projects can generate types via declaration.
If you would prefer to not bundle your type definitions in your published package, we recommend submitting the types to DefinitelyTyped, which will publish them to the @types organization on npm.
If you do neither, any users of your package may still submit their own types to DefinitelyTyped.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.6k
- Fork
- 1.5k
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 8
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/TypeScript-Website
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
microsoft/TypeScript-Website#3611 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
microsoft/TypeScript-Website#3607 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
microsoft/TypeScript-Website#3039 ·
-
More examples of `infer` Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
microsoft/TypeScript-Website#2998 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
microsoft/TypeScript-Website#3614 ·
Tất cả issue của microsoft/TypeScript-Website
Issue tương tự
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Crush Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
ElementsProject/cln-application#167 · 1 bình luận · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Quantco/pnpm-licenses#17 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100