Expose more node checking / type guard API functions for developers

Đang mở
#52,727 16 bình luận 1 reaction 0 người được giao Xem trên GitHub

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

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ả

In Discussion Suggestion

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:

💻 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

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.

Issue khác của microsoft/TypeScript

Tất cả issue của microsoft/TypeScript

Issue tương tự

Thêm issue về Go

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.