@sanity/tsconfig
Shared tsconfig.json presets following best practices at Sanity.io
Installation
Add the package to your "devDependencies":
npm install --save-dev @sanity/tsconfig
# or
pnpm add --save-dev @sanity/tsconfig
# or
yarn add --dev @sanity/tsconfigUsage
Choose one of the presets as your base:
You can optionally combine your base with @sanity/tsconfig/isolated-declarations if you're using build tools (like rolldown or tsdown) that can generate .d.ts files significantly faster when TypeScript is constrained with "isolatedDeclarations": true.
Recommended <kbd>tsconfig.json</kbd>
Add to your tsconfig.json:
{
"extends": "@sanity/tsconfig/recommended"
}Strict <kbd>tsconfig.json</kbd>
Add to your tsconfig.json:
{
"extends": "@sanity/tsconfig/strict"
}Strictest <kbd>tsconfig.json</kbd>
Add to your tsconfig.json:
{
"extends": "@sanity/tsconfig/strictest"
}Isolated Declarations <kbd>tsconfig.json</kbd>
Extend the isolated-declarations.json preset in addition to your base.
If your tsconfig.json previously looked like this:
{
"extends": "@sanity/tsconfig/strict"
}Then change extends to an array and isolated-declarations to the end:
{
"extends": ["@sanity/tsconfig/strict", "@sanity/tsconfig/isolated-declarations"]
}