Skip to content

Commit

Permalink
Remove the default variant style, fix type issue (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Daniel authored and cliedeman committed Aug 21, 2019
1 parent 4609fb2 commit 41820fb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import MuiTextField, {
import { FieldProps, getIn } from 'formik';

export type TextFieldProps = FieldProps &
Omit<MuiTextFieldProps, 'error' | 'name' | 'onChange' | 'value'>;
Omit<MuiTextFieldProps, 'error' | 'name' | 'onChange' | 'value'> & {
// Fix for the type for variant which is using union
// https://stackoverflow.com/questions/55664421
variant: 'standard' | 'filled' | 'outlined' | undefined;
};

export const fieldToTextField = ({
field,
form,
variant = 'standard',
disabled,
...props
}: TextFieldProps): MuiTextFieldProps => {
Expand All @@ -23,7 +26,6 @@ export const fieldToTextField = ({
return {
...props,
...field,
variant,
error: showError,
helperText: showError ? fieldError : props.helperText,
disabled: disabled != undefined ? disabled : isSubmitting,
Expand Down

0 comments on commit 41820fb

Please # to comment.