mirror of
https://github.com/acamarata/tsconfig.git
synced 2026-06-30 19:04:29 +00:00
Four JSON tsconfig presets for acamarata packages: base (strict/ES2022/bundler), library (declaration output), node (CommonJS), react (jsx:react-jsx/DOM). JSON-only package — no build step. Includes validation script and CI workflow.
1.8 KiB
1.8 KiB
@acamarata/tsconfig
Shared TypeScript configs for acamarata packages. Four variants covering the common cases: a strict base, a publishable library, a Node.js tool, and a React app.
Install
pnpm add -D @acamarata/tsconfig
Variants
| Config | Extends | Use case |
|---|---|---|
tsconfig.base.json |
— | Strict base. All other variants extend this. Use it directly only if none of the others fit. |
tsconfig.library.json |
base | Publishable npm libraries. ESNext modules, declaration: true, declarationMap: true, sourceMap: true. |
tsconfig.node.json |
base | Node.js tools and scripts. CommonJS output, @types/node included. |
tsconfig.react.json |
base | React apps. Adds jsx: react-jsx and the DOM lib. |
Usage
In your tsconfig.json, set extends to the variant that matches your project:
{
"extends": "@acamarata/tsconfig/tsconfig.library.json",
"compilerOptions": {
"rootDir": "src"
},
"include": ["src"]
}
For a Node.js CLI tool:
{
"extends": "@acamarata/tsconfig/tsconfig.node.json",
"compilerOptions": {
"rootDir": "src"
},
"include": ["src"]
}
For a React app:
{
"extends": "@acamarata/tsconfig/tsconfig.react.json",
"include": ["src"]
}
What the base config enables
strict: true— the full strict family of checksskipLibCheck: true— skips checking declaration files innode_modulesnoUncheckedIndexedAccess: true— array index access includesundefinedin the typeexactOptionalPropertyTypes: true— distinguishes{ x?: string }from{ x: string | undefined }target: ES2022— modern output; no polyfill overhead forasync/await,class fields,at()moduleResolution: bundler— resolves.tsextensions naturally in bundler pipelines (tsup, Vite, esbuild)
License
MIT