I have a webpack config where I add alias paths:
webpack.config.js
...
alias: {
'@src': paths.src,
'@types': resolve(paths.src, 'types'),
'@assets': resolve(paths.src, 'assets'),
'@components': resolve(paths.src, 'presentation/components'),
},
...
tsconfig.json
"paths": {
"@src/*": ["src/*"],
"@types/*": ["src/types/*"],
"@assets/*": ["src/assets/*"],
"@components/*": ["src/presentation/components/*"]
}
...
All work fine using then like this
import Sidebar from '@components/sidebar';
But for some reason @types
does not work:
import type { Podcast } from '@types/podcasts';
I tried to restart vscode, remove type
from the import and nothing, there’s not a problem with the types themselves as this also works
import type { Podcast } from '@src/types/podcasts';
But I cannot understand why @types
does not work