While compiling the full Sentry CLI and its JavaScript dependencies, several refusals describe different JavaScript behavior from the code being rejected. This makes it difficult to tell whether a dependency is invalid or scriptc needs additional lowering support.
This follows up on #3037 and #3039. Those were closed as fixed by #3112, but that PR's merged diff contains the regex change; these three descriptions are still unchanged on current main.
For example, save either example as example.mjs:
class Value {}
Value = class Replacement {};
console.log(Value.name);Node prints Replacement. scriptc refuses the assignment and says the class binding is read-only and Node throws a TypeError (TS2629). A class declaration has a mutable outer binding; the class's inner binding is a separate immutable binding.
function value() { return 1; }
value = () => 2;
console.log(value());Node prints 2, including in a module. scriptc's TS2630 hint instead says Node throws a TypeError in strict mode and modules. A function declaration is mutable; a named function expression's inner binding has different assignment behavior.
There is also a misleading TS2739 description:
// @ts-check
/** @type {{ first: string, second: string, third: string }} */
export const value = { first: "one" };scriptc describes this as a set-like argument missing has and size. This example has no Set operation; it is an ordinary value missing properties required by its target type.
The requested fix is limited to accurate refusal descriptions. It should preserve the diagnostic codes and admission decisions, distinguish mutable declaration bindings from immutable inner bindings, and describe TS2739 without assuming a Set protocol. Regression tests should exercise actual preflight diagnostics rather than just checking the table's source text.
Reproduced with scriptc 0.4.9 built from current main and Node 24.22.1. Four real preflight regression cases fail with the current descriptions: ordinary object shape, function declaration, class declaration, and named function expression. Related earlier work: #3037, #3039, #3112.
Activity
0No activity yet.