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

Aperta
#1,647 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
24/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
compilers

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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?
Lingua principale
TypeScript
Stelle
6.7k
Fork
229
Merge medio
14h 29m
PR unite (30g)
787

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel-labs/scriptc

Tutte le issue di vercel-labs/scriptc

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.