TypeScript types for Bun
These are the type definitions for Bun's JavaScript runtime APIs.
Installation
Install the @aphrody/bun-types npm package:
# yarn/npm/pnpm work too
bun add -D @aphrody/bun-types
TypeScript only auto-loads @types/* packages, so list it in compilerOptions.types in your tsconfig.json:
{
"compilerOptions": {
"types": ["@aphrody/bun-types"]
}
}
The Bun global and all bun:* modules are then available.
Contributing
The @aphrody/bun-types package lives in this repo under packages/bun-types. (Upstream, the @types/bun package is a shim that loads 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
