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
Currently when referring to modules I think that you must use relative paths.
For complex structures it's not convenient for example, say we have the following project structure.
R
|-- A
| |
| `-- a.ts
|-- B
| |
| `-- b.ts
|
|-- c.ts
|
`-- tsconfig.json
Now let's say that module B depends on A so currently we would have to use relative paths like so:
// b.ts
import {A} from "../A/a.ts"
export class B {
}
I gave simplistic example but it can easily turn into more complex structure if I was nesting it a bit more.
What I would like to do instead is as follow:
// b.ts
import {A} from "./A/a.ts"
export class B {
}
Basically what I'm suggesting is to resolve the dependency from the root where the root can either be specified to the compiler or otherwise starts from the tsconfig.json file.
Maybe you can borrow the symbol from ASP.NET where they use tilde to refer to the application root like so:
// b.ts
import {A} from "~/A/a.ts"
export class B {
}
Resolving the dependencies from the root feels more robust and reads a lot better when dealing with nested dependencies.
The text was updated successfully, but these errors were encountered:
Currently when referring to modules I think that you must use relative paths.
For complex structures it's not convenient for example, say we have the following project structure.
Now let's say that module B depends on A so currently we would have to use relative paths like so:
I gave simplistic example but it can easily turn into more complex structure if I was nesting it a bit more.
What I would like to do instead is as follow:
Basically what I'm suggesting is to resolve the dependency from the root where the root can either be specified to the compiler or otherwise starts from the tsconfig.json file.
Maybe you can borrow the symbol from ASP.NET where they use tilde to refer to the application root like so:
Resolving the dependencies from the root feels more robust and reads a lot better when dealing with nested dependencies.
The text was updated successfully, but these errors were encountered: