@zayne-labs/tsconfig
v0.1.1
Published
A collection of TypeScript configurations for various projects, based on Total TypeScript's TSConfig Cheat Sheet, with a few additions.
Downloads
511
Readme
@zayne-labs/tsconfig
This package helps set proper tsconfig presets for most projects. Inspired by Matt Pocock's TSConfig Cheat Sheet.
Setup
- Install:
# Npm
npm install --save-dev @zayne-labs/tsconfig
# Pnpm
pnpm add -D @zayne-labs/tsconfig
Choose which
tsconfig.json
you need from the list below.Add it to your
tsconfig.json
:
{
// For building an app that runs in the DOM with an external bundler
"extends": "@zayne-labs/tsconfig/bundler/dom/app",
}
List of TSConfigs
Are You Using tsc
To Turn Your .ts
Files Into .js
Files?
Yes
If yes, use this selection of configs:
{
// For code that runs in the DOM:
"extends": "@zayne-labs/tsconfig/tsc/dom/app", // For an app
"extends": "@zayne-labs/tsconfig/tsc/dom/library", // For a library
"extends": "@zayne-labs/tsconfig/tsc/dom/library-monorepo", // For a library in a monorepo
// For code that doesn't run in the DOM (for instance, in Node.js):
"extends": "@zayne-labs/tsconfig/tsc/no-dom/app", // For an app
"extends": "@zayne-labs/tsconfig/tsc/no-dom/library", // For a library
"extends": "@zayne-labs/tsconfig/tsc/no-dom/library-monorepo", // For a library in a monorepo
}
No
If no, you're probably using an external bundler.
{
// For code that runs in the DOM:
"extends": "@zayne-labs/tsconfig/bundler/dom/app", // For an app
"extends": "@zayne-labs/tsconfig/bundler/dom/library", // For a library
"extends": "@zayne-labs/tsconfig/bundler/dom/library-monorepo", // For a library in a monorepo
// For code that doesn't run in the DOM (for instance, in Node.js):
"extends": "@zayne-labs/tsconfig/bundler/no-dom/app", // For an app
"extends": "@zayne-labs/tsconfig/bundler/no-dom/library", // For a library
"extends": "@zayne-labs/tsconfig/bundler/no-dom/library-monorepo", // For a library in a monorepo
}
Framework-Specific Options
The following are currently supported framework-specific options, will add more if needed in future:
{
// For a vite app
"extends": "@zayne-labs/tsconfig/bundler/dom/vite",
// For a nextjs app
"extends": "@zayne-labs/tsconfig/bundler/dom/next",
}