@import
alias@import
are defined in tsconfig
of a project
{ "compilerOptions": { "baseUrl": ".", "paths": { "@/components/*": ["components/*"] } } }
@types/
@types/
is a global import.
import { AuthKeyT } from '@types/app'
means you're trying to import from @types that is in node_modules
.Must use alternative names like @customTypes/
or @primitiveTypes
.
baseUrl
The baseUrl
determines the root directory of the alias
and imports
VSCode
picks 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
importbase tsconfig
can be imported onto other tsconfig
files
{ "extends": "../../../tsconfig.base.json", "compilerOptions": { "baseUrl": ".", "paths": { "@components/*": ["components/*"] } } }