← Back to Pull requests

fix(typescript-fetch): type FetchError cause without parameter property #25671

Open
unknown opened this pull request with 403 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 14, 2026 10:11 UTC
Author

With lib es2022 Error already has cause, so parameter property constructor(public cause: Error, ...) in FetchError gives TS4115 under noImplicitOverride. Adding override is not an option, it failes with lib below es2022 (TS4113)

Now cause is assigned in constructor and typed through interface merged with the class. declare cause: Error in class body also compiles, but Babel 7 rejects declare fields unless allowDeclareFields is on, so went with interface (same name is needed for merging, this is the question from #24575). Only FetchError is changed, other parameter properties left as they are

Checked generated runtime.ts with tsc 5.0, 5.9 and 6.0, --strict --noImplicitOverride, lib es2022 and es2015: no errors, master has TS4115 on es2022. e.cause is still typed as Error. Added test in TypeScriptFetchClientCodegenTest, typescript tests pass. Regenerated all 93 typescript configs, only 25 typescript-fetch runtime.ts change, same hunk in each

Fixes #14515

PR checklist

  • Read the contribution guidelines.

  • Run the following to build the project and update samples:

  •   ./mvnw clean package || exit
      ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
      ./bin/utils/export_docs_generators.sh || exit
      

    Commit all changed files.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
  • @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 FetchError when noImplicitOverride is enabled and the lib is es2022, where Error already declares cause.

    Bug Fixes

  • cause is now assigned in the constructor instead of using a parameter property, since override fails with lib es2015 and declare fields are rejected by Babel 7.

  • cause is typed via a declaration-merged interface and stays typed as Error; verified with tsc 5.0, 5.9, and 6.0 under --strict --noImplicitOverride with 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. -->

    Diff: 403 lines (+302 / -101) across 5 files Reviewer: thekhegay Review duration: 148m
    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
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.8% (MEDIUM) · Higher = larger blast radius
    44.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 23.9% · Safe to merge
    23.9%