← Back to Pull requests

fix(typescript-fetch): compile runtime.ts with noUncheckedIndexedAccess #25657

Open
unknown opened this pull request with 488 lines diff across 6 files
View on GitHub
unknown unknown commented on Nov 13, 2026 08:13 UTC
Author

Fixes #25643.

Since 7.26.0 the generated runtime.ts of typescript-fetch does not compile in a project that enables noUncheckedIndexedAccess. The Content-Disposition parsing added in #24957 and #24974 reads regex capture groups by index without a guard, and under this option every indexed access has the type string | undefined. Consuming projects compile the generated clients with their own compiler options, so the update broke the build of such projects.

Changes

1. fix: guard the three accesses in typescript-fetch/runtime.mustache, as suggested in the issue, and regenerate the 25 typescript-fetch samples. The guarded groups always participate in a successful match, so the behaviour does not change.
2. test: add the type-check project samples/client/petstore/typescript-fetch/tests/unchecked-indexed-access. It compiles every sample runtime.ts with strict and noUncheckedIndexedAccess. It follows the model of tests/isolated-declarations from #25277 and runs in the same pretest step of tests/default, so the existing "Samples TS clients" workflow covers it.

I kept the new check separate from tests/isolated-declarations, because the README of that project says the option is disabled there on purpose, to keep the test focused on declaration emission.

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
      

    I built the CLI module with its dependencies, skipping the Java tests, and regenerated the bin/configs/typescript-fetch-* samples only. The change adds no generator option, so the generator docs are unchanged.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
  • cc @wing328
    cc @TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx @macjohnny @topce @akehir @petejohansonxo @amakhrov @davidgamero @mkusaka @joscha @KannaKim @thekhegay

    <!-- This is an auto-generated description by cubic. -->
    ---

    Summary by cubic


    Fixes the typescript-fetch runtime.ts so it compiles in projects that enable noUncheckedIndexedAccess. The Content-Disposition parsing added in 7.26.0 read regex capture groups without a guard, breaking the build of consuming projects that compile the generated client with this compiler option. The guarded groups always participate in a successful match, so parsing behavior is unchanged; all 25 sample runtimes were regenerated.

    Testing

  • Adds a type-check project that compiles every sample runtime.ts with strict and noUncheckedIndexedAccess, wired into the existing tests/default pretest step so CI covers it. The samples-typescript-fetch-client workflow now also watches the new test directory, tests/isolated-declarations, and generated runtime.ts files directly.
  • <sup>Written for commit d85c5e1dc2f59adfd66a5095d93ca3e6510bd5fe. Summary will update on new commits.</sup>

    <a href="https://cubic.dev/pr/OpenAPITools/openapi-generator/pull/25657?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: 488 lines (+366 / -122) across 6 files Reviewer: thekhegay Review duration: 1706m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.47) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 488 lines diff across 6 files
    0.47
    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.370
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #25657"
    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: 47.4% (MEDIUM) · Higher = larger blast radius
    47.4%
    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: 25.2% · Safe to merge
    25.2%