#Alias for types

3 messages · Page 1 of 1 (latest)

misty jayBOT
#

Hi @tight furnace. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

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 / @types is reserved.
  • There is no explicit explanation for the error “Cannot import type declaration files.”
  • The docs do recommend using import type for types and enabling verbatimModuleSyntax, 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) in compilerOptions.paths, which is documented and supported. [Aliases]
  • Ensure you’re importing with import type when you’re only using types. [Type Imports]
#

Beyond that, the knowledge sources do not provide enough information to definitively answer why that specific alias triggers “Cannot import type declaration files.”

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: