mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-14 12:55:16 +08:00
A delay read through bracket access skipped TimeoutNaNWarning, so that an element read past the end, undefined in Node and NaN here, warns nothing. That only holds for a delay typed number: an untyped (checked-dynamic) delay tests undefined before it converts, and a `number | undefined` delay warns only in its defined arm, so a NaN in either now warns, as Node's Timeout constructor does. An untyped delay converted with Number(), so a BigInt delay scheduled a timer. It now converts as Node's `after *= 1` does, which throws "Cannot mix BigInt and other types, use explicit conversions" from setTimeout and setInterval. setTimeout and setInterval called as stored function values convert their delay the same way, and now also emit the Timeout warnings. Corpus timers-untyped-delay-reads.cjs (BigInt delays, direct and through function values; NaN and past-the-end element reads of an untyped array; a negative delay through a stored setTimeout) and timers-optional-delay-reads.ts (number | undefined element reads). timer-delay-lowering.test.ts pinned the delay as the plain number the call reads; it now expects the timers.userDelay check around a number variable and around the defined arm of a `number | undefined` delay.