Shared TypeScript config for our projects
$ npm install --save-dev @2bad/tsconfig
Requires TypeScript >= 5.8.
tsconfig.json
{
"extends": "@2bad/tsconfig",
"compilerOptions": {
"outDir": "build",
"types": ["node"]
}
}The base sets types to [], so list the ambient type packages your project needs (for example ["node"]). This matches the TypeScript 7.0 default and keeps type resolution explicit.
For path mapping, inline the source directory into each paths entry. baseUrl is deprecated in TypeScript 6.0 and removed in 7.0, so it is no longer used.
{
"extends": "@2bad/tsconfig",
"compilerOptions": {
"outDir": "build",
"types": ["node"],
"paths": {
"~/*": ["./source/*"]
}
}
}