Skip to content

fix(declarations): stop a stripInternal panic on a JSDoc @callback without @returns - #1093

Merged
camc314 merged 3 commits into
mainfrom
fix/strip-internal-callback-any-return
Nov 25, 2026
Merged

camc314 merged 3 commits into
mainfrom
fix/strip-internal-callback-any-return

Conversation

@camc314

@camc314 camc314 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

With stripInternal and declarations on, a JavaScript JSDoc @callback without @returns made tsrs panic.

/** @callback F */

tsgo writes type F = () => any; and exits 0. tsrs panicked with parsed nodes have source positions and exited 5, both when emitting declarations and under noEmit, where the same transform computes declaration diagnostics.

The reparser gives such a callback an any return type with no source position, as Go's does. To decide whether that node is @internal, Go passes its position (-1) to GetLeadingCommentRanges, which yields no comments. tsrs required a source position first. get_leading_comment_ranges_of_node now returns no comments for a synthesized position, as the printer already does.

The parameter branch of is_internal_declaration keeps its position checks: every parameter it sees, including reparsed JSDoc parameters, has a source position.

The CLI test pins tsgo's .d.ts output; the regression fixture covers the noEmit path.

Copilot AI balanced review requested due to automatic review settings November 25, 2026 15:42

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 25, 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-25T15:43:11.871262Z ba88a56 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 25, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

Warning

oxc-project has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 8, 2026 to keep using CodSpeed.

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/strip-internal-callback-any-return (ba88a56) with main (47d7e41)

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. ↩

@camc314 camc314 changed the title fix(declarations): stop a stripInternal panic on a JSDoc @callback without @returns fix(declarations): stop a stripInternal panic on a JSDoc @callback without @returns Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Performance change vs main

Workflow run Β· main 47d7e414529e β†’ PR merge d52af2a34823 (head ba88a565adc3)

Clef gate: Clef estimated 42.1% default and single-threaded wall time, 43.1% peak RSS, 63.4% single-threaded instruction count impact probability.

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 -3.1% 0.000% -5.6% -0.1%
vscode incremental +0.1% -0.001% +2.3% 0.0%
xstate-main check -0.2% 0.000% -3.8% +0.4%
xstate-main incremental -1.5% -0.001% -1.3% -0.1%
webpack check -0.1% -0.001% -0.9% 0.0%
webpack incremental -1.7% +0.002% +2.2% -0.2%
mui-docs check -2.0% +0.010% +2.5% +1.8%
mui-docs incremental -0.6% +0.005% -1.4% 0.0%
Compiler check +1.3% 0.000% -0.7% 0.0%
Compiler incremental +0.4% 0.000% +0.4% -2.0%
Compiler-Unions check -1.3% 0.000% +4.8% -0.6%
Compiler-Unions incremental -1.4% 0.000% +1.0% 0.0%
cal-diy check +0.8% -0.003% +1.9% +0.2%
cal-diy incremental -0.2% +0.005% +1.7% +0.1%
formbricks-web check +0.6% +0.001% +2.7% -0.1%
formbricks-web incremental +0.1% +0.002% -0.5% 0.0%
supabase-studio check -0.2% -0.004% -1.1% +0.3%
supabase-studio incremental +0.3% -0.001% +2.1% -0.1%
t3code-server check -0.9% +0.004% +1.5% -0.2%
t3code-server incremental +0.6% +0.004% +0.2% +0.2%
mikro-orm check -0.4% -0.002% -2.6% +0.1%
mikro-orm incremental -1.6% +0.002% -0.2% +0.3%
next-packages-next check +0.4% 0.000% -1.8% +0.2%
next-packages-next incremental -0.1% -0.001% +0.5% +0.2%
next-root check -1.0% +0.001% -0.8% +0.5%
next-root incremental +2.3% +0.001% -2.3% +0.2%
storybook check +0.9% 0.000% -8.9% +0.3%
storybook incremental +0.5% -0.008% +1.2% +0.5%
nuxt check -1.3% +0.002% -2.4% 0.0%
nuxt incremental +0.4% +0.007% +1.9% +0.2%
playwright check +0.9% -0.001% +0.9% -0.6%
playwright incremental -3.1% -0.004% -2.0% +0.2%
drizzle-orm check -1.8% -0.004% +0.1% +0.8%
drizzle-orm incremental +0.5% -0.003% -1.6% -0.3%
typeorm check -3.3% -0.001% -6.1% -0.1%
typeorm incremental +1.6% +0.001% +2.8% -0.3%
date-fns check +1.2% +0.021% -0.6% -0.2%
date-fns incremental +0.8% +0.018% -0.3% +0.1%

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.

Measured medians (main β†’ PR)
Project Mode Single-thread wall time (s) Single-thread instructions Default wall time (s) Default peak RSS (MiB)
vscode check 11.070 β†’ 10.249 82,266,395,623 β†’ 82,266,892,375 1.758 β†’ 1.725 1836.3 β†’ 1835.1
vscode incremental 9.948 β†’ 9.936 84,683,647,019 β†’ 84,683,323,050 1.802 β†’ 1.839 2161.6 β†’ 2160.8
xstate-main check 0.613 β†’ 0.620 5,566,873,571 β†’ 5,566,843,019.5 0.146 β†’ 0.141 242.2 β†’ 243.1
xstate-main incremental 0.540 β†’ 0.532 5,728,552,609.5 β†’ 5,728,483,520 0.159 β†’ 0.157 243.3 β†’ 243.1
webpack check 0.926 β†’ 0.926 10,885,593,573.5 β†’ 10,885,481,366 0.195 β†’ 0.198 405.0 β†’ 405.1
webpack incremental 1.424 β†’ 1.408 11,109,258,766 β†’ 11,109,212,306 0.360 β†’ 0.369 403.3 β†’ 402.4
mui-docs check 2.680 β†’ 2.633 33,105,702,401.5 β†’ 33,110,229,395 0.991 β†’ 1.024 1228.1 β†’ 1250.2
mui-docs incremental 2.697 β†’ 2.681 34,457,845,357 β†’ 34,460,589,680 1.142 β†’ 1.146 1162.9 β†’ 1162.6
Compiler check 0.153 β†’ 0.156 1,775,537,614.5 β†’ 1,775,538,951 0.072 β†’ 0.072 78.1 β†’ 78.0
Compiler incremental 0.146 β†’ 0.146 1,789,928,408.5 β†’ 1,789,918,853.5 0.068 β†’ 0.067 81.3 β†’ 79.7
Compiler-Unions check 0.215 β†’ 0.214 3,053,233,114 β†’ 3,053,271,735.5 0.097 β†’ 0.101 81.5 β†’ 81.0
Compiler-Unions incremental 0.260 β†’ 0.260 3,064,793,226.5 β†’ 3,064,791,401 0.121 β†’ 0.122 85.1 β†’ 85.1
cal-diy check 2.681 β†’ 2.814 28,975,329,666 β†’ 28,975,137,959 0.918 β†’ 0.949 1359.0 β†’ 1362.0
cal-diy incremental 3.612 β†’ 3.426 30,593,731,729.5 β†’ 30,595,230,433 1.410 β†’ 1.434 1265.6 β†’ 1266.2
formbricks-web check 3.965 β†’ 3.986 37,088,073,233 β†’ 37,088,657,779.5 1.019 β†’ 1.007 1580.3 β†’ 1578.1
formbricks-web incremental 3.906 β†’ 3.891 39,693,938,414.5 β†’ 39,694,356,991 1.186 β†’ 1.180 1623.3 β†’ 1624.1
supabase-studio check 4.648 β†’ 4.755 40,825,684,369 β†’ 40,826,100,524.5 0.960 β†’ 0.952 1307.5 β†’ 1311.1
supabase-studio incremental 5.099 β†’ 5.014 43,771,870,762.5 β†’ 43,772,309,163 1.793 β†’ 1.903 1366.6 β†’ 1365.8
t3code-server check 3.871 β†’ 3.802 41,058,532,254.5 β†’ 41,059,438,797.5 1.740 β†’ 1.770 1448.3 β†’ 1445.8
t3code-server incremental 3.876 β†’ 3.946 41,583,762,614.5 β†’ 41,585,424,381.5 1.456 β†’ 1.486 1304.4 β†’ 1306.6
mikro-orm check 4.810 β†’ 4.489 44,486,747,744.5 β†’ 44,485,974,647 0.955 β†’ 0.934 1282.5 β†’ 1284.1
mikro-orm incremental 4.980 β†’ 4.939 44,796,270,906 β†’ 44,797,393,023.5 1.182 β†’ 1.180 1259.5 β†’ 1263.0
next-packages-next check 1.815 β†’ 1.836 17,406,369,920 β†’ 17,406,211,443.5 0.405 β†’ 0.399 559.9 β†’ 560.9
next-packages-next incremental 1.490 β†’ 1.485 17,732,895,749 β†’ 17,732,943,333 0.434 β†’ 0.435 564.9 β†’ 565.9
next-root check 1.237 β†’ 1.227 13,996,167,273.5 β†’ 13,996,321,922 0.278 β†’ 0.275 431.6 β†’ 433.9
next-root incremental 1.463 β†’ 1.480 14,458,704,723 β†’ 14,458,619,528 0.421 β†’ 0.415 473.5 β†’ 474.5
storybook check 1.099 β†’ 1.095 8,867,469,179 β†’ 8,867,565,798 0.237 β†’ 0.216 395.8 β†’ 396.9
storybook incremental 0.971 β†’ 1.002 9,193,370,868 β†’ 9,193,176,904.5 0.282 β†’ 0.291 374.7 β†’ 376.4
nuxt check 0.953 β†’ 0.922 8,501,928,087 β†’ 8,502,054,757 0.224 β†’ 0.219 390.3 β†’ 390.3
nuxt incremental 0.953 β†’ 0.961 8,904,867,602 β†’ 8,905,156,565 0.238 β†’ 0.241 391.8 β†’ 392.7
playwright check 0.848 β†’ 0.867 7,403,479,526 β†’ 7,403,416,635.5 0.192 β†’ 0.197 366.1 β†’ 364.0
playwright incremental 0.791 β†’ 0.783 7,576,907,734.5 β†’ 7,576,852,333 0.202 β†’ 0.198 339.9 β†’ 340.4
drizzle-orm check 0.614 β†’ 0.607 5,948,757,519 β†’ 5,948,708,085 0.190 β†’ 0.194 378.7 β†’ 381.6
drizzle-orm incremental 0.618 β†’ 0.636 6,120,541,717.5 β†’ 6,120,339,376 0.204 β†’ 0.195 346.0 β†’ 345.1
typeorm check 0.892 β†’ 0.845 6,398,381,302 β†’ 6,398,307,544 0.249 β†’ 0.235 226.8 β†’ 226.5
typeorm incremental 0.887 β†’ 0.905 6,776,350,495.5 β†’ 6,776,250,745 0.279 β†’ 0.289 234.5 β†’ 233.7
date-fns check 0.345 β†’ 0.354 3,351,946,238.5 β†’ 3,352,716,197.5 0.097 β†’ 0.097 152.5 β†’ 152.1
date-fns incremental 0.379 β†’ 0.376 3,589,578,519.5 β†’ 3,590,149,822 0.188 β†’ 0.189 163.4 β†’ 163.5

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.7% -0.1% +0.2% 35405, identical
webpack TSRS_FAST=1 0.0% +0.3% +0.1% 35405, identical
drizzle-orm default -0.9% 0.0% +0.2% 7057, identical
drizzle-orm TSRS_FAST=1 +0.4% +0.6% -0.2% 7057, identical
xstate-main default -0.5% +0.1% -0.8% 6489, identical
xstate-main TSRS_FAST=1 -0.6% 0.0% +0.5% 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.353 β†’ 0.353 1.811 β†’ 1.812 463.7 β†’ 464.7
webpack TSRS_FAST=1 0.348 β†’ 0.350 1.807 β†’ 1.821 463.0 β†’ 463.4
drizzle-orm default 0.212 β†’ 0.213 1.144 β†’ 1.135 403.5 β†’ 404.2
drizzle-orm TSRS_FAST=1 0.213 β†’ 0.215 1.138 β†’ 1.139 404.1 β†’ 403.4
xstate-main default 0.317 β†’ 0.315 1.385 β†’ 1.393 344.2 β†’ 341.4
xstate-main TSRS_FAST=1 0.326 β†’ 0.319 1.439 β†’ 1.407 341.5 β†’ 343.3

Merged via the queue into main with commit 3ae2222 Nov 25, 2026
71 checks passed
@camc314
camc314 deleted the fix/strip-internal-callback-any-return branch November 25, 2026 17:26
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.

2 participants