# 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: ```json { "$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": false, "declaration": true, "baseUrl": ".", "paths": { "@stock-bot/*": ["libs/*/src"] } }, "exclude": [ "node_modules", "dist" ] } ``` ## Template Configurations We provide two template configurations: 1. `tsconfig.app.json` - For application projects: ```json { "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: ```json { "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: ```json { "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: 1. **Trading Dashboard (Angular)**: Uses an extended configuration structure with separate files for app and testing. 2. **Projects with TypeScript imports from extensions**: These projects set `"allowImportingTsExtensions": true` and `"noEmit": true`.