[x] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
[x] Mention the authors (see Definitions by: in index.d.ts) so they can respond.
Authors: @Tyler-Zhang, @DavidNorena, @FabianMeul
After upgrading the @types/react-native package to 0.63.45 I get issues with the ViewStyle prop being in conflict with the ViewStyle prop defined in the @types/react-native version that @types/react-native-calendars uses.
Type 'import("…/node_modules/@types/react-native/index").StyleProp<import("…/node_modules/@types/react-native/index").ViewStyle>' is not assignable to type 'import("…/node_modules/@types/react-native-calendars/node_modules/@types/react-native/index").StyleProp<import("…/node_modules/@types/react-native-calendars/node_modules/@types/react-native/index").ViewStyle>'.
Type 'ViewStyle' is not assignable to type 'StyleProp<ViewStyle>'.
Type 'import("…/node_modules/@types/react-native/index").ViewStyle' is not assignable to type 'import("…/node_modules/@types/react-native-calendars/node_modules/@types/react-native/index").ViewStyle'.
Types of property 'backgroundColor' are incompatible.
Type 'string | unique symbol | undefined' is not assignable to type 'string | undefined'.
Type 'unique symbol' is not assignable to type 'string | undefined'.
Type 'import("…/@types/react-native/index").ViewStyle' is not assignable to type 'import("…/@types/react-native-calendars/node_modules/@types/react-native/index").ViewStyle'.
The problem is that @types/react-native-calendars defines "@types/react-native": "*" as a dependency. Yarn resolves that wildcard dependency to version 0.60.7 which has a different ViewStyle definition than 0.63.45.
@types/react-native-calendars
package and had problems.I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescriptThat's not the issue@types
package versions do not follow SemVer.Definitions by:
inindex.d.ts
) so they can respond.After upgrading the
@types/react-native
package to0.63.45
I get issues with theViewStyle
prop being in conflict with theViewStyle
prop defined in the@types/react-native
version that@types/react-native-calendars
uses.The problem is that
@types/react-native-calendars
defines"@types/react-native": "*"
as a dependency. Yarn resolves that wildcard dependency to version0.60.7
which has a differentViewStyle
definition than0.63.45
.You could think of this as a Yarn issue. However, it was already addressed in an issue in the Yarn repo (https://github.com/yarnpkg/yarn/issues/6695) and they say that it's not on their end. Instead, they say those
"dependencies"
should be"peerDependencies"
(https://github.com/yarnpkg/yarn/issues/6695#issuecomment-439870884). Unfortunately, there's not even apackage.json
in thereact-native-calendars
types folder where I could make such a change. Idk how this DefinitelyTyped repo works / where those dependencies are being defined and where thepackage.json
is being generated. Apparently, changing"dependencies"
to"peerDependencies"
has been discussed before (https://github.com/DefinitelyTyped/DefinitelyTyped/issues/20290), seemingly without any resolution.I also tried yarn's
"resolutions"
field in thepackage.json
to make sure that only one version of@types/react-native
is installed. But to no avail.So, I'm creating this issue to bring attention to it and because I haven't seen this exact issue in this repo yet.