Skip to content

rubiin/tsconfig

Repository files navigation

tsconfig

Shared TypeScript config for my projects

Install

npm install --save-dev @rubiin/tsconfig

This config requires TypeScript 6 or later. Though it may work for Typescript 5

Usage

Preset Types

Preset Extends Type environment
Base @rubiin/tsconfig No explicit types; strict runtime-agnostic defaults
Node @rubiin/tsconfig/configs/tsconfig.node.json types: ["node"]
Nest @rubiin/tsconfig/configs/tsconfig.nest.json types: ["node", "express", "jest"]
Web @rubiin/tsconfig/configs/tsconfig.web.json DOM libs via lib: ["ESNext", "DOM", "DOM.Iterable"]
Bundler @rubiin/tsconfig/configs/tsconfig.bundler.json No explicit types; bundler module resolution

Base preset (runtime-agnostic)

{
  "extends": "@rubiin/tsconfig",
  "compilerOptions": {
    "outDir": "dist"
  }
}

Node preset (ESM-first)

{
  "extends": "@rubiin/tsconfig/configs/tsconfig.node.json",
  "compilerOptions": {
    "outDir": "dist"
  }
}

Nest preset (Node + decorators)

{
  "extends": "@rubiin/tsconfig/configs/tsconfig.nest.json"
}

Web preset (bundler-first)

{
  "extends": "@rubiin/tsconfig/configs/tsconfig.web.json"
}

Bundler preset (bundler-first)

{
  "extends": "@rubiin/tsconfig/configs/tsconfig.bundler.json"
}

When you are targeting a higher version of Node.js, check the relevant ECMAScript version and add it as target:

{
  "extends": "@rubiin/tsconfig",
  "compilerOptions": {
    "outDir": "dist",
    "target": "ES2023"
  }
}

About

Shareable tsconfig for my projects

Resources

License

Code of conduct

Contributing

Stars

4 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors