
I have a yarn workspace set up with folders public and server. I am using TypeScript in VS Code. On any module that doesn't have types pre-installed with the package, I get the error in VS Code:
Cannot find module 'x'
However, the IntelliSense will show x as a suggestion. I have both x and @types/x and it seems like it's no difference if I install @types/x. Thanks
Windows 1909 (Latest)
Visual Studio Code 1.43 (Latest)
TypeScript ^3.8.3 (Latest)
Yarn 2.0.0-rc.30 (Latest)
Also, I tried to find type roots for yarn, but didn't. Could someone please tell me where the type root directry is.
From the docs:
Run the following command, which will generate a new directory called .yarn/sdks:
yarn dlx @yarnpkg/sdks vscode
For safety reason VSCode requires you to explicitly activate the custom TS settings:
Press ctrl+shift+p in a TypeScript file
Choose "Select TypeScript Version"
Pick "Use Workspace Version"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With