Open darthtrevino opened 4 years ago
I guess you could try with aliasing it to the normal react types.
"resolutions": {
"@types/react-native": "npm:@types/react@*"
},
Is this a problem in both PnP and node_modules or?
My personal use case is with node_modules, but this affects both linkers. Edit: that workaround did not effectively remove @types/react-native
My personal use case is with node_modules, but this affects both linkers.
Assumed the PnP linker would scope it to just @types/styled-components
but I guess it overwrites the global interfaces
Edit: that workaround did not effectively remove @types/react-native
I didn't write it correctly, updated, try again please
Tried the update, no effect
Do you have a reproduction for that? Setting that resolution and running yarn add @types/react-native
shows that node_modules/@types/react-native
contains the source for @types/react
https://github.com/darthtrevino/yarn-berry-1629
I do see that if I move the "resolutions" field to the top-level monorepo root, then that does what you're suggesting. I'll try that out in my app
I do see that if I move the "resolutions" field to the top-level monorepo root, then that does what you're suggesting
Yes, resolutions only work from the the root package.json
, Yarn also tells you this when you run an install
$ yarn
➤ YN0000: ┌ Validation step
➤ YN0057: │ a: Resolutions field will be ignored
➤ YN0000: └ Completed
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: Done with warnings in 0.16s
lol, derp - I must've missed that
The workaround did work in my projects - it's not the most straightforward of configs, but it lets me use the types I want to use. I'll leave this issue open as a suggestion for more direct approaches to problems like that
Describe the user story
Some important dependencies have malformed dependency lists and bring in transitive packages that can break builds. The example I have in mind is
@types/styled-components
, which brings in@types/react-native
, which clashes with DOM typings built into TypeScript.In Yarn v1, I could add
@types/react-native
to.yarnclean
, and that dependency would not be be installed. This only makes a single repository work though.Describe the solution you'd like
Perhaps there's a way to block dependencies from being included in the current package and downstream dependencies
e.g.
or
Describe the drawbacks of your solution
An extension like this would be yarn-specific, and npm clients would still have that extension drawn into their workspace.
Additional context
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33015