#Alias for types
3 messages · Page 1 of 1 (latest)
The knowledge sources don’t mention any restriction on using @types (or types) as an alias key, nor do they list any reserved alias names. They only show generic examples like @components, @assets, @layouts, etc., configured via compilerOptions.paths in tsconfig.json. [Aliases; Import Aliases]
So, based on the docs alone:
- There is no explicit statement that
types/@typesis reserved. - There is no explicit explanation for the error “Cannot import type declaration files.”
- The docs do recommend using
import typefor types and enablingverbatimModuleSyntax, but that’s unrelated to alias naming. [Type Imports; verbatimModuleSyntax change]
Because the error and the specific alias name @types are not covered in the provided sources, I can’t say with confidence whether @types is actually reserved or whether the error is caused by something else (e.g. how .d.ts files are imported).
If you want to stay strictly within what the docs show, you can:
- Use a different alias name (e.g.
@models,@shared-types) incompilerOptions.paths, which is documented and supported. [Aliases] - Ensure you’re importing with
import typewhen you’re only using types. [Type Imports]