Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor with TS Paths feature #199

Open
jasonkuhrt opened this issue Dec 18, 2019 · 0 comments
Open

Refactor with TS Paths feature #199

jasonkuhrt opened this issue Dec 18, 2019 · 0 comments
Labels
type/refactor Address tech debt, internal incidental complexity

Comments

@jasonkuhrt
Copy link
Member

Would like to refactor and centralize a libs dir that the rest of the codebase can reference via ~<module-name>. About the feature: https://dev.to/larswaechter/path-aliases-with-typescript-in-nodejs-4353. https://www.typescriptlang.org/docs/handbook/module-resolution.html

This would require TS Config paths config like so:

"compilerOptions": {
  "baseURL": "./src",
  "paths": {
    "~*": ["./lib/*"]
  }
}

Problem is TS does not translate the mapping at build time. Surprisingly.

microsoft/TypeScript#26722

Some tools trying to help in this space listed at:

microsoft/TypeScript#26722

But they are runtime oriented. We would want a build time option, since we're a library and not an app.

One build time option is this Go-based lib https://github.com/joseluisq/go-tspath. Introducing a non-node dep for a small use-case like this though doesn't feel right.

Build our own tool?

@jasonkuhrt jasonkuhrt added type/refactor Address tech debt, internal incidental complexity and removed refactor labels Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/refactor Address tech debt, internal incidental complexity
Projects
None yet
Development

No branches or pull requests

1 participant