-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[Bug]: slot API is broken on react v18 #29578
Comments
So basically while investigating our slot API to ensure compatibility with React v18, it turns out that our major flaws in the types revolves around the
our Here's also another problems that we fail to address at the moment:
|
There are 3 main problems right now on the slot signature:
We could consider as an extra problem but not directly related to the slot signature:
|
I've run into this issue as well when using the slot API. Is there any guidance for temporary workarounds apart from downgrading to React 17? |
Sadly there's no workaround at the moment @rgylesbedford, we'll be providing a proper fix once the issues here highlighted have been properly discussed! I'll keep this issue posted on this topic |
Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes. Still require assistance? Please, create a new issue with up-to date details. |
While investigating this I created a repro repo that may help. In the provided repo, open Test.ts and Test2.ts. After initialization you will see red squiggles saying, "Type 'x' does not satisfy the constraint 'SlotPropsRecord'." Note that this repo has a tsconfig "lib" value of es2020. If changed to "es5" the type error goes away. However, look at the difference in how TypeScript is seeing the types in Test2.ts when hovering over menuListWapper: 'any' is hiding the issue. I've found that a lib value of es2015 or greater (or even just es2015.iterable) will cause the issue to manifest. |
Thanks for the investigations, this will help mapping the problem even further. Here's another issue linked to this one also #31482 |
Seems like this solution #29865 isn't enough for React 18. It's still breaking due to not properly removing the |
Library
React Components / v9 (@fluentui/react-components)
Bug Description
Actual Behavior
Currently the slot API types are not compatible with react v18 types provided by
@types/react
, many components are breaking due to incompatibility with types that weren't detect previously.For example, the
ImageSlot
types does not satisfiesSlotPropsRecord
which is a requirement forImageProps
:In this case the main reason is the assumption of the requirement of a
children
attribute which is well defined asReact.ReactNode
, meanwhileImageProps
actually required children to benever
Expected Behavior
No errors on v18 for the slot API.
The text was updated successfully, but these errors were encountered: