Skip to content

Commit

Permalink
Refactor out ommited props
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonlenz committed Apr 29, 2021
1 parent e68c90c commit c6f4817
Showing 1 changed file with 18 additions and 33 deletions.
51 changes: 18 additions & 33 deletions src/components/grid/Grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,26 @@ export type CustomGridProps<T> = GridComponentProps<
> &
WithCustomGridProps<React.PropsWithChildren<T>>

type omittedProps =
| 'mobile'
| 'tablet'
| 'desktop'
| 'widescreen'
| 'mobileLg'
| 'tabletLg'
| 'desktopLg'
| 'children'
| 'className'
| 'row'
| 'col'
| 'gap'
| 'offset'

export function isCustomProps<T>(
props:
| Omit<
DefaultGridProps,
| 'mobile'
| 'tablet'
| 'desktop'
| 'widescreen'
| 'mobileLg'
| 'tabletLg'
| 'desktopLg'
| 'children'
| 'className'
| 'row'
| 'col'
| 'gap'
| 'offset'
>
| Omit<
CustomGridProps<T>,
| 'mobile'
| 'tablet'
| 'desktop'
| 'widescreen'
| 'mobileLg'
| 'tabletLg'
| 'desktopLg'
| 'children'
| 'className'
| 'row'
| 'col'
| 'gap'
| 'offset'
>
): props is CustomGridProps<T> {
| Omit<DefaultGridProps, omittedProps>
| Omit<CustomGridProps<T>, omittedProps>
): props is Omit<CustomGridProps<T>, omittedProps> {
return 'asCustom' in props
}

Expand Down

0 comments on commit c6f4817

Please sign in to comment.