Skip to content

API reference / @backpack/typescript-config

@backpack/typescript-config️ 🛠

This package contains some useful presets for your TypeScript configuration.

Background

The tsconfig.json file can seem a bit scary, with all the different (and sometimes confusing) options. This package makes this easier by providing a preset.

Most of the decisions are based on this TSConfig Cheat Sheet. However, if you encounter a weird default in any of the presets, please raise an issue.

Requirements

You are using TypeScript 5.4 or higher. If that is not the case, you might need to tweak a few settings.

Getting started

First, ensure you have set up Nexus as private registry needed to use Backpack.

Then, install the package using npm:

bash
npm install -D @backpack/typescript-config

Set up your tsconfig.json:

jsonc
{
  "extends": "@backpack/typescript-config/bundler",
  "include": ["**/*.ts"],

  // If you still need to override certain options, you can do so.
  "compilerOptions": {
    // ...
  },
}

List of presets

  • bundler: if you are using a bundler (recommended for most Backpack projects)
  • tsc/app: if you are using tsc to transpile code for an app
  • tsc/library: if you are using tsc to transpile code for a library
  • tsc/library-monorepo: if you are using tsc to transpile code for a mono-repo