Repository navigation
Description
Summary
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: theexitproperty incommonis inferred asnumber, whileCheckResult.exitrequires0 | 1 | 2. Both returns that spreadcommonfail.test/cli.test.ts: two test callbacks returnsignalWhile(...), whose promise resolves to the phase object. The NodeTestFntype requiresvoid | Promise<void>.
Reproduce
git clone --filter=blob:none --sparse https://github.com/cursor/plugins.git pstack-typecheck-repro
cd pstack-typecheck-repro
git sparse-checkout set pstack
git checkout --detach c742dd61706fbacc1b95f1a20b7b988cf096ce6c
cd pstack/skills/statechart/scripts
npm install --ignore-scripts --no-save --package-lock=false --no-audit --no-fund typescript@7.0.2 @types/node@26.1.2
./node_modules/.bin/tsc -p tsconfig.json --pretty falseNo 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.
Environment used:
- macOS, arm64
- Node
24.13.0, npm11.6.2 - TypeScript
7.0.2,@types/node26.1.2,fast-check4.5.3
Actual result
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