Code updates required for React 18
The FC interface in React versions before 18 provided an implicit children field (ReactNode type) that we leverage quite a bit in our code. In 18, this field was removed, so updating will cause breaking changes in our existing code in both elements and elements-core. There are multiple ways to update the existing code to accommodate this change, several of which are outlined here:
https://stackoverflow.com/questions/71788254/react-18-typescript-children-fc
Example of the type errors we receive if updating to 18 without making code changes:
../packages/elements-core/src/components/Docs/Docs.tsx:137:10 - error TS2322: Type '{ children: Element; document: unknown; resolver: ReferenceResolver | undefined; }' is not assignable to type 'IntrinsicAttributes & InlineRefResolverProviderProps'. Property 'children' does not exist on type 'IntrinsicAttributes & InlineRefResolverProviderProps'.
137 <InlineRefResolverProvider document={parsedNode.data} resolver={refResolver}> ~~~~~~~~~~~~~~~~~~~~~~~~~
../packages/elements-core/src/components/Docs/HttpOperation/Body.tsx:42:8 - error TS2322: Type '{ children: false | Element; title: string; id: string; }' is not assignable to type 'IntrinsicAttributes & ISectionTitle'. Property 'children' does not exist on type 'IntrinsicAttributes & ISectionTitle'.
42 <SectionSubtitle title="Body" id="request-body"> ~~~~~~~~~~~~~~~
Lets use this as an opportunity to determine a code update path required for new versions of React as this will also impact other stoplight repos when they attempt to use version 18+ of React.
Hey team! Please add your planning poker estimate with ZenHub @Amjcraft @kaylachun @mallachari @mmiask @Nezteb @dotslashderek
Document how we did this for other places that we might want to update to react 18
Moving this guy back for now. Had quite a few issues with the update. Feel free to ping me if you pick up I did get pretty far into the process and will be continuing to play with it in my free time.
Is this something that will see a path forward sometime? It's a bit bizarre to see a repository still referring solely ^16.8 and ^17.