@dvashim/typescript-config
v1.1.7
Published
Shared TypeScript configurations
Readme
Typescript Configurations
Installation
npm:
npm install -D @dvashim/typescript-configor pnpm:
pnpm add -D @dvashim/typescript-configConfigurations
| Name | Path |
|------|------|
| Base | @dvashim/typescript-config or @dvashim/typescript-config/base |
| Library development | @dvashim/typescript-config/lib or @dvashim/typescript-config/lib/dev |
| Library production | @dvashim/typescript-config/lib/prod |
| React JSX application | @dvashim/typescript-config/app/react |
| Vite + React JSX application | @dvashim/typescript-config/app/react/vite |
| Node | @dvashim/typescript-config/node |
Use
Base configuration:
// tsconfig.json (base)
// Very strict + future-proof setup with full ESM support
// (es2022 + verbatimModuleSyntax), bundler-friendly resolution,
// no emitted .js files on error, strong type-safety guards,
// and clean imports — ideal for libraries, Vite/React apps,
// monorepos and high-quality TypeScript projects
// that want to catch as many mistakes as possible at compile time.
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@dvashim/typescript-config",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.base.tsbuildinfo",
},
"include": ["src"]
}Library development configuration:
// tsconfig.json (library development)
// Modern strict es2022 + ESM + bundler-mode configuration
// for libraries / monorepos / bundler-based projects
// with verbatimModuleSyntax, full strictness,
// clean .d.ts emit (best practices)
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@dvashim/typescript-config/lib/dev",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.dev.tsbuildinfo",
},
"include": ["src"]
}Library production configuration:
// tsconfig.json (library production)
// Modern strict es2022 + ESM + bundler-mode configuration
// for libraries / monorepos / bundler-based projects
// with verbatimModuleSyntax, full strictness,
// clean .d.ts emit, no source maps / comments
// (best practices)
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@dvashim/typescript-config/lib/prod",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.prod.tsbuildinfo",
},
"include": ["src"]
}React JSX application configuration:
// tsconfig.json (react jsx application)
// Strict, modern, no-emit configuration for
// React + ESM/bundler workflows
// (Vite/Turbopack/esbuild compatible)
// with verbatim module syntax and full type safety.
// Very strict settings, modern ESM resolution,
// React JSX transform, no emitted .js files,
// supports importing .ts/.tsx extensions directly.
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@dvashim/typescript-config/app/react",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
},
"include": ["src"]
}Vite + React JSX application configuration:
// tsconfig.json (vite + react jsx application)
// Strict, modern, no-emit configuration for
// Vite + React projects with verbatim module syntax
// and full type safety.
// Very strict settings, modern ESM resolution,
// React JSX transform, no emitted .js files,
// supports importing .ts/.tsx extensions directly.
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@dvashim/typescript-config/app/react/vite",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
},
"include": ["src"]
}Node configuration:
// tsconfig.json (node)
// Strict configuration for ESM + bundler environments
// (Vite, esbuild, Bun, Parcel, Turbopack, Rollup, etc.)
// Designed for tools that handle bundling, transpilation
// and module resolution themselves
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@dvashim/typescript-config/node",
"include": ["vite.config.ts"]
}Rules
Base configuration
Module
- module:
es2022— Specifies the module code generation format. - moduleDetection:
force— Forces all files to be treated as ES modules. - moduleResolution:
bundler— Module resolution strategy optimized for modern bundlers. - verbatimModuleSyntax:
true— Preserves import and export syntax exactly as written. - resolveJsonModule:
true— Allows importing.jsonfiles as typed modules.
- module:
Strictness
- strict:
true— Enables all strict type-checking options. - exactOptionalPropertyTypes:
true— Treats optional properties as strictlyT | undefined. - noImplicitOverride:
true— Requires theoverridekeyword when overriding class members. - noPropertyAccessFromIndexSignature:
true— Disallows property access via dot notation when defined only by an index signature. - noUncheckedIndexedAccess:
true— Addsundefinedto types accessed via index signatures.
- strict:
Safety
- noUncheckedSideEffectImports:
true— Reports errors for side-effect imports that are not explicitly used. - allowUnreachableCode:
true— Allows unreachable code without compiler errors. - allowUnusedLabels:
false— Disallows unused labels in the code. - forceConsistentCasingInFileNames:
true— Ensures consistent casing in file name imports across the project. - noFallthroughCasesInSwitch:
true— Reports errors for fallthrough cases inswitchstatements. - noImplicitReturns:
true— Reports errors when not all code paths in a function return a value. - noUnusedLocals:
true— Reports errors for unused local variables. - noUnusedParameters:
true— Reports errors for unused function parameters. - allowJs:
false— Disallows JavaScript files from being included in the compilation.
- noUncheckedSideEffectImports:
Emit
- target:
es2022— Sets the JavaScript language version for emitted output. - importsNotUsedAsValues:
remove— Removes imports used only for types from emitted JavaScript. - noEmitOnError:
true— Prevents emitting output files when type errors are present. - lib:
["ES2022"]— Specifies built-in library declaration files included in compilation. - erasableSyntaxOnly:
true— Restricts usage to syntax that can be fully erased during compilation. - skipLibCheck:
true— Skips type checking of declaration files for faster builds. - useDefineForClassFields:
true— Emits class fields using ECMAScript-standarddefinesemantics.
- target:
Node configuration
This configuration extends the base configuration and overrides some compiler options
Module
- module:
esnext— Specifies the module code generation format.
- module:
Emit
- noEmit:
true— Disables emitting compiled JavaScript files.
- noEmit:
Target / Language
Types
- types:
["node"]— Includes type declarations for Node.js.
- types:
Module Features
- allowImportingTsExtensions:
true— Allows importing TypeScript files with explicit.tsextensions.
- allowImportingTsExtensions:
