← Back to Pull requests

Fix strict transform array element type #57908

Open
unknown opened this pull request with 311 lines diff across 3 files
View on GitHub
unknown unknown commented on Aug 12, 2026 09:37 UTC
Author

Summary:

Fixes #53899.

MergeUnion made every transform key optional before MaximumOneOf selected a key. Indexing that optional mapped type added undefined to each element of ViewStyle['transform'] under strict null checks. This makes the intermediate keys required, preserving the existing one-key transform constraint while keeping undefined out of the array element type.

Changelog:

[General] [Fixed] - Prevent strict transform array element types from including undefined

Test Plan:

Validated after merging main at 024d5dafd530412efe43c9c2f95c9da109f48092:

  • yarn build-types and yarn build-types --validate — passed; the generated snapshot is up to date.

  • yarn test-generated-typescript and yarn test-typescript-legacy — passed.

  • Focused ESLint and Prettier checks on _TransformStyle.js, plus git diff --check — passed.
  • The existing TypeScript suites use strict: false, so the strict-null behavior was checked separately through the generated public ViewStyle type. The probe below fails on unmodified 024d5daf with TS2769 at Object.keys(element) and passes on this branch. Both runs rebuilt and resolved their own generated workspace types.

    After generating types, this command reproduces the check and removes its temporary file and directory:

    (
      set -e
      rn_probe_dir=$(mktemp -d packages/react-native/__typetests__/.rn-transform-probe.XXXXXX)
      trap 'rm -f -- "$rn_probe_dir/transform-probe.ts"; rmdir -- "$rn_probe_dir"' EXIT
      cat > "$rn_probe_dir/transform-probe.ts" <<'TS'
    import type {ViewStyle} from 'react-native';
    
    type TransformArray = Exclude<NonNullable<ViewStyle['transform']>, string>;
    const transforms: TransformArray = [{translateX: 1}];
    transforms.map(element => Object.keys(element));
    TS
      ./node_modules/.bin/tsc --noEmit --strict --skipLibCheck --moduleResolution bundler --module esnext --target es2020 "$rn_probe_dir/transform-probe.ts"
    )
    

    Separate strict probes passed for single-key objects, readonly arrays, animated values, string transforms, an omitted transform, and the existing optional selected property. Negative probes confirmed rejection of undefined array elements and objects with multiple transform keys.

    No additional test script or strict TypeScript configuration is included, as requested in review. The generator Jest suite, Flow check, full repository lint/Jest, native builds, and RNTester were not run for this update.

    Codex was used for this update and its validation.

    Diff: 311 lines (+233 / -78) across 3 files Reviewer: Boulea7 Review duration: 91539m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.47) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 311 lines diff across 3 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%
    44%
    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.344
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #57908"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.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.3% (MEDIUM) · Higher = larger blast radius
    47.3%
    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: 44.7% · Lower = rushed or shallow review
    44.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: 26.2% · Safe to merge
    26.2%