0

Using IntelliJ IDEA to write a webapp in TypeScript, it autocomplete imports from other files of my project like this:

import {Symbol} from '@/components/Symbol';

What is the meaning of the @ here? Where is it documented?

Note that this is when importing files from the same project. Imports from npm packages only use the package name (which may start with a @).

I haven’t found anything about this in TypeScript Module Resolution, and when searching for typescript @ import in Google or SO, it seems the @ character from the query is ignored...

Edit: This is in a Next.js project created with npx create-next-app.

Étienne Miret
  • 6,448
  • 5
  • 24
  • 36
  • Does this answer your question? [What is the meaning of the "at" (@) prefix on npm packages?](https://stackoverflow.com/questions/36667258/what-is-the-meaning-of-the-at-prefix-on-npm-packages) – Omkar76 Jan 21 '23 at 07:10
  • Are you using vite or webpack? – eten Jan 21 '23 at 07:20

2 Answers2

1

If you are using vite or webpack, then your configuration will have a resolve.alias key to alias strings to a path. Vite documentation Webpack documentation

eten
  • 803
  • 3
  • 14
0

This turned out to be a tsconfig path, which was put there by npx create-next-app:

{
  "compilerOptions": {
    "paths": {
      "@/*": ["./src/*"]
    }
  },
}
Étienne Miret
  • 6,448
  • 5
  • 24
  • 36