Shared strict TypeScript configurations for DNBHQ projects.
npm install --save-dev @dnbhq/tsconfig typescriptUse this for generic TypeScript projects.
{
"extends": "@dnbhq/tsconfig/strict",
"include": [
"src/**/*.ts"
]
}Use this for Node.js CLI tools and scripts.
{
"extends": "@dnbhq/tsconfig/cli",
"include": [
"src/**/*.ts",
"scripts/**/*.ts"
],
"exclude": [
"node_modules",
"dist"
]
}Use this for Astro projects using TypeScript.
{
"extends": "@dnbhq/tsconfig/astro",
"include": [
".astro/types.d.ts",
"**/*"
],
"exclude": [
"dist"
]
}The package intentionally does not define include, exclude, or files.
Those settings belong to the consuming project because TypeScript overwrites them during inheritance instead of merging them.
The strict baseline also avoids environment-specific assumptions such as Node.js types, DOM types, JavaScript migration settings, or Astro-specific module resolution.
Dry run:
npm run release:dryRelease:
npm run releaseReleases are handled by release-it and @release-it/conventional-changelog.
Commit messages should follow Conventional Commits.
-
Generic strict project:
{ "extends": "@dnbhq/tsconfig/strict", "include": [ "src/**/*.ts" ] }
-
Node CLI project:
{ "extends": "@dnbhq/tsconfig/cli", "include": [ "src/**/*.ts", "scripts/**/*.ts" ] } -
Astro project:
{ "extends": "@dnbhq/tsconfig/astro", "include": [ ".astro/types.d.ts", "**/*" ] }
include,exclude, andfilesare project-local.TypeScript overwrites them from the consuming config, so the shared package should not define them. (TypeScript)- Multiple
extendsare supported since TypeScript 5.0+, but many tools still document or assume a single string. For maximum compatibility, onlyastro.jsonuses an array because it needs to compose Astro’s own strict config with your strict baseline. (Microsoft for Developers) - Defaults may not be obvious. Consumers see only their local
tsconfig.json, not the full resolved config. Usenpx tsc --showConfigin projects when debugging inherited values. typesis intentionally not instrict.json. Settingtypesrestricts which global@types/*packages are included, so Node types belong incli.json, not the generic strict baseline. (TypeScript)- Astro config needs
astroinstalled in the consuming project.astro.jsonextendsastro/tsconfigs/strict, so that path must resolve from the project using the config. erasableSyntaxOnlyrequires a modern TypeScript version. Keep the peer dependency strict enough, otherwise older projects will fail on unknown compiler options.