@acamarata/tsconfig
v0.1.0
Published
Shared TypeScript configs for acamarata packages. Four variants: base, library, node, and react.
Maintainers
Readme
@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/tsconfigVariants
| 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
