berry icon indicating copy to clipboard operation
berry copied to clipboard

[Bug?]: unable to use different typescript versions for sdk in monorepo with yarn PnP

Open WoodenPC opened this issue 1 year ago • 5 comments

Self-service

  • [ ] I'd be willing to implement a fix

Describe the bug

Hi, i have monorepo, and trying to switch from node_modules linker to pnp. I read migration guide and use yarn dlx @yarnpkg/sdks vscode. However, packages in my monorepo have different typescript versions and i cannot specify that typescript versions in vs code IDE. It sees only root package.json typescript version. How can I achieve what I wrote about ?

To reproduce

Environment

System: OS windows 10, node 18.18.2

Additional context

No response

WoodenPC avatar Oct 15 '24 13:10 WoodenPC

VSCode can only use one TS version per window. See https://github.com/microsoft/vscode/issues/81205

So even if we can generate multiple SDKs for different versions of TypeScript, you can only pick one for VSCode to use

Not sure about if other IDEs can use multiple TS versions

clemyan avatar Oct 16 '24 11:10 clemyan

@clemyan is there an example of how to generate how to generate multiple sdk for workspaces ? Or this feature does not exist yet ?

WoodenPC avatar Oct 19 '24 21:10 WoodenPC

Not supported directly at the moment.

If you really need you can do that manually -- save the SDK, change the root dependency, and re-generate.

clemyan avatar Oct 21 '24 05:10 clemyan

I'm also working on a project that uses multiple different versions of typescript. They use multiple code-workspace files that override the typescript.tsdk setting.

@clemyan could you explain the work-around please? I would like to set up yarn pnp in a way where different code-workspace files can select different typescript sdk versions. But, when I generate yarn sdks, all it changes is one line in the package.json file, specifying the version of the package itself. So it's probably just loading whatever version of typescript is specified in my root package.json file. Is there a way to get yarn typescript sdks to pick up different typescript versions in the same project?

nickretallack avatar Dec 05 '25 02:12 nickretallack