Skip to content
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

[Grid] Remove unnecessary type exports #26187

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/src/pages/guides/migration-v4/migration-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,24 @@ As the core components use emotion as a styled engine, the props used by emotion
});
```

- The auxiliary types `GridDirection`, `GridSpacing`, `GridWrap` and `GridSize` are not exported anymore. Instead, get them from `GridProps`.

```diff
-import { GridDirection, GridSpacing, GridWrap, GridSize } from '@material-ui/core/Grid';
+import { GridProps } from '@material-ui/core/Grid';

interface Props {
- direction: GridDirection;
- spacing: GridSpacing;
- wrap: GridWrap;
- size: GridSize;
+ direction: GridProps['direction'];
+ spacing: GridProps['spacing'];
+ wrap: GridProps['wrap'];
+ size: GridProps['xs'] & (string | number);
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved
}
```

### GridList

- Rename the `GridList` components to `ImageList` to align with the current Material Design naming.
Expand Down
8 changes: 4 additions & 4 deletions packages/material-ui/src/Grid/Grid.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { SxProps, SystemProps } from '@material-ui/system';
import { Theme } from '../styles';
import { OverridableComponent, OverrideProps } from '../OverridableComponent';

export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved

export type GridSpacing = number | string;
type GridSpacing = number | string;

export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';

export type GridSize = 'auto' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
type GridSize = 'auto' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;

export type GridClassKey = keyof NonNullable<GridTypeMap['props']['classes']>;

Expand Down