-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[material-ui] Remove few more React.ReactElement<any> types #44290
Merged
Merged
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
50bc79b
remove any types
sai6855 46d1bc0
fix type
sai6855 aa8a297
fix types
sai6855 3d50f18
fix joy theme builder type
sai6855 70a84b0
fix slider value label types
sai6855 7760be7
fix focus trap
sai6855 1394918
Merge branch 'master' into repalce-unknown-with-any
sai6855 112cb6b
fix types
sai6855 9ee8ebf
fix types
sai6855 4c25e9f
fix types
sai6855 7aec3b3
undo
sai6855 a33544a
pnpm prettier
sai6855 49e9f80
fix
sai6855 f22931c
Merge branch 'master' into repalce-unknown-with-any
sai6855 451e23d
fix serverstyles
sai6855 188a956
fix springmodal
sai6855 59cf800
Merge branch 'master' into repalce-unknown-with-any
sai6855 6857da5
revert clickaway listerner
sai6855 d73a827
Merge branch 'repalce-unknown-with-any' of https://github.com/sai6855…
sai6855 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ declare class ServerStyleSheets { | |
constructor(options?: object); | ||
collect(children: React.ReactNode, options?: object): React.ReactElement<StylesProviderProps>; | ||
toString(): string; | ||
getStyleElement(props?: object): React.ReactElement<any>; | ||
getStyleElement(props?: object): React.JSX.Element; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
export default ServerStyleSheets; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think the change of these should be
Why
React.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.
Typescript is throwing error in below line, if
React.ReactElement<unknown>
is used as if doesn't haveonClick
type, hence i went withReact.JSX.Element
material-ui/docs/data/material/components/modal/SpringModal.tsx
Line 45 in 506ea4c
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.
Then we should do
React.ReactElement<{ onClick: React.MouseEventHandler}>
, because we require the children to support this prop.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.
Ahhh, i had posted reason in above comment why i didn't went with
React.ReactElement<{ onClick: React.MouseEventHandler}>
somehow it didn't get saved.Anyway, if i went with
React.ReactElement<{onClick?:React.MouseEventHandler}>
ts throwing below error here (on line 79)material-ui/docs/data/material/components/modal/SpringModal.tsx
Lines 77 to 81 in 506ea4c
Types of property 'props' are incompatible. Type 'unknown' is not assignable to type '{ onClick?: MouseEventHandler<Element> | undefined; }'.
I wasn't sure how to fix above error hence went with
React.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.
Ok, at this point, I think it's better to keep
React.ReactElement<any>
in this file (which is virtually the same as havingReact.JSX.Element
), so let's go withReact.ReactElement<any>
to make it explicit.