Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Yarn 3 typescript plugin not pulling in @types for package.json dependencies

$
0
0

I have a react native Typescript application which i have upgraded from yarn 1 to yarn 3. I have followed the migration document on the official docs and have two issues i'm unsure on what i should do. As its react native im not able to use the Pnp approach so i still have node_modules.

I have in my package.json - "packageManager": "yarn@3.2.3"

my .yarnrc.yml

nodeLinker: node-modulesnpmRegistryServer: "https://registry.yarnpkg.com/"npmScopes:    my_company_name:        npmAlwaysAuth: true        npmAuthToken: TOKEN        npmRegistryServer: "company_npm_reg"plugins:     - path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs       spec: "@yarnpkg/plugin-typescript"yarnPath: .yarn/releases/yarn-3.2.3.cjs

Issue One

yarn docs recommend that your gitignore should have

.yarn/*!.yarn/cache!.yarn/patches!.yarn/plugins!.yarn/releases!.yarn/sdks!.yarn/versions

Which will mean the .cache directory will be pushed to github.This has resulted in an warning from github with:"this exceeds GitHub's file size limit of 50.00 MB".

To resolve this i have opted to not submit the .cache directory to my remote github. Editing the .gitignore.

Is this ok?By not submitting the contents of my .cache directory will this mean i am missing out on features/performance boost of yarn 3?

Issue Two

One of the advantages of yarn 3 is the abilty to use Plugins.One plugin yarn recommend for a typescript application is the typescript plugin.

Installed via the command

yarn plugin import typescript

This adds to your .yarnrc.yml file.In theory when i now run my yarn install command, it should pull in the associated @types/ for any packages listed in the package.json.However , for me it is not working.I had previously defined the @types/node and for a bunch of other libs in my package.json. To test this new plugin i have removed those types from my package.json, and ran the yarn install with the plugin being previously installed, yet the @types are not pulled in. I have checked node_modules and they are not there and VSCode is complaining about them being missing.Is there a step/tool I need to add to to make this work?So adding the "@yarnpkg/plugin-typescript" does NOT pull in the @types for my package dependencies.

Any advice would be great!


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>