About tsconfig
A TypeScript configuration recipe for Vite projects, with settings for strict type checking and optional Chrome extension APIs. It explains key compiler options and the Chrome types package.
Key features
- 01ES2020 target and ESNext modules
- 02Bundler module resolution
- 03Strict type checking
- 04Type checking without emitted files
- 05Optional Chrome API types
Use cases
- 01Configuring TypeScript for Vite
- 02Type-checking Chrome extension APIs
- 03Preventing TypeScript output from conflicting with Vite
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ gkwa/ volcanicviper --skill tsconfigAfter installing, type/tsconfigin Claude Code to confirm it loaded.
Bundled filestile.json
Details
From the project READMEAdd a tsconfig.json with these settings:
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noEmit": true,
"types": ["chrome", "vitest/globals"],
"lib": ["ES2020", "DOM", "DOM.Iterable"]
},
"include": ["src"]
}
Key options:
"moduleResolution": "bundler"— required for Vite to resolve ES modules correctly"types": ["chrome"]— enables IntelliSense and type checking for Chrome extension APIs (chrome.storage,chrome.runtime, etc.); remove if not building a Chrome extension"noEmit": true— lets TypeScript do type checking without conflicting with Vite's compilation"target": "ES2020"— enables async/await, optional chaining, and other modern syntax"strict": true— catches bugs early and enforces consistent coding patterns
Install the Chrome types package if building a Chrome extension:
pnpm add --save-dev @types/chrome
Comments
Markdown supported