@igorskyflyer/tsconfig
v2.0.1
Published
🔧 Opinionated, reusable TSConfig base for modern TypeScript projects. 🧠
Maintainers
Readme
Table of Contents
- ✨ Features
- 🕵🏼 Usage
- ⚙️ Implementation
- 🎯 Motivation
- 📝 Changelog
- 🪪 License
- 💖 Support
- 🧬 Related
- 👨🏻💻 Author
Features
- 🔧 Very strict TypeScript configuration by default (
strict: true+ modern strict options) - 📦 Separate configs for Node.js and browser environments
- 🎯
ES2024target - modern and future-ready (requires Node ≥ 24) - 🗺️ Full source maps + declaration maps for excellent debugging and type publishing
- ⚡
verbatimModuleSyntax+isolatedDeclarationsfor clean, modern module handling - 🔍 Strong type safety with
exactOptionalPropertyTypes,noUncheckedIndexedAccess, and more - 🧩 Clean, reusable base - designed to be extended with minimal effort
Usage
Install it by executing any of the following, depending on the preferred package manager:
bun add @igorskyflyer/tsconfig -Dpnpm add @igorskyflyer/tsconfig -Dyarn add @igorskyflyer/tsconfig -Dnpm i @igorskyflyer/tsconfig -DThen extend the preferred config in tsconfig.json:
Node (default)
tsconfig.json
{
"extends": "@igorskyflyer/tsconfig",
"include": ["src/**/*"],
"exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist"
}
}Node (explicit)
tsconfig.json
{
"extends": "@igorskyflyer/tsconfig/node",
"include": ["src/**/*"],
"exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist"
}
}Browser
tsconfig.json
{
"extends": "@igorskyflyer/tsconfig/browser",
"include": ["src/**/*"],
"exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist"
}
}Base only
tsconfig.json
{
"extends": "@igorskyflyer/tsconfig/base",
"include": ["src/**/*"],
"exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist"
}
}[!NOTE]
include,exclude,rootDirandoutDirare project-specific and must be defined locally.
Implementation
All configs extend base, which defines the shared structure and strict rules.
Base
tsconfig.json
{
"compilerOptions": {
"declaration": true, // generate .d.ts files
"declarationMap": true, // generate .d.ts.map files
"sourceMap": true, // generate .js.map files
"verbatimModuleSyntax": true, // enforce explicit import/export types
"isolatedDeclarations": true, // require explicit types on all exports (faster .d.ts emit)
"strict": true, // enable all strict type checks
"exactOptionalPropertyTypes": true, // treat optional properties strictly (undefined vs missing)
"noFallthroughCasesInSwitch": true, // error on switch cases that fall through
"noUncheckedIndexedAccess": true, // index signatures include undefined
"noPropertyAccessFromIndexSignature": true, // prevent property access outside index signatures
"noUnusedLocals": true, // error on unused local variables
"noUnusedParameters": true, // error on unused function parameters
"noImplicitAny": true, // error on implicit 'any' types
"noImplicitReturns": true, // error on functions missing return statements
"skipLibCheck": true, // skip type-checking of declaration files
"forceConsistentCasingInFileNames": true, // enforce consistent file casing
"noEmitOnError": true // don't emit files if there are type errors
}
}Node
Extends base and adds Node environment targeting:
tsconfig.json
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"target": "ES2024", // modern JS output
"lib": ["ES2024"], // modern built-in types
"types": ["node"], // Node.js global type definitions
"module": "NodeNext", // Node ESM-compatible modules
"moduleResolution": "NodeNext" // Node ESM module resolution
}
}Browser
Extends base and adds browser environment targeting:
tsconfig.json
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"target": "ES2024", // modern JS output
"lib": ["ES2024", "DOM", "DOM.Iterable"], // modern + DOM types
"module": "ESNext", // bundler-compatible modules
"moduleResolution": "Bundler", // bundler module resolution
"allowImportingTsExtensions": true, // allow explicit .ts extensions in imports
"erasableSyntaxOnly": true, // ensure compatibility with type-stripping engines
"noEmit": true, // hand over file emission to the bundler
"declaration": false, // disable base declaration emit to prevent noEmit conflict
"declarationMap": false // disable base declaration maps
}
}Motivation
Managing TypeScript configuration across multiple projects is tedious and error-prone. Each project ends up with its own tsconfig.json, slightly different, slightly outdated, with no single source of truth.
@igorskyflyer/tsconfig solves this by providing one opinionated, versioned config that propagates across all projects via a simple extends. Update once, apply everywhere - just like all packages of the @igorskyflyer ecosystem do!
Changelog
Read about the latest changes in the CHANGELOG.
License
Licensed under the MIT license.
Support
Related
This package is part of the dotfiles DX config suite - a curated index of independently installable configuration packages for linting, formatting, editing, JS/TS, React, Vue and many more.
Other related packages
✒ DúöScríbî allows you to convert letters with diacritics to regular letters. 🤓
🧠 Zep is a zero-dependency, efficient debounce module. ⏰
🔦 Provides frequently used types for your TypeScript projects. 🦄
🤫 Zitto - quiet config, loud clarity. A zero-dependency TypeScript/JavaScript helper for merging defaults and options across Node, Deno, Bun, and browsers. 🍯
@igorskyflyer/magic-queryselector
🪄 A TypeScript-types patch for querySelector/querySelectorAll, make them return types you expect them to! 🔮
Author
Created by Igor Dimitrijević (@igorskyflyer).
