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
TS7031 false positive: destructured parameter with default in a contextually typed arrow #1019
tsrs reports TS7031 for a binding element in a destructured parameter with a default when the arrow function is contextually typed. The parameter's contextual type is optional (opts?: {...}). tsc 7.0.2 and bun check accept the same program.
This may be related to #664, which was closed as unable to reproduce. The pattern here is different: there is no type annotation on the parameter, and the type comes only from context.
Versions
tsrs: Version 7.1.0-beta (tsrs 0.25.0-ts7.1.0-beta, microsoft/TypeScript@3e9236361fa9), Linux x86_64
Reference: native tsc from typescript 7.0.2 exits 0, and bun check (Bun 1.4.4) exits 0.
Unit Test: No — issue not reproduced; the pinned reference compiler agrees with tsrs
Priority:Priority P3: Narrow or low-impact issue. The reported diagnostic matches the pinned TypeScript Go compiler exactly, so this is a difference between JavaScript tsc 7.0.2 and TypeScript 7.1.0-beta rather than a tsrs defect.
tsrs emits the same TS7031 diagnostic and exit code as the pinned TypeScript Go reference compiler (commit 3e9236361fa9, Version 7.1.0-beta) on the exact reproduction from the issue. The installed JavaScript tsc 7.0.2 accepts the program, but this repository uses the pinned Go compiler as the source of truth.
I wasn't able to find a fix, but I identified some areas that may be relevant. The TS7031 diagnostic is emitted consistently by both tsrs and the pinned Go compiler, so the behavior appears intentional in Version 7.1.0-beta. No tsrs source change is necessary; any change in behavior would need to come from the upstream TypeScript Go reference implementation. The relevant logic would be in the checker paths that handle destructuring patterns and contextual typing for arrow-function parameters (e.g. crates/tsrs_checker in tsrs, corresponding code in the reference compiler).
Created triage/gh-1019/repro.ts matching the issue exactly.
Built tsrs from the checkout:
cargo build --profile dev --locked -p tsrs_cli -p tsrs_testrunner
Built the pinned TypeScript Go compiler from Cargo.toml:
commit = 3e9236361fa97a9e6c685f4833ac457ae2d8c50a
Sparse checkout under triage/gh-1019/ts-ref, built tsc_bin.
Results
tsrs
$ ../../target/debug/tsrs -p . --pretty false
repro.ts(4,21): error TS7031: Binding element 'actions' implicitly has an 'any' type.
exit: 2
Pinned Go tsc (3e9236361fa9, Version 7.1.0-beta)
$ ./ts-ref/tsc_bin -p . --pretty false
repro.ts(4,21): error TS7031: Binding element 'actions' implicitly has an 'any' type.
exit: 2
Installed JS tsc (7.0.2, for information only)
$ tsc -p . --pretty false
exit: 0
Conclusion
NOT REPRODUCED as a tsrs parity defect.
The checked-out tsrs (built from this branch) produces the same diagnostic and exit status as the pinned TypeScript Go compiler. The difference is between TypeScript 7.0.2 (JavaScript) and 7.1.0-beta (the pinned Go reference implementation), not between tsrs and the pinned reference.
Per this repository's triage rules, the pinned Go compiler is the specification. Since tsrs matches it, tsrs is correct here.
This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
Activity
oxc-captain commentedon Nov 17, 2026
tsc7.0.2 and TypeScript 7.1.0-beta rather than a tsrs defect.tsrs emits the same
TS7031diagnostic and exit code as the pinned TypeScript Go reference compiler (commit3e9236361fa9, Version 7.1.0-beta) on the exact reproduction from the issue. The installed JavaScripttsc7.0.2 accepts the program, but this repository uses the pinned Go compiler as the source of truth.I wasn't able to find a fix, but I identified some areas that may be relevant. The TS7031 diagnostic is emitted consistently by both tsrs and the pinned Go compiler, so the behavior appears intentional in Version 7.1.0-beta. No tsrs source change is necessary; any change in behavior would need to come from the upstream TypeScript Go reference implementation. The relevant logic would be in the checker paths that handle destructuring patterns and contextual typing for arrow-function parameters (e.g.
crates/tsrs_checkerin tsrs, corresponding code in the reference compiler).Full Triage Report
Triage report for #1019
Issue claim
TS7031 false positive: destructured parameter with default in a contextually typed arrow.
Input:
Reporter says native
tsc7.0.2 and Bun check accept the program, while tsrs emits:Reproduction
Created
triage/gh-1019/tsconfig.json:{ "compilerOptions": { "strict": true, "noEmit": true, "target": "es2022", "module": "esnext", "moduleResolution": "bundler" }, "files":["repro.ts"] }Created
triage/gh-1019/repro.tsmatching the issue exactly.Built tsrs from the checkout:
Built the pinned TypeScript Go compiler from
Cargo.toml:Sparse checkout under
triage/gh-1019/ts-ref, builttsc_bin.Results
tsrs
Pinned Go tsc (3e9236361fa9, Version 7.1.0-beta)
Installed JS tsc (7.0.2, for information only)
Conclusion
NOT REPRODUCED as a tsrs parity defect.
The checked-out tsrs (built from this branch) produces the same diagnostic and exit status as the pinned TypeScript Go compiler. The difference is between TypeScript 7.0.2 (JavaScript) and 7.1.0-beta (the pinned Go reference implementation), not between tsrs and the pinned reference.
Per this repository's triage rules, the pinned Go compiler is the specification. Since tsrs matches it, tsrs is correct here.
This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
marklawlor-payble commentedon Nov 17, 2026
The triage is right: this isn't a tsrs defect. It's an upstream TypeScript 7.1 regression, and tsrs is matching it.
Published npm builds behave the same way on a minimal case:
typescript@7.0.2: no errorstypescript@7.1.0-beta: TS7031 onpathtypescript@7.1.0-dev.20261117.1: TS7031 onpathUpstream it bisects to microsoft/TypeScript#64043 and is tracked in microsoft/TypeScript#64974 and microsoft/TypeScript#64431. That probably means this issue can be closed in favour of those.