Shared TypeScript config for my projects
npm install --save-dev @rubiin/tsconfigThis config requires TypeScript 6 or later. Though it may work for Typescript 5
| Preset | Extends | Type environment |
|---|---|---|
| Base | @rubiin/tsconfig |
No explicit types; strict runtime-agnostic defaults |
| Node | @rubiin/tsconfig/configs/tsconfig.node.json |
types: ["node"] |
| Nest | @rubiin/tsconfig/configs/tsconfig.nest.json |
types: ["node", "express", "jest"] |
| Web | @rubiin/tsconfig/configs/tsconfig.web.json |
DOM libs via lib: ["ESNext", "DOM", "DOM.Iterable"] |
| Bundler | @rubiin/tsconfig/configs/tsconfig.bundler.json |
No explicit types; bundler module resolution |
Base preset (runtime-agnostic)
{
"extends": "@rubiin/tsconfig",
"compilerOptions": {
"outDir": "dist"
}
}Node preset (ESM-first)
{
"extends": "@rubiin/tsconfig/configs/tsconfig.node.json",
"compilerOptions": {
"outDir": "dist"
}
}Nest preset (Node + decorators)
{
"extends": "@rubiin/tsconfig/configs/tsconfig.nest.json"
}Web preset (bundler-first)
{
"extends": "@rubiin/tsconfig/configs/tsconfig.web.json"
}Bundler preset (bundler-first)
{
"extends": "@rubiin/tsconfig/configs/tsconfig.bundler.json"
}When you are targeting a higher version of Node.js, check the relevant ECMAScript version and add it as target:
{
"extends": "@rubiin/tsconfig",
"compilerOptions": {
"outDir": "dist",
"target": "ES2023"
}
}