VS Code Import Typescript Error
If you've noticed a strange error saying your import is wrong. Then you delete and retype the EXACT same thing and... wow the error is gone? wtf.
Cannot find module '@/envs' or its corresponding type declarations.
This is because the typescript built into your code editor needs a kick in the pants.
tsconfig.json
I've set up custom paths in my tsconfig.json
files to easily import scripts into each other.
...
"baseUrl": ".",
"paths": {
"@styles/*": [
"src/styles/*"
],
"@components/*": [
"src/components/*"
],
"@/*": [
"./*"
]
}
...
Pallet command
In your code editor command pallet this is how you refresh typescript and make all good with the world
> TypeScript: Restart TS server