# Install TypeScript declarations for Bun (/docs/guides/runtime/typescript)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 334 · updated: 2026-07-28 -->
Related: [Re-map import paths](/docs/guides/runtime/tsconfig-paths.md), [Debugging Bun with the VS Code extension](/docs/guides/runtime/vscode-debugger.md), [Debugging Bun with the web debugger](/docs/guides/runtime/web-debugger.md), [Inspect memory usage using V8 heap snapshots](/docs/guides/runtime/heap-snapshot.md), [Build-time constants with --define](/docs/guides/runtime/build-time-constants.md), [Define and replace static globals & constants](/docs/guides/runtime/define-constant.md)

To add TypeScript definitions for Bun's built-in APIs to your project, install `@types/bun`.

```sh terminal icon="terminal"
bun add -d @types/bun # dev dependency
```

***

Here is the full set of recommended `compilerOptions` for a Bun project. With this `tsconfig.json`, you can use top-level await, extensioned or extensionless imports, and JSX.

```json tsconfig.json icon="file-json"
{
  "compilerOptions": {
    // Environment setup & latest features
    "lib": ["ESNext"],
    "target": "ESNext",
    "module": "Preserve",
    "moduleDetection": "force",
    "jsx": "react-jsx",
    "allowJs": true,
    "types": ["bun"],

    // Bundler mode
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "verbatimModuleSyntax": true,
    "noEmit": true,

    // Best practices
    "strict": true,
    "skipLibCheck": true,
    "noFallthroughCasesInSwitch": true,
    "noUncheckedIndexedAccess": true,
    "noImplicitOverride": true,

    // Some stricter flags (disabled by default)
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noPropertyAccessFromIndexSignature": false
  }
}
```

***

If you're using TypeScript 6.0 or later, you also need `"types": ["bun"]` in your `compilerOptions`. See [TypeScript 6 and 7](/typescript-6) for details.

***

See [TypeScript](/runtime/typescript).
