These are the type definitions for Bun's JavaScript runtime APIs.
Install the bun-types npm package:
# yarn/npm/pnpm work too, "bun-types" is an ordinary npm package
bun add bun-typesAdd this to your tsconfig.json or jsconfig.json:
bun-types is generated via ./bundle.ts.
- Add it to ./index.d.ts
./bundle.ts merges the types in this folder into a single file.
To run it:
bun generate
{ "compilerOptions": { "lib": ["ESNext"], "module": "esnext", "target": "esnext", // "bun-types" is the important part "types": ["bun-types"] } }