You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pstack statechart: strict typecheck reports four errors in run.ts and CLI tests #1141
The statechart compiler in pstack 0.15.36 produces four TypeScript errors when checked with its existing scripts/tsconfig.json. I reproduced this on an unchanged copy of commit c742dd61706fbacc1b95f1a20b7b988cf096ce6c, using the pinned toolchain below.
There are two causes, each reported at two locations:
run.ts: the exit property in common is inferred as number, while CheckResult.exit requires 0 | 1 | 2. Both returns that spread common fail.
test/cli.test.ts: two test callbacks return signalWhile(...), whose promise resolves to the phase object. The Node TestFn type requires void | Promise<void>.
No changes to source files or tsconfig.json are needed. The package's declared fast-check@4.5.3 dependency is installed along with the two explicit packages.
The command exits 1 with these diagnostics, abbreviated:
run.ts(455,9): error TS2322: ... is not assignable to type 'CheckResult'.
Types of property 'exit' are incompatible.
Type 'number' is not assignable to type '0 | 1 | 2'.
run.ts(471,5): error TS2322: ... is not assignable to type 'CheckResult'.
Types of property 'exit' are incompatible.
Type 'number' is not assignable to type '0 | 1 | 2'.
test/cli.test.ts(430,5): error TS2345: ... is not assignable to parameter of type 'TestFn'.
Type 'Promise<...phase object...>' is not assignable to type 'void | Promise<void>'.
test/cli.test.ts(453,5): error TS2345: ... is not assignable to parameter of type 'TestFn'.
Type 'Promise<...phase object...>' is not assignable to type 'void | Promise<void>'.
Expected result and scope
Checking the existing strict TypeScript configuration should exit 0, or the supported compiler and Node type versions should be specified if a different toolchain is intended.
The package currently exposes a runtime test command rather than a typecheck command. I did not observe a CLI failure caused by these type errors: a passing-model smoke test exited 0, and a counterexample smoke test exited 1 with the expected report. This report concerns static checking with the versions above.
A contextual type for common that preserves CheckResult["exit"], and callbacks that await signalWhile without returning its phase object, appear to be the relevant correction points.
Activity