Skip to content

test: fix five type errors that landed beside #44614 - #44861

Open
robobun wants to merge 1 commit into
mainfrom
robobun/354a1811/test-type-errors-after-44614
Open

robobun wants to merge 1 commit into
mainfrom
robobun/354a1811/test-type-errors-after-44614

Conversation

@robobun

@robobun robobun commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Behaviour change: none

Problem

Fix

  • Five edits in four files: two casts, as const, a parameter type, and ! on server.hostname and server.port.
  • The transpiler erases each edit. bun build --no-bundle gives the same bytes for each file as on main.
  • One cast is as any on Bun.write(s3file, response): bun-types has no overload for it. Fix every type error in test/ #44614 lists that gap and casts the same call in fetch-backpressure.test.ts.
  • Verified: bun bd check and tsc 7.0.2 in test/ report no errors in 2,639 files. On a release build of e655c58, the edited tests pass, and so does s3-stream-error-gc.test.ts, which runs the fixture. Notes has every run.

Background

  • Server#hostname and Server#port are undefined for a server on a unix socket. Other Bun.connect calls in bun-server.test.ts use ! for that.
  • TypeScript's libraries have no name for the argument of Intl.DurationFormat#format. Intl.DurationInput does not exist.
  • Considered the Bun.write overload here. It changes declarations that users see, so it needs its own PR with a fixture case (bun-types: declare bytes() on ShellPromise #44725).

Downsides

  • The tree can get type errors again. No CI job type checks test/: .github/workflows/lint.yml checks scripts, src/js, src and src/runtime/bake.
  • Bun.write(s3file, response) stays a type error for users until bun-types has the overload.
Notes

The five errors on main (bun check and tsc 7.0.2 print the same text)

cli/check/check.test.ts(298,33): error TS2345: Argument of type '{ "b.ts": string; "tsconfig.json"?: undefined; } | { "b.ts"?: undefined; "tsconfig.json": string; }' is not assignable to parameter of type 'Record<string, string>'.
cli/check/check.test.ts(464,77): error TS2322: Type '"" | NonSharedBuffer | undefined' is not assignable to type 'ArrayBufferView<ArrayBufferLike> | undefined'.
js/bun/http/bun-server.test.ts(2180,5): error TS2769: No overload matches this call.
js/bun/jsc/webkit-upgrade-dbdca7545d.test.ts(84,73): error TS2694: Namespace 'Intl' has no exported member 'DurationInput'.
js/bun/s3/s3-stream-stored-error-fixture.ts(79,15): error TS2769: No overload matches this call.

Each edit

Line on main From Edit
check.test.ts:298 #44361 [...] as Record<string, string>[]. The object literals in the array have different keys, so each member of the element type gets the keys of the others as ?: undefined. proxy-stress-matrix.test.ts:313 has the same cast from #44614.
check.test.ts:464 #44361 as const on the list of file names at line 458. For a string name, name && readFileSync(...) can be "". For the literal names it cannot. A cast at line 464 moves the object literal to three lines, and then the transpiled file differs in line breaks.
bun-server.test.ts:2180 #38003 server.hostname! and server.port!, as in lines 90 and 2122 of that file.
webkit-upgrade-dbdca7545d.test.ts:84 #44615 Parameters<Intl.DurationFormat["format"]>[0]. lib.es2025.intl.d.ts declares format(duration: Partial<Record<DurationFormatUnit, number>>).
s3-stream-stored-error-fixture.ts:79 #38003 client.file("copy") as any, as in fetch-backpressure.test.ts:1723. S3File#write and S3Client#write take a Response. Only Bun.write has no overload for it.

Type checks, in test/

Checker main e655c58 this branch
bun bd check (debug build) Found 5 errors in 4 files, checked 2,639 files No type errors in 2,639 files
bun check, canary 1.4.3-canary.1+e655c5803 the same five No type errors in 2,639 files
tsc 7.0.2 (typescript7 of test/package.json) the same five no errors
tsc 6.0.2 (bun run typecheck) not run 2 errors, the TS2786 in jsx-dev.tsx and jsx-production.tsx that #44614 describes

Same JavaScript

bun build --no-bundle --target=bun <file>, with the file in its place so that test/tsconfig.json applies, on main and on this branch. The output is identical for all four files: 968,848 bytes for check.test.ts, 120,847 for bun-server.test.ts, 4,960 for webkit-upgrade-dbdca7545d.test.ts, 5,396 for s3-stream-stored-error-fixture.ts.

Test runs

Release build of e655c58 (the canary), on this branch:

  • bun-server.test.ts: 81 pass, 1 skip.
  • webkit-upgrade-dbdca7545d.test.ts: 9 pass, 1 todo.
  • s3-stream-error-gc.test.ts, which runs the fixture: 4 pass.
  • check.test.ts -t "what stops the type check says how many files it leaves" and -t "are those of TypeScript 7, byte for byte": both pass.
  • All of check.test.ts, four runs on main and four on this branch, in turns: 8, 24, 7 and 10 tests fail on main, 8, 15, 5 and 14 on this branch. Each failure is the 5000 ms timeout, none is a failed assertion. My machine has 12 cores with a cap.

Debug build (bun bd test), on this branch:

  • webkit-upgrade-dbdca7545d.test.ts: 9 pass, 1 todo. s3-stream-error-gc.test.ts: 4 pass.
  • bun-server.test.ts: the edited test passes. 5 other tests reach the 5000 ms timeout. On main 13 do. They start a debug build of bun in a child process.
  • check.test.ts -t "are those of TypeScript 7, byte for byte" passes.
  • check.test.ts -t "what stops the type check says how many files it leaves" reaches the 5000 ms timeout in 3 of 3 runs, and in 2 of 2 runs on main. It starts bun nine times. With --timeout 120000 it passes in 13.1 s.

no test proof · iteration 0 · platform-specific test(s) that do not run on this machine, deferring to CI, which covers all platforms: test/js/bun/http/bun-server.test.ts, test/cli/check/check.test.ts

`bun check` and `tsc` 7.0.2 report five type errors in four files of
test/. #44361, #44615 and #38003 added those lines after the last push
to #44614 and before its merge, so the tree it left clean is not clean
on main.

The transpiler erases each edit. Each of the four files transpiles to
the same bytes as before.
@github-actions github-actions Bot added the claude label Oct 9, 2026
@robobun

robobun commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Status: ready for review.

Reproduction

  1. On main e655c58, run bun install in the repository root and in test/.
  2. Run cd test && bun check with a build of that commit. ./node_modules/typescript7/bin/tsc --noEmit in test/ gives the same result.
  3. On main it prints five errors and Found 5 errors in 4 files, checked 2,639 files:
    cli/check/check.test.ts(298,33): error TS2345
    cli/check/check.test.ts(464,77): error TS2322
    js/bun/http/bun-server.test.ts(2180,5): error TS2769
    js/bun/jsc/webkit-upgrade-dbdca7545d.test.ts(84,73): error TS2694
    js/bun/s3/s3-stream-stored-error-fixture.ts(79,15): error TS2769
    
  4. On this branch it prints No type errors in 2,639 files.

PR: #44861

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: oven-sh/bun/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 8aed36c0-99d5-4a8f-b5a1-a8e16a348d30

📥 Commits

Reviewing files that changed from the base of the PR and between e655c58 and ac0030f.


📒 Files selected for processing (4)
  • test/cli/check/check.test.ts
  • test/js/bun/http/bun-server.test.ts
  • test/js/bun/jsc/webkit-upgrade-dbdca7545d.test.ts
  • test/js/bun/s3/s3-stream-stored-error-fixture.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.



Walkthrough

Test code updates adjust TypeScript expressions and types in CLI, HTTP, Intl, and S3 tests. The test cases and expected results remain unchanged.

Changes

Test Type Adjustments

Layer / File(s) Summary
Test typing and expressions
test/cli/check/check.test.ts, test/js/bun/http/bun-server.test.ts, test/js/bun/jsc/webkit-upgrade-dbdca7545d.test.ts, test/js/bun/s3/s3-stream-stored-error-fixture.ts
CLI tests parenthesize a mapped array and assert a dictionary-name array as const. The HTTP test adds non-null assertions. The Intl helper derives its parameter type from format, and the S3 test casts the file argument to any.

Suggested reviewers: jarred-sumner

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to ac003

The changes are limited to test typing and preserve test behavior; no production-impacting merge risk is evident.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description clearly explains the five type errors, the four-file fix, verification results, test coverage, and known limitations. It does not use the exact template headings, but it provides the r…
Title check Passed The title clearly and concisely identifies the test-only change and its purpose: fixing five type errors related to #44614.


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code review found no issues

No high-confidence issues detected in this change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant