Skip to content

fix(checker): pad object binding defaults only for initialized elements - #1069

Closed
camc314 wants to merge 1 commit into
mainfrom
fix/object-binding-default-padding
Closed

camc314 wants to merge 1 commit into
mainfrom
fix/object-binding-default-padding

Conversation

@camc314

@camc314 camc314 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

microsoft/TypeScript#64043 made padObjectLiteralType add every binding element missing from a default object literal, with an implicit-any type. That made a contextually typed destructuring default report TS7031. Upstream reverted it in microsoft/TypeScript#65556, which landed after our pin (3e9236361fa9).

type Props = { header?: (opts?: { actions?: string }) => string };
declare function render(props: Props): void;

render({ header: ({ actions } = {}) => actions ?? "" });

Before: error TS7031: Binding element 'actions' implicitly has an 'any' type.
After: no errors, matching TypeScript after #65556.

Without a contextual type, function f({ a, b = 1 } = {}) again reports TS2339 for a instead of TS7031.

Details

  • Ports the upstream checker change: only initialized binding elements are padded, without reporting errors.
  • tools/typescript-backports/<pin>/65556.patch carries the upstream checker and fixture changes. CI and release workflows apply it after checking out ts-ref, so conformance and source-built oracles use the fixed reference. Patches for another pin are ignored; this one should be deleted once the pin includes #65556.
  • The published-beta determinism snapshots drop the same false TS7031 diagnostics in next-packages-next and supabase-studio.

Fixes #1019

Port microsoft/TypeScript#65556, which reverts padObjectLiteralType to add
only initialized binding elements to a default object literal's type. Apply
the upstream checker and fixture changes to the pinned reference checkout
until the TypeScript pin includes them.

Upstream-Commit: e1ae04d264bf5256cc4818a7d2aae123693e8f7f
Copilot AI balanced review requested due to automatic review settings November 22, 2026 23:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T23:38:22.171714Z 415c05f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codspeed

codspeed Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 8 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing fix/object-binding-default-padding (415c05f) with main (e1182c4)2

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (e083fd7) during the generation of this report, so e1182c4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@github-actions

Copy link
Copy Markdown
Contributor

Performance change vs main

Workflow run · main e083fd730d54 → PR merge 073f0fc8788f (head 415c05f8a89f)

Clef gate: Running benchmarks because the decision was unavailable (tools/typescript-backports/3e9236361fa97a9e6c685f4833ac457ae2d8c50a/65556.patch: patch exceeds the Clef context limit (65380 bytes)).

Release builds in fast mode (TSRS_FAST=1) with Hyperfine 2 hardware counters. After warming each binary, alternating main/PR pairs measure wall time at both the fast preset's default checker count and with --singleThreaded, with ten pairs per configuration by default. Instructions come from the single-threaded runs; peak RSS comes from the default-count runs.
Incremental runs start with fresh build info before every invocation; check runs disable incremental compilation.

Project Mode Single-thread wall time Δ Single-thread instructions Δ Default wall time Δ Default peak RSS Δ
vscode check 0.0% +0.002% +0.1% +0.3%
vscode incremental -0.1% +0.002% -0.8% 0.0%
xstate-main check +0.6% +0.001% +1.1% +0.2%
xstate-main incremental -0.1% -0.001% -0.5% 0.0%
webpack check -0.8% +0.001% +0.5% -0.2%
webpack incremental +0.7% +0.011% -1.8% -0.1%
mui-docs check 0.0% -0.001% +1.1% +0.4%
mui-docs incremental -0.2% +0.003% +1.3% -0.1%
Compiler check +1.0% +0.001% +3.0% 0.0%
Compiler incremental 0.0% +0.002% +1.1% +0.4%
Compiler-Unions check +1.0% +0.001% +1.7% -0.2%
Compiler-Unions incremental -0.9% +0.001% -1.8% -0.6%
cal-diy check -0.1% +0.006% -0.6% -0.4%
cal-diy incremental 0.0% +0.002% -0.9% +0.2%
formbricks-web check -0.4% 0.000% -0.1% -0.1%
formbricks-web incremental -0.2% +0.002% +1.7% -0.1%
supabase-studio check +0.1% +0.003% +1.9% -0.1%
supabase-studio incremental 0.0% +0.004% +0.3% 0.0%
t3code-server check +0.1% +0.005% +2.4% +0.9%
t3code-server incremental +0.6% -0.003% -0.4% -0.2%
mikro-orm check -0.2% 0.000% +1.0% +0.3%
mikro-orm incremental +0.1% -0.001% +0.9% -0.3%
next-packages-next check +0.6% +0.002% +1.5% 0.0%
next-packages-next incremental -0.1% -0.001% -1.9% -0.1%
next-root check -0.6% +0.006% +0.2% -0.7%
next-root incremental 0.0% +0.004% +0.6% -0.3%
storybook check 0.0% +0.002% -0.4% 0.0%
storybook incremental +0.1% -0.001% -2.1% -0.1%
nuxt check -0.5% +0.004% +0.8% -0.3%
nuxt incremental 0.0% +0.001% +0.4% -0.2%
playwright check -0.7% 0.000% +0.3% +0.4%
playwright incremental -0.1% +0.001% -1.9% +0.1%
drizzle-orm check +0.9% -0.002% -8.0% -1.7%
drizzle-orm incremental -0.9% +0.006% -2.2% -0.1%
typeorm check +0.7% 0.000% +0.4% +0.1%
typeorm incremental 0.0% -0.003% +1.9% 0.0%
date-fns check -0.9% -0.013% +3.4% -0.4%
date-fns incremental -0.5% -0.003% -2.3% -0.7%

Negative means the PR used less; positive means it used more. Deltas are medians of paired PR/main ratios for wall time and instructions. Single-threaded runs reduce scheduling noise; shared CI machines can still add noise to wall time.
Diagnostics or exit status differed on: supabase-studio (check), supabase-studio (incremental), next-packages-next (check), next-packages-next (incremental).

Measured medians (main → PR)
Project Mode Single-thread wall time (s) Single-thread instructions Default wall time (s) Default peak RSS (MiB)
vscode check 8.646 → 8.643 82,259,136,539.5 → 82,260,590,061 1.498 → 1.493 1839.0 → 1843.7
vscode incremental 8.712 → 8.713 84,676,091,717 → 84,677,849,000 1.706 → 1.696 2159.7 → 2159.7
xstate-main check 0.547 → 0.545 5,566,570,692 → 5,566,729,654.5 0.129 → 0.133 240.8 → 241.4
xstate-main incremental 0.538 → 0.536 5,728,366,862.5 → 5,728,283,494 0.161 → 0.162 243.4 → 243.4
webpack check 0.917 → 0.909 10,884,857,304.5 → 10,885,186,138 0.198 → 0.197 404.0 → 403.4
webpack incremental 0.941 → 0.946 11,108,175,923.5 → 11,109,292,211 0.242 → 0.236 402.3 → 402.1
mui-docs check 2.425 → 2.426 33,106,234,463.5 → 33,104,926,764 0.979 → 0.987 1226.6 → 1231.5
mui-docs incremental 2.581 → 2.578 34,458,119,248.5 → 34,459,636,327.5 1.142 → 1.143 1161.6 → 1160.1
Compiler check 0.148 → 0.150 1,775,535,219 → 1,775,560,281 0.068 → 0.067 77.0 → 77.0
Compiler incremental 0.142 → 0.142 1,789,925,219 → 1,789,955,814 0.065 → 0.066 78.8 → 79.1
Compiler-Unions check 0.198 → 0.199 3,053,235,745.5 → 3,053,262,015.5 0.093 → 0.095 80.5 → 80.4
Compiler-Unions incremental 0.203 → 0.201 3,064,794,862.5 → 3,064,794,631.5 0.096 → 0.095 84.5 → 84.0
cal-diy check 2.596 → 2.593 28,973,026,686 → 28,975,677,707.5 0.837 → 0.834 1355.2 → 1350.1
cal-diy incremental 2.775 → 2.770 30,593,636,491.5 → 30,593,226,313 1.054 → 1.040 1265.5 → 1267.5
formbricks-web check 3.363 → 3.350 37,085,637,984 → 37,085,600,424 0.880 → 0.875 1581.5 → 1580.4
formbricks-web incremental 3.571 → 3.563 39,690,757,296.5 → 39,691,389,932 1.232 → 1.268 1623.4 → 1622.4
supabase-studio check 4.464 → 4.693 40,822,075,005 → 40,821,881,334.5 0.983 → 1.003 1307.8 → 1307.1
supabase-studio incremental 3.957 → 3.953 43,769,021,970 → 43,771,159,534 1.081 → 1.085 1363.0 → 1363.5
t3code-server check 3.823 → 3.834 41,057,001,794 → 41,060,195,280.5 1.730 → 1.738 1439.9 → 1452.2
t3code-server incremental 3.913 → 3.936 41,584,771,072 → 41,582,684,974.5 1.453 → 1.424 1306.5 → 1304.4
mikro-orm check 3.991 → 3.980 44,484,781,748 → 44,486,300,236.5 0.837 → 0.850 1277.8 → 1281.0
mikro-orm incremental 4.051 → 4.050 44,796,713,470 → 44,796,053,069.5 1.091 → 1.099 1259.2 → 1255.1
next-packages-next check 1.453 → 1.458 17,404,725,115.5 → 17,405,024,476 0.365 → 0.367 558.7 → 558.5
next-packages-next incremental 1.505 → 1.504 17,731,151,862.5 → 17,731,177,674 0.439 → 0.435 562.9 → 562.5
next-root check 1.153 → 1.147 13,963,147,726.5 → 13,963,957,201.5 0.254 → 0.255 431.9 → 429.1
next-root incremental 1.220 → 1.220 14,425,621,424.5 → 14,426,151,302.5 0.316 → 0.317 473.3 → 471.9
storybook check 0.768 → 0.769 8,867,474,504 → 8,867,606,864.5 0.199 → 0.198 396.3 → 396.3
storybook incremental 0.788 → 0.791 9,193,497,984 → 9,192,854,838.5 0.238 → 0.235 374.1 → 373.7
nuxt check 0.807 → 0.803 8,501,535,471.5 → 8,501,707,976 0.209 → 0.212 391.0 → 389.9
nuxt incremental 0.863 → 0.862 8,904,603,171.5 → 8,904,488,515 0.230 → 0.229 392.2 → 391.4
playwright check 0.670 → 0.667 7,403,047,784 → 7,403,184,499.5 0.174 → 0.175 361.9 → 363.2
playwright incremental 0.688 → 0.690 7,576,518,827.5 → 7,576,563,604 0.196 → 0.190 339.7 → 340.0
drizzle-orm check 0.502 → 0.504 5,948,577,740 → 5,948,487,508 0.177 → 0.166 383.5 → 376.8
drizzle-orm incremental 0.537 → 0.535 6,120,064,963 → 6,120,395,991.5 0.180 → 0.177 343.7 → 343.4
typeorm check 0.577 → 0.580 6,392,891,629 → 6,392,891,960 0.133 → 0.135 226.0 → 226.1
typeorm incremental 0.633 → 0.638 6,770,878,365 → 6,770,700,688.5 0.252 → 0.274 233.1 → 233.1
date-fns check 0.280 → 0.275 3,349,005,007 → 3,348,724,042.5 0.084 → 0.088 153.5 → 152.8
date-fns incremental 0.311 → 0.308 3,586,482,239.5 → 3,586,429,018 0.148 → 0.144 162.9 → 161.7

tsrs-lint

Release tsrs-lint linting each project's source files with all 61 rules. After a warmup run of each binary, alternating main/PR pairs (10 per mode) measure wall time, CPU time and peak RSS with TSRS_FAST unset and with TSRS_FAST=1.

Project Mode Wall time Δ CPU time Δ Peak RSS Δ Diagnostics (main → PR)
webpack default -0.1% -0.3% +0.2% 37258, identical
webpack TSRS_FAST=1 +2.9% +0.9% -0.4% 37258, identical
drizzle-orm default -1.0% +0.3% +0.2% 7057, identical
drizzle-orm TSRS_FAST=1 -0.4% -0.5% 0.0% 7057, identical
xstate-main default 0.0% +0.8% +0.3% 6489, identical
xstate-main TSRS_FAST=1 +0.7% +1.3% -0.3% 6489, identical

Negative means the PR used less. Wall and CPU time deltas are medians of paired PR/main ratios; peak RSS compares medians.

Measured lint medians (main → PR)
Project Mode Wall time (s) CPU time (s) Peak RSS (MiB)
webpack default 0.373 → 0.373 1.907 → 1.881 466.6 → 467.5
webpack TSRS_FAST=1 0.367 → 0.379 1.889 → 1.926 468.2 → 466.1
drizzle-orm default 0.219 → 0.216 1.170 → 1.160 402.7 → 403.4
drizzle-orm TSRS_FAST=1 0.217 → 0.215 1.160 → 1.165 403.3 → 403.2
xstate-main default 0.315 → 0.316 1.378 → 1.383 341.1 → 342.2
xstate-main TSRS_FAST=1 0.313 → 0.314 1.373 → 1.383 345.1 → 344.1

@camc314
camc314 marked this pull request as draft November 23, 2026 09:12
@camc314

camc314 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

This is the wrong approach.

@camc314 camc314 closed this Nov 23, 2026
@camc314
camc314 deleted the fix/object-binding-default-padding branch November 23, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

TS7031 false positive: destructured parameter with default in a contextually typed arrow

2 participants