2.8 KiB
TypeScript Configuration Structure
This document explains the TypeScript configuration structure used in the Stock Bot trading platform.
Root Configuration
The root tsconfig.json at the project root establishes common settings for all projects in the monorepo:
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"sourceMap": true,
"declaration": true,
"baseUrl": ".",
"paths": {
"@stock-bot/*": ["libs/*/src"]
}
},
"exclude": [
"node_modules",
"dist"
]
}
Template Configurations
We provide two template configurations:
tsconfig.lib.json- For library projects:
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"declaration": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
}
tsconfig.app.json- For application projects:
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["bun-types"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
Project-Specific Configurations
Each project in the monorepo extends from the root configuration and adds its own specific settings:
Library Projects
Library projects extend the root configuration with a relative path:
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"declaration": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
}
Application Projects
Application projects also extend the root configuration with a relative path:
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["bun-types"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
Special Configurations
Some projects have special needs:
-
Trading Dashboard (Angular): Uses an extended configuration structure with separate files for app and testing.
-
Projects with TypeScript imports from extensions: These projects set
"allowImportingTsExtensions": trueand"noEmit": true.