fix: add $Omit for lower Typescript versions (#1180)

This commit is contained in:
Julian Hundeloh
2019-07-08 09:45:55 +02:00
committed by Dawid Urbaniak
parent ae6258cf87
commit 12ed01e04c
5 changed files with 11 additions and 9 deletions

View File

@@ -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<typeof AppbarAction> & {
/**
* Custom color for back icon.

View File

@@ -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<React.ComponentProps<typeof Animated.Text>, 'padding'>,
type Props = $Omit<
$Omit<React.ComponentProps<typeof Animated.Text>, 'padding'>,
'type'
> & {
/**

View File

@@ -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<Omit<LayoutRectangle, 'x'>, 'y'>;
type Layout = $Omit<$Omit<LayoutRectangle, 'x'>, 'y'>;
type State = {
rendered: boolean;

View File

@@ -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<TextInputProps, 'mode'>;
type TextInputTypesWithoutMode = $Omit<TextInputProps, 'mode'>;
export type State = {
labeled: Animated.Value;
error: Animated.Value;

View File

@@ -44,7 +44,8 @@ export type Theme = {
};
};
export type $RemoveChildren<T extends React.ComponentType<any>> = Omit<
export type $Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
export type $RemoveChildren<T extends React.ComponentType<any>> = $Omit<
React.ComponentProps<T>,
'children'
>;