TypeScript config
npm install typescript @peerigon/configs --save-dev
Then create a tsconfig.json
just for type-checking next to your package.json
:
{
"extends": "@peerigon/configs/typescript"
}
Recommended configuration in your package.json
(using npm-run-all2
):
{
"type": "module",
"scripts": {
"test": "run-p test:*",
"test:types": "tsc"
}
}
In case you're developing a library with a dedicated build process, we recommend to create a separate tsconfig.build.json
:
{
"extends": ["./tsconfig.json", "@peerigon/configs/typescript/lib"],
"include": ["src"],
"exclude": ["src/**/*.test.ts", "src/tests/**/*.ts"]
}
with the following package.json
scripts
:
{
"type": "module",
"scripts": {
"build": "tsc -p tsconfig.build.json",
"test": "run-p test:*",
"test:types": "tsc"
}
}
We export the following tsconfig.json
presets. They can be used by extending @peerigon/configs/<preset-name>
:
typescript
: Recommended base config for all modern TypeScript projectstypescript/lib
: Config for building TS librariestypescript/js-lib
: Config for building JS libraries with JSDoc type annotations.