Fixed tsconfig.json to include "types" field for better type checking…#1048
Open
Edictor96 wants to merge 4 commits into
Open
Fixed tsconfig.json to include "types" field for better type checking…#1048Edictor96 wants to merge 4 commits into
Edictor96 wants to merge 4 commits into
Conversation
… and editor support.
+ +## Summary + +This change fixes backend `tsconfig.json` so TypeScript can correctly resolve the +internal module aliases used across the backend source code and generate portable +source maps. + +## Changes + +- Updated `compilerOptions.sourceRoot` from a machine-specific path to `/`. + - Before: `D:/vibe/backend/src` + - After: `/` + - This avoids embedding a developer-specific Windows path in generated source + maps and keeps build output portable across machines and environments. + +- Added missing path alias for anomalies: + - `#anomalies/*` -> `./modules/anomalies/*` + - This matches imports that reference the anomalies module through the backend + alias system. + +- Added missing path alias for GenAI: + - `#genAI/*` -> `./modules/genAI/*` + - This keeps TypeScript resolution aligned with the backend package import + alias for the generated AI module. + +- Added the singular setting module alias: + - `#setting/*` -> `./modules/setting/*` + - The actual source folder is `src/modules/setting`, and backend code/package + imports use the singular `#setting` alias. + +- Corrected the plural settings alias: + - `#settings/*` now points to `./modules/setting/*` + - The previous path targeted `./modules/settings/*`, but that folder does not + exist. Keeping the plural alias mapped to the real singular folder preserves + compatibility for any code still importing `#settings/*`. + +## Dependency and alias relationship + +The backend uses package-style internal aliases such as `#root`, `#shared`, +`#courses`, and `#setting` in source imports. TypeScript needs matching +`compilerOptions.paths` entries so the compiler can resolve those imports during +type checking and builds. + +The relevant dependency relationship is: + +- Source imports depend on aliases such as `#setting/*`, `#genAI/*`, and + `#anomalies/*`. +- `tsconfig.json` maps those aliases to real source folders under `src/`. +- `package.json` maps the same aliases to compiled output under `build/`. + +Keeping `tsconfig.json` and `package.json` aligned prevents TypeScript compile +errors while preserving the runtime import behavior after compilation. + +## Express compiler config change + +The compiler config includes: + +```json +"types": ["node", "express"] +``` + +This explicitly loads Node and Express type declarations into the backend +compiler context. The Express entry matters because the backend uses Express +types and middleware-related declarations throughout the server setup. Including +`express` here makes those ambient/request-response types available during +compilation, assuming `@types/express` is installed as declared in +`backend/package.json`. + +## Result + +The backend TypeScript configuration now reflects the actual source directory +layout and the aliases used by the backend codebase.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request makes a minor update to the TypeScript configuration by adding the
ignoreDeprecationsoption to thetsconfig.jsonfile, which helps suppress deprecation warnings for features deprecated up to TypeScript 6.0.… and editor support.