Please see: https://material-ui.com/api/slide/
The docs say the direction prop has a default value of "down", but if you omit it from real code, the type information will complain saying you didn't specify the direction prop.
Either the doc or the type info is wrong.
| Tech | Version |
| ----------- | ------- |
| Material-UI | v4.9.5 |
| React | |
| Browser | |
| TypeScript | |
| etc. | |
Please provide a full reproduction test case. This would help a lot 馃懛 .
A live example would be perfect. This codesandbox.io template _may_ be a good starting point. Thank you!
Looking at the source, it seems about right
Do you want to take care of the problem? :)
@wmitsuda I believe the fix would look like this:
diff --git a/packages/material-ui/src/Slide/Slide.d.ts b/packages/material-ui/src/Slide/Slide.d.ts
index 77efeeb8d..6132d95e1 100644
--- a/packages/material-ui/src/Slide/Slide.d.ts
+++ b/packages/material-ui/src/Slide/Slide.d.ts
@@ -3,7 +3,7 @@ import { Theme } from '../styles/createMuiTheme';
import { TransitionProps } from '../transitions/transition';
export interface SlideProps extends TransitionProps {
- direction: 'left' | 'right' | 'up' | 'down';
+ direction?: 'left' | 'right' | 'up' | 'down';
ref?: React.Ref<unknown>;
theme?: Theme;
}
@oliviertassinari were you able to reproduce this problem? I'm willing to take care of that, but I have not been able to reproduce it.
I haven't tried to reproduce it. I have only looked at the source that looked wrong.
:thinking: @wmitsuda could you provide more details?
@belgamo if you go to this slide example at Material-UI doc and remove
direction="up", Typescript will throw an error. look here at codesandbox
What @oliviertassinari said solves the problem.
@wmitsuda I believe the fix would look like this:
I can create a PR for this issue. I'm looking to get more involved in the open source community, and love material-ui; would love to give back to the community :)
PR for the issue:
https://github.com/mui-org/material-ui/pull/20338