Repository navigation
Conversation
|
Updated 1:11 PM PT - Oct 18th, 2026
✅ @robobun, your commit 4114d1b13fb43f8357366de5c049d1545039b61b passed in 🧪 To try this PR locally: bunx bun-pr 45934That installs a local version of the PR into your bun-45934 --bun |
|
Status: draft. It waits for a maintainer's answer on the CI step (the question is in a comment below). This branch conflicts with main in five files, and the rebase is ready on Reproduction
PR: #45934 |
|
@Jarred-Sumner, one decision for you, because Should
This branch conflicts with main in five files now. The rebased tree is ready on |
Behaviour change: none
Problem
cd test && bun checkreportsFound 364 errors in 101 files, checked 2,865 files. Fix every type error intest/#44614 left 5 (test: fix five type errors that landed beside #44614 #44861), and no CI step type checkstest/.import "bun"inbun-plugin-svelteloads a second copy of bun-types fromtest/node_modules. The other 339 are on lines that later PRs changed.Fix
test/tsconfig.jsonmaps"bun"topackages/bun-types/index.d.tsinpaths, so the copy is never loaded.// @ts-expect-error.bun build --no-bundleprints the same bytes for each file as on main.bun checkandtsc7.0.2 report no errors. 101 of 102 touched test files give the same results on both trees.Background
declare module "bun"gets two signatures, and withnoImplicitAnyoff its callbacks getanyparameters."bun"is a builtin: the runtime and the bundler resolve it before they readpaths.// @ts-expect-errorand casting 13 calls: callbacks stay untyped.Downsides
test/#44614 left a type error. A maintainer decides: alint.ymlstep that runsbun checkintest/, or a one-time sweep. The rebase waits onrobobun/a9200230/test-type-errors-rebasedfor the answer.new Bun.Archive(files).bytes("gzip")calls stay.bytes()takes no argument, so those tests serve an uncompressed tarball.Notes
State on 2026-10-19, and what waits for the rebase
Found 369 errors in 101 files, checked 2,866 files. With only thepathsentry it reports 348 in 96 files.bun-lockb.test.ts,bun-pack.test.ts,bun-workspaces.test.ts,hoist.test.tsandrun-autoinstall.test.ts.robobun/a9200230/test-type-errors-rebased(d4969ce) is this PR on 91e7e3b, with the six conflict regions redone on main's text and the five errors that install: fix regressions since 1.4.3 and resolve peer dependencies more like pnpm #45898 andbun check: 1.4x to 7.8x faster on large projects. Fixes forbun check,bun lintandbun fmt#45800 added fixed. There,bun checkprintsNo type errors in 2,866 files,tsc7.0.2 agrees, the 96 files transpile to the same JavaScript as on main, and the formatter changes nothing.Bun.sha(file as any)replaces the directive inbun-cryptohasher.test.ts: the declaration is the gap there, not the test, so six// @ts-expect-errorare left, all onbytes("gzip"). The secondisDirectoryTreeinharness.tstakes aBufferagain, because that hunk fixed no error. A comment marks the seventhbytes("gzip")call, which is inside a-estring atbun-pm-diff.test.ts:1662and so has no type error.The CI step, if a maintainer wants it
lint-jsjob of.github/workflows/lint.yml:bun install --frozen-lockfile --cwd test, thencd test && bun check..github/workflows/bun-types.ymlalready installstest/in a GitHub job.git blameof the 325 lines that have an error on main today says that 24 of the 127 commits since Fix every type error intest/#44614 last changed one of them. Each of those PRs would have had to fix its own errors before it merged.bun x tsc, as the other steps oflint.ymldo). It reports 2 more errors, the TS2786 injsx-dev.tsxandjsx-production.tsxthat Fix every type error intest/#44614 describes.cd test && bun check, equal totsc7.0.2, is the check this PR brings to zero.test/#44614 says,bun checkat the repository root still stops atbaseUrlin the three tsconfig files belowsrc/.pathsentry. Alone it takes main from 369 to 348 errors, and four of the 348 are the ones the copy hid.Type checks, in
test/, afterbun install --frozen-lockfilein the root and intest/pathsentrybun check, release build of 5900354Found 364 errors in 101 filesNo type errors in 2,865 filesbun check, canary1.4.4-canary.1+ed680823cFound 343 errors in 96 filesNo type errors in 2,865 filestsc7.0.2 (typescript7oftest/package.json)tsc6.0.2 (the root'stypescript)jsx-dev.tsxandjsx-production.tsxthat #44614 describesThe second copy of bun-types
test/package.jsondepends onbun-plugin-svelteasfile:../packages/bun-plugin-svelte. That package has the devDependency"@types/bun": "../bun-types".test/bun.lock. Since then the lockfile has"bun-plugin-svelte/@types/bun": ["@types/bun@file:../packages/bun-types", {}], andbun installputs a copy ofpackages/bun-typesintest/node_modules/.bun/@types+bun@file+..+packages+bun-types/. Before, the entry wasbun-types@1.2.4-canary, whichimport "bun"does not find.test/integration/svelte/*.tsimportbun-plugin-svelte. Itssrc/index.tsimports"bun", and TypeScript resolves that to the copy next to it.tsc --listFilesOnlyon main lists 29 files ofpackages/bun-typesand 28 files of the copy. On this branch it lists 29 and 0.pathsentry alone, main goes from 364 to 343 errors: 25 go away, 4 appear.// @ts-expect-errorinwebsocket-server.test.ts(they are needed again now), 7TS2349ins3.test.ts, and 6TS2769inpipeTo-signal-leak.test.ts,fetch-abort-buffered-body-fixture.ts,module-graph-isolation.test.tsandregression/issue/26377.test.ts.websocket-server.test.ts(lines 2741, 3558, 3747 and 3748 on main):ws.dataof a server whose data type was not declared.pathsentry does not change what runs. A probe file belowtest/that imports, requires and resolves"bun"prints the same result with and without the entry, andbun buildof it gives the same output for--target=bun,browserandnode.integration/sveltefrom the project. The next package that imports"bun"and has its own@types/bunbrings a copy back.Where the other errors come from
git blameof the 320 lines with an error (one copy): 316 were last changed after #44614. #44968 has 113 of them, #45307 41, #45304 40, #44805 37, #45223 34, #45043 12, #45146 10. The other 4 lines are the ones that #44861 covers. This PR has the same edits for them, so #44861 is not needed after it.Test runs
Release build of 5900354, the environment of
scripts/runner.node.ts,--timeout 30000. Main is a second worktree with the samenode_modules. The 102 files are the 88 changed test files and the 14 that run a changed fixture or helper.js/sqltests that need a database this machine does not have.bake.test.ts,check.test.ts,bun-install-git-deps.test.ts,bun-install-lifecycle-scripts.test.ts,bun-pack.test.tsandjs-plugins.test.tspass in full on both trees.format.test.tsfails one or two tests in each of three runs on each tree, a different one each time:takes time in proportion to the size of the textand others that measure time.bun-pack.test.tsfailed 4 to 9 tests on main while that worktree was below/tmp. With the worktree beside the repository it passes.Same JavaScript
For each of the 96 changed
.tsfiles:bun build --no-bundle --target=bun <file>in a worktree of main and on this branch, the file in its place so thattest/tsconfig.jsonapplies. The output is byte for byte the same for all 96, with the release build of 5900354 and with the canary.No hunk is unnecessary
For each hunk: revert it alone, run
bun check, keep the revert if there is still no error. One hunk was dropped that way. Every other hunk brings an error back. On this branchharness.tswas left out of that loop. On the rebased branch it is in the loop, and the one hunk there that fixed no error is gone.The two checks, as scripts
same-js.sh and minimize.py
The
bytes("gzip")callsbun-pm-diff.test.ts(3),npmrc.test.ts(1) andrun-autoinstall.test.ts(2) callnew Bun.Archive(files).bytes("gzip")and serve the result as a.tgz. A seventh call is inside a-estring inbun-pm-diff.test.ts, where the checker does not see it.Archive#bytes()takes no argument (Archive.classes.tshaslength: 0). With the release build of main,.bytes("gzip")returns the same 10,240 bytes as.bytes(), a plain tar.new Bun.Archive(files, { compress: "gzip" }).bytes()returns 146 bytes that start with1f 8b. The tests pass becausebun installalso reads a plain tar. The fix would be the constructor option. It changes what the tests serve, so it is not in a PR of type-only edits.The other
// @ts-expect-errorbun-cryptohasher.test.ts:Bun.sha(file)with a file blob.Bun.sha()is declared to takeBun.StringOrBuffer, and the four calls above it take the same blob without an error. So the gap is in the declaration, and the rebased branch has a cast there.internal/bindgen.test.ts: one directive was unused on main and is deleted.Gaps in the declarations that the casts stand for
Response#clone()returns undici'sResponse, andgetReader()returns the reader ofnode:stream/web. Fix every type error intest/#44614 lists both.@types/node:Channel#unsubscribe()is typedvoidand returns a boolean.OutgoingMessage#getRawHeaderNames()andallowHalfOpenfortls.connect()are not declared.inflateRawSync(..., { info: true })is typed as a buffer.$.braces()takes an undeclared second argument. undici 5'sWebSockettype extends the type of theEventTargetconstructor, so it has nodispatchEvent.test.eachtypesdoneas the last argument of every row. A callback with a rest parameter or a default value then getsstring | donefor each argument.