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 usingtsc
to transpile code for an apptsc/library
: if you are usingtsc
to transpile code for a librarytsc/library-monorepo
: if you are usingtsc
to transpile code for a mono-repo