Bun v1.4.3

To install Bun

curl

curl -fsSL https://bun.sh/install | bash

npm

npm install -g bun

powershell

powershell -c "irm bun.sh/install.ps1|iex"

scoop

scoop install bun

brew

brew tap oven-sh/bun
brew install bun

docker

docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun

To upgrade Bun

bun upgrade

bun check: a TypeScript type checker built into Bun#

图片

bun check is an incredibly fast TypeScript type checker that passes 100% of TypeScript 7.0.2's conformance test suite.

bun check
1 | import { greet } from "./user";
2 |
3 | const message = greet({ id: "1", name: "Ada" });
^
error: TS2322: Type 'string' is not assignable to type 'number'.
at src/index.ts:3:25

Found 1 error in 1 file, checked 2 files [14.00ms]

It's 3x to 6.4x faster than tsc 7.0.2, on a 16-core Apple silicon Mac:

Project

Files

bun check

tsc 7.0.2

Faster

VS Code src

9,795

1.24 s

5.98 s

4.8x

mikro-orm

2,883

1.20 s

5.97 s

5.0x

Next.js packages/next

2,881

0.28 s

1.82 s

6.4x

Next.js, root

3,547

0.42 s

1.28 s

3.1x

Storybook scripts

1,039

0.27 s

0.96 s

3.5x

Nuxt

839

0.27 s

0.80 s

3.0x

Playwright

706

0.15 s

0.64 s

4.2x

lit packages/react

6

0.46 s

2.12 s

4.6x

And it uses 2.2x to 4.9x less memory:

Project

Files

bun check

tsc 7.0.2

Less

VS Code src

9,795

2.14 GB

7.97 GB

3.7x

mikro-orm

2,883

1.35 GB

6.67 GB

4.9x

Next.js packages/next

2,881

0.71 GB

1.81 GB

2.5x

Next.js, root

3,547

0.55 GB

1.33 GB

2.4x

Storybook scripts

1,039

0.56 GB

1.39 GB

2.5x

Nuxt

839

0.51 GB

1.14 GB

2.2x

Playwright

706

0.46 GB

1.06 GB

2.3x

lit packages/react

6

0.24 GB

0.63 GB

2.6x

It's a port of typescript-go. It reads your tsconfig.json, reports the same errors as tsc, and uses every CPU core. You don't need the typescript package installed.

It only type checks. It doesn't emit JavaScript or .d.ts files, and there's no language server, so your editor keeps using TypeScript.

bun run --check#

Type check, then run. If there's a type error, your code doesn't run.

bun run --check src/index.ts
1 | import { greet } from "./user";
2 |
3 | console.log(greet({ id: "1", name: "Ada" }));
^
error: TS2322: Type 'string' is not assignable to type 'number'.
at src/index.ts:3:21

2 |   id: number;
^
note: The expected type comes from property 'id' which is declared here on type 'User'
at src/user.ts:2:3

Found 1 error in 1 file, checked 2 files [24.00ms]

It also works with package.json scripts (bun run --check dev) and with --watch, which checks again before every restart.

bun test --check#

Type check the test files and everything they import, then run the tests. If there's a type error, no tests run.

bun test --check
bun test v1.4.3
4 | test("greet", () => {
5 |   expect(greet({ id: "1", name: "Ada" })).toBe("hello Ada");
^
error: TS2322: Type 'string' is not assignable to type 'number'.
at src/user.test.ts:5:18

2 |   id: number;
^
note: The expected type comes from property 'id' which is declared here on type 'User'
at src/user.ts:2:3

Found 1 error in 1 file, checked 2 files [23.94ms]

bun build --check#

Type check, then bundle. A type error fails the build like any other build error, and nothing is written.

bun build --check ./src/index.ts --outdir out
3 | console.log(greet({ id: "1", name: "Ada" }));
^
error: TS2322: Type 'string' is not assignable to type 'number'.
at /app/src/index.ts:3:21

2 |   id: number;
^
note: TS6500: The expected type comes from property 'id' which is declared here on type 'User'
at /app/src/user.ts:2:3

Bun.build takes check: true.

Testing bun check#

Every commit of Bun runs TypeScript 7.0.2's complete conformance test suite (and we will continue to keep it up-to-date as TypeScript itself updates).

Baseline

What it checks

Tests

Passing

Errors

Every error

13,101

13,101

Types

The type of every expression

12,463

12,463

Symbols

The symbol behind every name

12,463

12,463

Declarations

Emitted .d.ts files

13,032

13,032

Module resolution

How every import resolves

151

151

Total

51,210

51,210

72 misconfigured open-source projects

For a project as complex as a TypeScript type checker, conformance tests aren't enough, so we deliberately misconfigured 72 popular open-source repositories and compared bun check's output with tsc's output.

Missing node_modules, mismatched TypeScript versions, no build step. Every error has to match: same file, line, column and error code.

Project

Configs

Identical

Errors

Mismatches

anthropics/anthropic-sdk-typescript

16

16

596

0

apollographql/apollo-client

7

7

559

0

arktypeio/arktype

5

5

389

0

axios/axios

1

1

105

0

colinhacks/zod

10

10

191

0

date-fns/date-fns

3

3

1

0

discordjs/discord.js

2

2

3

0

drizzle-team/drizzle-orm

3

3

10,786

0

Effect-TS/effect

10

10

2

0

elysiajs/elysia

4

4

53

0

excalidraw/excalidraw

7

7

11,048

0

fabian-hiller/valibot

2

2

1

0

fastify/fastify

1

1

0

0

gcanti/fp-ts

2

2

3

0

gcanti/io-ts

2

2

3

0

graphql/graphql-js

3

3

24

0

gvergnaud/ts-pattern

2

2

2

0

honojs/hono

6

6

14,239

0

immerjs/immer

1

1

5

0

jquense/yup

1

1

1

0

kysely-org/kysely

6

6

1,185

0

langchain-ai/langchainjs

41

41

5,273

0

lit/lit

34

34

2,588

0

microsoft/playwright

4

4

22

0

microsoft/TypeScript

4

4

613

0

microsoft/vscode, its own build

1

1

0

0

microsoft/vscode, extensions and tests

105

105

5,685

0

mikro-orm/mikro-orm

17

17

87,981

0

millsp/ts-toolbelt

1

1

3

0

mobxjs/mobx

3

3

186

0

mswjs/msw

10

10

5,878

0

nestjs/nest

30

30

27,345

0

nuxt/nuxt

3

3

11

0

openai/openai-node

4

4

6

0

pmndrs/jotai

2

2

7

0

pmndrs/valtio

1

1

0

0

pmndrs/zustand

1

1

0

0

preactjs/preact

1

1

1

0

prisma/prisma

44

44

24,201

0

puppeteer/puppeteer

10

10

2,701

0

react-hook-form/react-hook-form

2

2

3

0

ReactiveX/rxjs

10

10

22,271

0

reduxjs/redux

1

1

0

0

reduxjs/redux-toolkit

8

8

142

0

remeda/remeda

7

7

13

0

remix-run/react-router

14

14

6,735

0

rollup/rollup

9

9

107

0

sequelize/sequelize

16

16

6,768

0

sindresorhus/got

1

1

2

0

sindresorhus/ky

2

2

52

0

sindresorhus/type-fest

2

2

0

0

solidjs/solid

7

7

740

0

statelyai/xstate

8

8

545

0

storybookjs/storybook

19

19

1,401

0

stripe/stripe-node

4

4

42

0

sveltejs/svelte

5

5

186

0

TanStack/form

13

13

124

0

TanStack/query

15

15

686

0

TanStack/router

29

29

4,853

0

TanStack/table

20

20

574

0

tldraw/tldraw

4

4

0

0

total-typescript/ts-reset

2

2

4

0

typeorm/typeorm

4

4

959

0

typescript-eslint/typescript-eslint

35

35

18,392

0

unjs/h3

1

1

0

0

unjs/nitro

5

5

742

0

urql-graphql/urql

2

2

17

0

vercel/ai

52

52

9,742

0

vercel/next.js

356

356

3,690

0

vercel/swr

4

4

314

0

vitest-dev/vitest

18

18

2,111

0

vuejs/core

6

5

1,359

1

withastro/astro

12

12

1,996

0

All 72

1,103

1,102

286,267

1

The one mismatch is in vuejs/core. tsc only reports that error when global.ts comes before model.ts in files.

We ran 69 of them again under 11 other sets of compiler options:

Compiler options

Projects

Identical

Errors

Mismatches

Every strictness flag on

69

69

100,756

0

strict off

69

68

76,960

12

skipLibCheck off

69

69

90,609

0

checkJs

69

69

84,122

0

declaration

69

69

80,495

0

isolatedModules + verbatimModuleSyntax

69

69

80,622

0

isolatedDeclarations

62

62

34,982

0

erasableSyntaxOnly + legacy decorators

69

69

71,577

0

nodenext

69

69

85,238

0

"types": []

69

69

105,818

0

"lib": ["es5"]

69

69

83,872

0

All 11

752

751

895,051

12

(节选)

原文:Bun Blog|Bun v1.4.3,2026-10-10