-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Demo product refactor to typescript #4592
Demo product refactor to typescript #4592
Conversation
import { linkToRecord, Identifier } from 'ra-core'; | ||
import { Product } from '../types'; | ||
|
||
enum Width { |
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.
No, use the type exported by Material-ui for this one
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.
Done
if (width === 'xs') return 2; | ||
if (width === 'sm') return 3; | ||
if (width === 'md') return 4; | ||
if (width === 'lg') return 5; | ||
return 6; | ||
}; | ||
|
||
const times = (nbChildren, fn) => | ||
const times = (nbChildren: number, fn: TimesCallback) => |
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.
We really don't need a named type for the second argument.
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.
Done
} | ||
|
||
interface Props extends GridListProps { | ||
loaded: boolean; |
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.
No, there are way more props injected to GridList
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.
Done
loaded ? <LoadedGridList {...props} /> : <LoadingGridList {...props} />; | ||
|
||
export default withWidth()(GridList); | ||
export default withWidth()(GridList as any); |
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.
Not good. If you have to use any, try to look for an alternative solution. For instance, not using withWidth
, but the new hooks provided by material-ui.
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.
Done
I need a little help, I'm facing an issue like this: On demo/src/products/GridList.tsx:92, I tried the below solutions but didn't work: Can you direct me in the right path? |
I believe it was a bug of material-ui which should be fixed in 4.9.13 mui/material-ui@701e3ad, which allows @fzaninotto would react-admin consider upgrading |
Thank you @josephktcheung for bringing this up. |
Could you please rebase on |
Hello, @developerium are you still working on this? |
Hi @MohammedFaragallah |
The demo is now entirely migrated to TypeScript. |
Hi Guys
I want to contribute to the refactoring demo app to typescript.
I want to refactor
examples/demo/src/products
folder. Please tell me if someone else is already working on it.Stay safe