You can make it much better
I use Typescript all the time and in my tsconfig I set my paths
"paths": { "@core/*": ["src/core/*"], "@types/*": ["src/core/types/*"], "@config/*": ["src/core/config/*"], "@models/*": ["src/models/*"], "@middleware/*": ["src/middleware/*"], "@controllers/*": ["src/controllers/*"] }
but in my application i have to use tsconfig-paths package
tsconfig-paths package
so if i want to import files from controllers i do
import { something} from "@controllers/"
resources npmjs.com/package/tsconfig-paths typescriptlang.org/docs/handbook/m... stackoverflow.com/questions/432817...
correct me if I missed something
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can make it much better
I use Typescript all the time and in my tsconfig I set my paths
but in my application i have to use
tsconfig-paths package
so if i want to import files from controllers i do
resources
npmjs.com/package/tsconfig-paths
typescriptlang.org/docs/handbook/m...
stackoverflow.com/questions/432817...
correct me if I missed something