Skip to content

Commit

Permalink
fix: add $Omit for lower Typescript versions (callstack#1180)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaulz authored and Trancever committed Jul 8, 2019
1 parent ae6258c commit 12ed01e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/Appbar/AppbarBackAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/components/HelperText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
> & {
/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/components/TextInput/types.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
>;
Expand Down

0 comments on commit 12ed01e

Please sign in to comment.