@pindakaasman/tsconfig
v0.2.2
Published
Ramon's shared TypeScript configs. Targets TypeScript v5, v6 and v7.
Readme
@pindakaasman/tsconfig
Ramon's shared TypeScript configs. Targets TypeScript v5, v6 and v7.
Four files, meant to be extended, not used directly:
| File | What it is |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| base.json | Universal strict settings (strict, skipLibCheck, esModuleInterop, …). Extended by the rest, rarely used alone. |
| app.json | For apps built by a bundler (extends base.json): noEmit: true, moduleResolution: "bundler". |
| library.json | For packages tsc itself compiles and emits (extends base.json): noEmit: false, declaration, NodeNext, incremental: false (so a clean rebuild after deleting dist/ always emits). Placeholder — see note below. |
| nextjs.json | For Next.js apps (extends app.json): jsx: "react-jsx", the next TS plugin. |
Note on
library.json: no actual library tsconfig was on hand when this package was built — every config Ramon had was Next.js-based. It's a reasonable placeholder (NodeNextmodule/resolution, declaration output todist/), not a stated preference. Revisit once there's a real library project to derive it from.
Why no paths, include, exclude, rootDir, or outDir in these files
Those options are relative-path-based and where they get resolved from (the
package's own directory vs. your project's) is inconsistent across
TypeScript versions once a base config lives inside node_modules. Every
project's source layout is different anyway, so these stay local to your own
tsconfig.json rather than baked into the shared package.
Install
npm install --save-dev typescript @pindakaasman/tsconfigUsage
tsconfig.json, Next.js project:
{
"extends": "@pindakaasman/tsconfig/nextjs.json",
"compilerOptions": {
"paths": {
"~/*": ["./src/*"]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"**/*.mts"
],
"exclude": ["node_modules"]
}tsconfig.json, library that tsc compiles directly:
{
"extends": "@pindakaasman/tsconfig/library.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"paths": {
"~/*": ["./src/*"]
}
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist"]
}~/* (rather than the more common @/*) is deliberate: it avoids visual
overlap with scoped package imports like @pindakaasman/*.
