You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if a combination of both aliasing root and sub-paths is decided, make sure to put inner paths above their outer in tsconfig.ts to receive shorter path priority when auto-importing
Problem
Many imports are relative which leads to the following code:
Solution
Path aliases allow you to specify certain path areas for cleaner imports
{ "compilerOptions:"{ "paths": { "@hooks/*": ["./src/hooks/*"], } } }Note
@is arbitrary. Some projects use~Note
you can also alias as follows
{ "compilerOptions:"{ "paths": { "@/*": ["./src/*"], } } }Important
if a combination of both aliasing root and sub-paths is decided, make sure to put inner paths above their outer in
tsconfig.tsto receive shorter path priority when auto-importing