| name | types-bun-skilld |
| description | ALWAYS use when writing code importing "@types/bun". Consult for debugging, best practices, or modifying @types/bun, types/bun, types bun, DefinitelyTyped. |
| metadata | {"version":"1.3.14","generated_by":"Anthropic · Haiku 4.5","generated_at":"2026-06-26T00:00:00.000Z"} |
DefinitelyTyped/DefinitelyTyped @types/bun@1.3.14
Tags: ts4.6: 1.0.8, ts4.7: 1.1.5, ts4.8: 1.1.13
References: package.json • README • Docs • Issues • Discussions • Releases
Search
Use skilld search "query" -p @types/bun instead of grepping .skilld/ directories. Run skilld search --guide -p @types/bun for full syntax, filters, and operators.
API Changes
This section documents version-specific API changes in @types/bun v1.3.14 — prioritize recent breaking changes and migrations.
-
DEPRECATED: readableStreamToBytes() — replaced by ReadableStream.bytes() method since v1.x source
-
DEPRECATED: readableStreamToBlob() — replaced by ReadableStream.blob() method since v1.x source
-
DEPRECATED: readableStreamToText() — replaced by ReadableStream.text() method since v1.x source
-
DEPRECATED: readableStreamToJSON() — replaced by ReadableStream.json() method since v1.x source
-
DEPRECATED: ServeOptions<T> type — use Serve.Options<T> instead source
-
NEW: Statement.columnTypes property — get runtime column types from sqlite prepared statements, added v1.2.13 source
-
NEW: Statement.declaredTypes property — get declared column types from table schema in sqlite, added v1.2.13 source
-
DEPRECATED: Errorlike type — renamed to ErrorLike source
-
DEPRECATED: BuildError variable — renamed to BuildMessage source
-
DEPRECATED: ResolveError variable — renamed to ResolveMessage source
-
DEPRECATED: TLSOptions properties — keyFile, certFile, caFile (since v0.6.3) — use key: Bun.file(path), cert: Bun.file(path), ca: Bun.file(path) instead source
-
BREAKING: WebSocket static constants deprecated — use instance properties instead: .CONNECTING, .OPEN, .CLOSING, .CLOSED now instance properties source
-
DEPRECATED: Database.exec() — method alias, prefer Database.run() instead source
Also changed: Bun.Spawn import deprecated · readableStreamToBlob.formData() on Blob · CustomEvent.initCustomEvent() deprecated · DOMException.code deprecated · Platform type unused · Architecture type unused · ShellFunction type unused · ReadableIO type unused · Process.assert() use "node:assert" instead · BunMessageEvent.initMessageEvent() deprecated
Best Practices
-
Include "types": ["bun"] in compilerOptions for TypeScript 6.0+ — enables proper type inference for the Bun global source
-
Set "module": "Preserve" in tsconfig.json — allows extensioned .ts imports which Bun natively supports source
-
Use "moduleResolution": "bundler" for Bun projects — enables correct module resolution for bundler-aware codebases source
-
Enable allowImportingTsExtensions and verbatimModuleSyntax in tsconfig — required to support .ts imports in development without transformation errors source
-
BunFile instances are lazy and never perform I/O until contents are read — design code to stream or iterate over large files instead of loading entirely into memory source
-
Bun automatically detects MIME type from file extension when using Bun.file() — avoids manual type inference and enables correct response headers source
-
Avoid file slicing operations with begin > 0 on macOS — they are significantly slower due to system call differences; prefer full-file reads when possible source
-
Use Bun.allocUnsafe() for performance-critical allocations where speed matters — 3.5x faster than new Uint8Array(size) but requires careful handling to prevent memory leaks from uninitialized bytes source
const buffer = Bun.allocUnsafe(1024);
-
Enable "strict": true in compiler options — Bun's type definitions are fully strict-compatible and best practices align with strict type checking source
-
Set "skipLibCheck": true — improves TypeScript compilation speed significantly without sacrificing type safety in your code source
-
Use "jsx": "react-jsx" for automatic JSX element transformation — Bun's type definitions assume this setting for JSX support source
-
Set "lib": ["ESNext"] and "target": "ESNext" — Bun supports all modern JavaScript features (top-level await, decorators, etc.) and type definitions target ESNext source