Expose more node checking / type guard API functions for developers
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- compilers, developer-experience
Hướng nghiên cứu
Bắt đầu với src/compiler/factory/nodeTests.ts và các hàm được tham chiếu trong ts-api-utils PR #50. Xem xét các issue liên quan #23719, #50694 và #52473, cùng với phần thảo luận, để xác định những guard nội bộ hoặc chưa được export nào đã có sự thống nhất về việc công khai. Hoàn thành khi đã thống nhất được phạm vi và có các thay đổi tương ứng đối với public API.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Suggestion
🔍 Search Terms
type guard internal api functions tsutils ts-api-utils
✅ Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
⭐ Suggestion
The typescript package contains many node checking / type guard API functions for developers (isAccessor, isArrayBindingPattern, etc.). Many of them are exported for public use. Some are not. Could we expose many more of them?
A bit of history: the tsutils package has existed for many years to fill in those missing type guards & other API pieces. It hasn't been maintained in a couple of years so I'm filling out a successor, ts-api-utils with a lot of help from @RebeccaStevens. We're now discussing which parts of the TypeScript API -internal and public- the package should provide.
📃 Motivating Example
Two categories of @internal functions come to mind:
/src/compiler/factory/nodeTests.tscontains 21:isCommaToken,isExclamationToken,isQuestionToken, etc.- See https://github.com/JoshuaKGoldberg/ts-api-utils/pull/50: there are quite a few functions within TypeScript that aren't exported but would be useful:
isExpression,isExpressionNode,isUnaryExpression, etc.
💻 Use Cases
Developers writing logic to work with the TypeScript AST often want these functions as they're handy utilities. Many of them exist in tsutils for that reason.
import * as ts from "typescript";
import * as tsutils from "tsutils";
declare const node: ts.Node;
tsutils.isExpression(node);
Request: which of those internal / not-exported functions would you be open to a PR exposing to the public?
Related:
- #23719
- #50694
- #52473
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.4k
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 117
Hướng dẫn đóng góp
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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
microsoft/TypeScript#64322 · 2 bình luận · 1 reaction · 2 người được giao ·
-
Possible Improvement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/TypeScript#64278 · 1 bình luận · 1 reaction ·
-
Docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
microsoft/TypeScript#64118 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
microsoft/TypeScript#64094 ·
-
Docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
microsoft/TypeScript#63959 · 5 bình luận ·
Tất cả issue của microsoft/TypeScript
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
caddyserver/caddy#8046 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
L1 recommended for recruits
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
optimization optimization:agents-md-curator
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
githubnext/gh-aw-cao#13143 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
blinklabs-io/bursa#904 ·