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

オープン
#1,647 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
24/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
活発
技術スタック
node.js, typescript
領域
compilers

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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?
主要言語
TypeScript
スター
6.7k
フォーク
229
平均マージ
14時間 29分
マージ済み PR(30日)
787

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

vercel-labs/scriptc のほかの issue

vercel-labs/scriptc の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。