0.1.11 • Published 1 year ago
@12deg/tsconfig v0.1.11
@12deg/tsconfig
A shared TypeScript configuration for consistent and reliable type-checking across projects.
Install
Install the required dependencies:
$ npm i -D @12deg/tsconfigUsage
In the root directory of your project, create or update a tsconfig.json file to extend the base configuration that fits your project type:
For fastify libraries:
{ "extends": "@12deg/tsconfig/fastify.json", "exclude": [ "src/**/__test__/**/*", ], "compilerOptions": { "baseUrl": "./", "outDir": "./dist", }, "include": [ "src/**/*.ts" ], }For fastify apis:
{ "extends": "@12deg/tsconfig/fastify-api.json", }For react apps:
{ "extends": "@12deg/tsconfig/react-app.json", "include": ["src"], }For react libraries:
{ "extends": "@12deg/tsconfig/react.json", "compilerOptions": { "baseUrl": ".", "outDir": "./dist", "paths": { "@/*": ["./src/*"] }, }, "include": ["vite.config.*", "src/**/*", "src/**/*.tsx"], }For vue apps:
{ "extends": "@12deg/tsconfig/vue-app.json", }For vue libraries:
{ "extends": "@12deg/tsconfig/vue.json", "exclude": [ "src/**/__test__/**/*", ], "compilerOptions": { "baseUrl": "./", "outDir": "./dist/src" }, "include": [ "src/**/*", "src/**/*/*.vue" ], }- For general typescript projects:
{ "extends": "@12deg/tsconfig", // add custom options here if needed }
Adding typescript checking scripts
In your package.json, include a script for running typescript checks without emitting compiled files:
{
"scripts": {
"typecheck": "tsc --noEmit -p tsconfig.json --composite false"
}
}Running typescript checks
Use the following command to type-check your code:
npm run typecheck