|
|
||
|---|---|---|
| .. | ||
| docs | ||
| vendor/expect-type | ||
| bun.d.ts | ||
| bun.ns.d.ts | ||
| CLAUDE.md | ||
| deprecated.d.ts | ||
| devserver.d.ts | ||
| experimental.d.ts | ||
| extensions.d.ts | ||
| fetch.d.ts | ||
| ffi.d.ts | ||
| globals.d.ts | ||
| html-rewriter.d.ts | ||
| index.d.ts | ||
| jsc.d.ts | ||
| overrides.d.ts | ||
| package.json | ||
| README.md | ||
| redis.d.ts | ||
| s3.d.ts | ||
| security.d.ts | ||
| shell.d.ts | ||
| sql.d.ts | ||
| sqlite.d.ts | ||
| test-globals.d.ts | ||
| test.d.ts | ||
| wasm.d.ts | ||
TypeScript types for Bun
These are the type definitions for Bun's JavaScript runtime APIs.
Installation
Install the @types/bun npm package:
# yarn/npm/pnpm work too
# @types/bun is an ordinary npm package
bun add -D @types/bun
That's it! VS Code and TypeScript automatically load @types/* packages into your project, so the Bun global and all bun:* modules should be available immediately.
Contributing
The @types/bun package is a shim that loads bun-types. The bun-types package lives in the Bun repo under packages/bun-types.
To add a new file, add it under packages/bun-types. Then add a triple-slash directive pointing to it inside ./index.d.ts.
+ /// <reference path="./newfile.d.ts" />
bun build
