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

Unexpected ts-node/typescript resolution behavior with workspaces #7405

Closed
jfirebaugh opened this issue Jul 15, 2019 · 2 comments
Closed

Unexpected ts-node/typescript resolution behavior with workspaces #7405

jfirebaugh opened this issue Jul 15, 2019 · 2 comments

Comments

@jfirebaugh
Copy link
Contributor

jfirebaugh commented Jul 15, 2019

Do you want to request a feature or report a bug?
Report a bug.

If the current behavior is a bug, please provide the steps to reproduce.
Clone https://github.com/jfirebaugh/yarn-workspaces-vs-ts-node and run the following commands:

yarn install
(cd a && yarn run version)
(cd b && yarn run version)

What is the expected behavior?
In a, yarn run version should report typescript v2.9.2.
In b, yarn run version should report typescript v3.5.3.

What is the current behavior?
In both a and b, yarn run version reports typescript v2.9.2.

ts-node has a peer dependency on typescript, and uses require("typescript") to resolve it. But because with workspaces, ts-node gets hoisted to the top-level node_modules, this will always resolve to the version of typescript that happens to get hoisted, whereas I expect it to resolve to the version that's specified as the peer of the ts-node dependency.

I know I can work around this with nohoist but it seems like I shouldn't have to.

Please mention your node.js, yarn and operating system version.
node.js v10.14.1
yarn 1.17.3
macOS 10.14.5

@jfirebaugh
Copy link
Contributor Author

Oh, I think this might actually be fixed in ts-node 8.

https://github.com/TypeStrong/ts-node/blob/master/src/index.ts#L214-L215

(Hard to immediately tell because ts-node --version no longer prints the typescript version.)

@jfirebaugh
Copy link
Contributor Author

Confirmed.

Sorry for the noise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant