My personal TypeScript configurations designed to provide consistent, strict, and production-ready settings across different project types. These opinionated configs balance type safety with developer experience, helping you avoid common pitfalls while maintaining compatibility with modern frameworks and libraries.
- Ready-to-use TypeScript configurations:
@benhigham/tsconfig
: Base configuration for TypeScript projects@benhigham/tsconfig/browser
: Configuration optimized for browser environments@benhigham/tsconfig/astro
: Configuration for Astro framework projects@benhigham/tsconfig/next
: Configuration for Next.js projects@benhigham/tsconfig/react-app
: Configuration for React applications@benhigham/tsconfig/react-library
: Configuration for React libraries@benhigham/tsconfig/vite
: Configuration for Vite-based projects
- Sensible defaults to ensure type safety and consistent code quality
- Regularly updated to support the latest TypeScript features
# npm
npm install --save-dev @benhigham/tsconfig
# yarn
yarn add --dev @benhigham/tsconfig
# pnpm
pnpm add --save-dev @benhigham/tsconfig
Use in tsconfig.json
by extending the desired configuration:
{
"extends": "@benhigham/tsconfig",
"compilerOptions": {
"outDir": "dist",
},
"include": ["src"],
}
{
"extends": "@benhigham/tsconfig/browser",
"compilerOptions": {
"outDir": "dist",
},
"include": ["src"],
}
{
"extends": "@benhigham/tsconfig/astro",
"include": ["src", ".astro/types.d.ts"],
}
{
"extends": "@benhigham/tsconfig/next",
"include": ["src", "next-env.d.ts"],
}
{
"extends": "@benhigham/tsconfig/react-app",
"compilerOptions": {
"outDir": "dist",
},
"include": ["src"],
}
{
"extends": "@benhigham/tsconfig/react-library",
"compilerOptions": {
"outDir": "dist",
},
"include": ["src"],
}
{
"extends": "@benhigham/tsconfig/vite",
"compilerOptions": {
"types": ["vite/client"],
},
"include": ["src"],
}
- TypeScript 5.5.x or higher
This project is licensed under the MIT License.