fix(typescript-fetch): type FetchError cause without parameter property #25671
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 403 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.359
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #25671"
general
weight: 0.35
thekhegay
With
libes2022Erroralready hascause, so parameter propertyconstructor(public cause: Error, ...)inFetchErrorgives TS4115 undernoImplicitOverride. Addingoverrideis not an option, it failes with lib below es2022 (TS4113)Now
causeis assigned in constructor and typed through interface merged with the class.declare cause: Errorin class body also compiles, but Babel 7 rejectsdeclarefields unlessallowDeclareFieldsis on, so went with interface (same name is needed for merging, this is the question from #24575). OnlyFetchErroris changed, other parameter properties left as they areChecked generated
runtime.tswith tsc 5.0, 5.9 and 6.0,--strict --noImplicitOverride, lib es2022 and es2015: no errors, master has TS4115 on es2022.e.causeis still typed asError. Added test inTypeScriptFetchClientCodegenTest, typescript tests pass. Regenerated all 93 typescript configs, only 25 typescript-fetchruntime.tschange, same hunk in eachFixes #14515
PR checklist
Commit all changed files.
@TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx @macjohnny @topce @akehir @petejohansonxo @amakhrov @davidgamero @mkusaka @joscha @KannaKim
<!-- This is an auto-generated description by cubic. -->
---
Summary by cubic
Fixes the TypeScript 4115 compiler error in typescript-fetch's generated
FetchErrorwhennoImplicitOverrideis enabled and the lib is es2022, whereErroralready declarescause.Bug Fixes
causeis now assigned in the constructor instead of using a parameter property, sinceoverridefails with lib es2015 anddeclarefields are rejected by Babel 7.causeis typed via a declaration-merged interface and stays typed asError; verified with tsc 5.0, 5.9, and 6.0 under--strict --noImplicitOverridewith es2015 and es2022 libs, and all 25 typescript-fetch samples were regenerated.Fixes #14515
<sup>Written for commit af7087cb4fd1dd0c23394ff248bb35939293dc5d. Summary will update on new commits.</sup>
<a href="https://cubic.dev/pr/OpenAPITools/openapi-generator/pull/25671?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->