tsconfig
@import alias
@import are defined in tsconfig of a project
{ "compilerOptions": { "baseUrl": ".", "paths": { "@/components/*": ["components/*"] } } }
Do not name custom types @types/
@types/ is a global import.
- For example import { AuthKeyT } from '@types/app'means you're trying to import from@typesthat is innode_modules.
Must use alternative names like @customTypes/ or @primitiveTypes.
Importance of baseUrl
The baseUrl determines the root directory of the alias and imports
- This influences how the IDE like VSCodepicks up path changes (e.g. moving file/directory, changing file/directory names)
When import path update of file or directory is not picked up by the IDE properly, adjust this setting
tsconfig import
base tsconfig can be imported onto other tsconfig files
{ "extends": "../../../tsconfig.base.json", "compilerOptions": { "baseUrl": ".", "paths": { "@components/*": ["components/*"] } } }