-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type error when upgrading from 11.5 to 11.5.1 with skipLibCheck: false and using RN 0.70 #1351
Comments
@AugustinLF not sure I understand the issue here. What is the difference between the old way and the new way we import |
I have the same error. I think it's related to the update of react native on RNTL side and the fact that types are included in react native repo from version 0.71. It looks like it's looking for types within react native package but can't find them if they are in a separate package, which must be the case since @AugustinLF 's version of RN is 70.6. This commit happened during v11.5.0 and 11.5.1 2561380, I think it caused this issue. |
@pierrezimmermannbam @AugustinLF do you think this issue is resulting from our code or RN incorporating types itself? Our deps/peer deps are pretty slim and flexible: |
In RN 0.70, you get the types from The solution IMO is to inline the type. Either it can be done through the compiler (i.e. keep writing |
I am confused here, could you do this diagram. My understanding is that our types exports are passthrough to RN types whether they are defined in import type { AccessibilityState } from 'react-native' So it would make sense for the types to reflect the types from user's React Native version rather than whatever concrete version for RN types we choose. |
It seems that our Before (11.5.0) - getAllByRole: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("react-native").AccessibilityState & { After (11.5.1) - getAllByRole: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("react-native/types").AccessibilityState & { So for external |
I've done using our basic examples app, which uses Expo 47 / React Native 0.70.5. When I upgrade RNTL to 11.5.2 it runs tests fine, with and without @AugustinLF is this error occurring for you under regular Jest or TS Jest? |
Yep that's exactly the problem/difference.
I've reproduced the error by simply running |
Even without enabling skipLibCheck the resolved type of |
@AugustinLF @pierrezimmermannbam do you have any suggestion how we could solve it? E.g. would importing |
I've did a simple experiment on basic example by reverting RNTL to 11.5.0 (which used the
Then I've run
I wonder how practical |
Yep, that's part of the reasons why we recently flipped the config to
It's indeed not ideal, but in our case we managed to fix all our other errors. Bumping RNTL to 11.5.1 does bring those additional error.
I don't know, I'm not sure how the output is created, and I don't know if ts would still go for the And if that doesn't work, we can redeclare the types ourselves. |
I don't think importing It's also not a very important issue so both these solutions seem overkill. Surely someone else must have experienced this issue, I'll ask on the React Native repo what is the recommended approach |
Yeah I've tried playing with importing the type, it was a bit messy to test with the way symlinks work. I honestly feel that redeclaring |
@AugustinLF I wonder if re-declaring If this is the case, then we could duplicate the declaration locally, as the type seems to be stable, and rather should not change in the future. |
@AugustinLF pls take a look at #1355 |
Released in v12.0.0 RC 2. This fix will be backported to v11 version when verified that it resolves the issue in v12. |
Released in stable branch as v11.5.3. |
Describe the bug
While trying to upgrade to the RC (anyone could link me the thread where we were discussing the RC, I can't find it anymore), I realised I missed some minors updates, and found breaking types between
11.5.0
and11.5.1
.All errors are regarding the way the import of
AccessibilityState
is done as part of our build output.Steps to Reproduce
Simply create a repo with RN@0.70 and a version of RNTL>=11.5.1, make sure to have
skipLibCheck: false
in thecompilerOptions
of your tsconfig and run typescript.Versions
The text was updated successfully, but these errors were encountered: