skills/bun-typescript/SKILL.md
Using TypeScript with Bun, including type definitions and compiler options
npx skillsauth add jarle/bun-skills Bun TypeScriptInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Using TypeScript with Bun, including type definitions and compiler options
To install the TypeScript definitions for Bun's built-in APIs, install @types/bun.
bun add -d @types/bun # dev dependency
At this point, you should be able to reference the Bun global in your TypeScript files without seeing errors in your editor.
compilerOptionsBun supports things like top-level await, JSX, and extensioned .ts imports, which TypeScript doesn't allow by default. Below is a set of recommended compilerOptions for a Bun project, so you can use these features without seeing compiler warnings from TypeScript.
{
"compilerOptions": {
// Environment setup & latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// 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 run bun init in a new directory, this tsconfig.json will be generated for you. (The stricter flags are disabled by default.)
bun init
development
Learn how to write tests using Bun's Jest-compatible API with support for async tests, timeouts, and various test modifiers
testing
Learn how to use snapshot testing in Bun to save and compare output between test runs
testing
Learn about Bun test's runtime integration, environment variables, timeouts, and error handling
testing
Test Reporters