From 12ed01e04c845bbf5e7bf4dfe72a431c01f6b9fa Mon Sep 17 00:00:00 2001 From: Julian Hundeloh Date: Mon, 8 Jul 2019 09:45:55 +0200 Subject: [PATCH] fix: add $Omit for lower Typescript versions (#1180) --- src/components/Appbar/AppbarBackAction.tsx | 4 ++-- src/components/HelperText.tsx | 6 +++--- src/components/Menu/Menu.tsx | 4 ++-- src/components/TextInput/types.tsx | 3 ++- src/types.tsx | 3 ++- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/components/Appbar/AppbarBackAction.tsx b/src/components/Appbar/AppbarBackAction.tsx index f985e0e..55b40e8 100644 --- a/src/components/Appbar/AppbarBackAction.tsx +++ b/src/components/Appbar/AppbarBackAction.tsx @@ -8,10 +8,10 @@ import { StyleProp, ViewStyle, } from 'react-native'; - +import { $Omit } from './../../types'; import AppbarAction from './AppbarAction'; -type Props = Omit< +type Props = $Omit< React.ComponentProps & { /** * Custom color for back icon. diff --git a/src/components/HelperText.tsx b/src/components/HelperText.tsx index b588e6f..2a092b3 100644 --- a/src/components/HelperText.tsx +++ b/src/components/HelperText.tsx @@ -9,10 +9,10 @@ import { } from 'react-native'; import AnimatedText from './Typography/AnimatedText'; import { withTheme } from '../core/theming'; -import { Theme } from '../types'; +import { Theme, $Omit } from '../types'; -type Props = Omit< - Omit, 'padding'>, +type Props = $Omit< + $Omit, 'padding'>, 'type' > & { /** diff --git a/src/components/Menu/Menu.tsx b/src/components/Menu/Menu.tsx index 7570374..f1d0aef 100644 --- a/src/components/Menu/Menu.tsx +++ b/src/components/Menu/Menu.tsx @@ -16,7 +16,7 @@ import { } from 'react-native'; import { withTheme } from '../../core/theming'; -import { Theme } from '../../types'; +import { Theme, $Omit } from '../../types'; import Portal from '../Portal/Portal'; import Surface from '../Surface'; // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -54,7 +54,7 @@ type Props = { theme: Theme; }; -type Layout = Omit, 'y'>; +type Layout = $Omit<$Omit, 'y'>; type State = { rendered: boolean; diff --git a/src/components/TextInput/types.tsx b/src/components/TextInput/types.tsx index be470f0..03ed657 100644 --- a/src/components/TextInput/types.tsx +++ b/src/components/TextInput/types.tsx @@ -1,5 +1,6 @@ import { TextInput as NativeTextInput, Animated } from 'react-native'; import { TextInputProps } from './TextInput'; +import { $Omit } from './../../types'; export type RenderProps = { ref: (a: NativeTextInput | null | undefined) => void; @@ -17,7 +18,7 @@ export type RenderProps = { value?: string; adjustsFontSizeToFit?: boolean; }; -type TextInputTypesWithoutMode = Omit; +type TextInputTypesWithoutMode = $Omit; export type State = { labeled: Animated.Value; error: Animated.Value; diff --git a/src/types.tsx b/src/types.tsx index 9a1e638..9f2dc09 100644 --- a/src/types.tsx +++ b/src/types.tsx @@ -44,7 +44,8 @@ export type Theme = { }; }; -export type $RemoveChildren> = Omit< +export type $Omit = Pick>; +export type $RemoveChildren> = $Omit< React.ComponentProps, 'children' >;