Bun-types provides comprehensive TypeScript type definitions for the Bun JavaScript runtime, currently stable at version 1.3.12. This package is crucial for developers leveraging TypeScript with Bun, offering robust static type checking, autocompletion, and improved developer experience across Bun's unique APIs and global objects. It releases frequently, typically coinciding with major and minor Bun runtime releases, ensuring type definitions remain in sync with the rapidly evolving runtime. Unlike traditional `@types/` packages that target third-party libraries, `bun-types` directly defines the core Bun runtime environment, including its native module system (e.g., `bun:sqlite`, `bun:jsc`), global APIs like `Bun.serve` and `Bun.file`, and Web API implementations (e.g., `fetch`, `Request`, `Response`). Its key differentiator is its tight integration and direct support for Bun's opinionated, high-performance ecosystem, providing an authoritative and up-to-date type experience that reflects Bun's specific behaviors and extensions.
npm install bun-typesVerified import paths — ran on the pinned version, not inferred.
Demonstrates a basic HTTP server using Bun's native `Bun.serve` API, showcasing type safety and core functionality.
Run `bun upgrade` to update Bun and then `bun install --force` or `npm update bun-types` to ensure types are in sync.
Consult Bun's official blog and release notes for each version upgrade. Update your code to match the new API signatures and behaviors.
Refer to Bun's documentation for specifics on its Web API implementations to understand any differences and ensure compatibility.
Install `bun-types` as a dev dependency: `bun add -d bun-types` or `npm install -D bun-types`. Ensure `tsconfig.json` includes `"types": ["bun-types"]` or that the package is discovered automatically.
Upgrade both your Bun runtime and `bun-types` to the latest compatible versions. Run `bun upgrade` followed by `bun install --force` or `npm update bun-types`.
For type-only imports, use `import type { SomeType } from 'bun'`. For module-specific features, ensure the correct Bun module specifier is used, e.g., `import { Database } from 'bun:sqlite'`.No dependency data recorded yet.