mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 03:18:53 +00:00
* Fix TS types, improve child_process types * Add prettier * Add ArrayBuffer types * Add namespace Bun, improve types for SharedArrayBuffer, add toStrictEqual * Improve types, add test files for types * Update type tests * Fix typo * Add stdio * Stdio types * Use latest setup-bun * Update action * Update action * Update action Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu> Co-authored-by: Ashcon Partovi <ashcon@partovi.net>
Bun TypeScript type definitions
These are the type definitions for Bun's JavaScript runtime APIs.
Installation
Install the bun-types npm package:
# yarn/npm/pnpm work too, "bun-types" is an ordinary npm package
bun add bun-types
Usage
Add this to your tsconfig.json or jsconfig.json:
{
"compilerOptions": {
"lib": ["esnext"],
"module": "esnext",
"target": "esnext",
"moduleResolution": "node",
// "bun-types" is the important part
"types": ["bun-types"]
}
}
Contributing
bun-types is generated via ./bundle.ts.
Adding a new file
- Add it to ./index.d.ts
How to generate types.d.ts
./bundle.ts merges the types in this folder into a single file.
To run it:
bun build
