Skip to content

rainstormy/presets-typescript

Repository files navigation

Opinionated Presets for TypeScript

This package provides predefined, opinionated TypeScript configurations to be applied to the extends property in tsconfig.json.

Installation

Install the typescript and @rainstormy/presets-typescript packages with the package manager of your choice:

npm install --save-dev typescript @rainstormy/presets-typescript
pnpm add --save-dev typescript @rainstormy/presets-typescript
yarn add --dev typescript @rainstormy/presets-typescript

Usage

Create a tsconfig.json file and extend @rainstormy/presets-typescript/base to enable type-checking in general.

In addition to this, you can extend some of the following configurations to refine the TypeScript settings for your project:

Configuration Description
@rainstormy/presets-typescript/es2023 Targets browser apps, full-stack apps, and npm libraries.
@rainstormy/presets-typescript/es2023-node Targets Node.js apps.
@rainstormy/presets-typescript/dts+js Generates js and d.ts files.
@rainstormy/presets-typescript/dts Generates d.ts files only.

You can override the predefined settings by specifying the desired options like compilerOptions and include as usual.

For example:

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "extends": [
    "@rainstormy/presets-typescript/base",
    "@rainstormy/presets-typescript/es2023",
    "@rainstormy/presets-typescript/dts+js"
  ],
  "compilerOptions": {
    "baseUrl": "./",
    "incremental": true,
    "noEmitOnError": false,
    "outDir": "dist",
    "sourceMap": true
  },
  "include": ["./src/**/*.ts", "./*.config.js", "./*.config.ts"]
}

Eject from the preset

Copy the relevant parts of the preset source files and insert them directly into the tsconfig.json file. Make adjustments as needed.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •