Clarification / RFC: BigInt(Uint8Array) lowering parity and documentation of runtime-optional storage rules

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

Maintainer thường phản hồi trong vòng 1 ngày

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
24/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript
Lĩnh vực
compilers

Hướng nghiên cứu

Read the investigations in #1644 and #1645, then inspect lowerBigIntConstructorValue and the SC2020/SC1090 diagnostic paths mentioned in the issue. Decide whether to add bytes runtime dispatch, refine the existing diagnostic envelope or introduce a dedicated code, and where to document runtime optional callee promotion. Done means maintainers resolve these policy questions and identify the resulting implementation and documentation scope.

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

Mô tả

Context

Following the investigation in #1644 (Record index-signature read parameter widening) and #1645 (SC2020 diagnostic accuracy), three design and policy questions arose regarding lowering parity and documentation.

Questions for Maintainers
  1. Parity for BigInt(Uint8Array) / BigInt(bytes):

    • In Node.js, BigInt(new Uint8Array([1])) === 1n and BigInt(new Uint8Array([])) === 0n via standard JS ToPrimitive string coercion (multi-element typed arrays throw SyntaxError).
    • Scriptc currently accepts {bigint, string, f64, bool, unit} in lowerBigIntConstructorValue, but omits bytes / Uint8Array.
    • Is extending lowerBigIntConstructorValue to support bytes via runtime dispatch desirable for Node parity?
  2. Diagnostic code policy vs message enhancement:

    • When an expression inside a type guard cannot be lowered because of runtime-optional storage widening, should this eventually receive a dedicated diagnostic code (requiring a surface manifest regeneration), or is refining the existing SC2020/SC1090 message and hint envelope preferred?
  3. Documentation of runtime-optional callee promotion:

    • When indexed reads widen callee parameters to ensure storage safety across call sites, should this rule be explicitly documented under docs/content/limitations/ or types-and-class-definitions/unions.mdx to set expectations for library authors targeting static compilation?
Ngôn ngữ chính
TypeScript
Star
6.7k
Fork
229
Merge trung bình
14 giờ 29 phút
Pull request đã merge (30 ngày)
787

Chuẩn bị môi trường

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 vercel-labs/scriptc

Tất cả issue của vercel-labs/scriptc

Issue tương tự

Thêm issue về TypeScript

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.