-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
type fixes for React 18 #20575
type fixes for React 18 #20575
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
eed7d3f
to
dba09cb
Compare
Uffizzi Preview |
dba09cb
to
ec770f7
Compare
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
ec770f7
to
0296f27
Compare
Alright, changesets added for all changes that aren't just internal types, this should be ready to go now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Some comments & questions out of curiosity :)
@@ -249,7 +249,7 @@ export interface DependencyGraphProps<NodeData, EdgeData> | |||
acyclicer?: 'greedy'; | |||
align?: DependencyGraphTypes.Alignment; | |||
curve?: 'curveStepBefore' | 'curveMonotoneX'; | |||
defs?: SVGDefsElement | SVGDefsElement[]; | |||
defs?: JSX.Element | JSX.Element[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering a bit about this as it seems to make a specific type more general. Did you use this to prevent a ... cannot be used as a JSX component
error? Saw this comment, which might be helpful: software-mansion/react-native-svg#1741 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah SVGDefsElement
is just a wildly wrong type here, it's an actual DOM element, which you can't use in React in the way that the below code does. You also can't narrow down element types with TypeScript, so JSX.Element
+ docs it is x)
@@ -181,7 +181,9 @@ export const FileExplorer = () => { | |||
} | |||
if (!value) { | |||
return ( | |||
<Alert severity="warning">No code coverage found for ${entity}</Alert> | |||
<Alert severity="warning"> | |||
No code coverage found for {humanizeEntityRef(entity)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL this functions exists 馃帀
{({ results }) => ( | ||
<> | ||
{results.map((result, index) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you maybe explain this change a bit more? A bit confused why the wrapping Fragment is required :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The (resultSet: SearchResultSet) => JSX.Element
type doesn't allow for JSX.Element[]
, so we wrap it in a fragment to return just a single element.
Might be worth changing SearchResultProps
instead though, @camilaibs? 馃榿
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought I'd rather make the type change in a followup, trying to keep actual changes in this one to a minimum 馃槄
return ( | ||
<SearchBarBase | ||
value={query} | ||
onSubmit={handleSubmit} | ||
onChange={handleChange} | ||
onChange={setQuery} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice cleanup! 馃挭
Thank you for contributing to Backstage! The changes in this pull request will be part of the |
馃Ч, couple of fixes to make types work for both React 17 and 18
Work towards #12252
adding changesets once things build 馃槄