Skip to content

Commit

Permalink
fix(Input): CI Building Warning
Browse files Browse the repository at this point in the history
  • Loading branch information
JT501 committed Nov 12, 2020
1 parent fe5b1a6 commit e6bf808
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from 'formik';
import {
FormField,
Input as _Input,
Input as SInput,
InputOnChangeData,
InputProps as _InputProps,
Label,
Expand Down Expand Up @@ -37,7 +37,7 @@ export const Input = (
inputLabel,
...restProps
}: InputProps,
ref: Ref<_Input>,
ref: Ref<SInput>,
) => {
const fieldLabelId = (id && label && `${id}-field-label`) || undefined;
const inputLabelId = (id && inputLabel && `${id}-input-label`) || undefined;
Expand All @@ -61,12 +61,12 @@ export const Input = (
);
};

const errorLabelBefore = (meta: FieldMetaProps<_Input>) =>
const errorLabelBefore = (meta: FieldMetaProps<SInput>) =>
(getErrorConfig(meta, errorPrompt)?.pointing === 'below' ||
getErrorConfig(meta, errorPrompt)?.pointing === 'right') &&
errorLabel(meta);

const errorLabelAfter = (meta: FieldMetaProps<_Input>) =>
const errorLabelAfter = (meta: FieldMetaProps<SInput>) =>
(getErrorConfig(meta, errorPrompt)?.pointing === 'above' ||
getErrorConfig(meta, errorPrompt)?.pointing === 'left') &&
errorLabel(meta);
Expand All @@ -77,7 +77,7 @@ export const Input = (
<FormField error={meta.touched && !!meta.error}>
{fieldLabel}
{errorLabelBefore(meta)}
<_Input
<SInput
id={id}
ref={ref}
name={name}
Expand Down
6 changes: 2 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ export function getErrorConfig<T>(
if (meta.error && meta.touched && errorPrompt) {
if (errorPrompt === true) {
return { content: meta.error, ...defaultErrorConfig };
;
} else {
return { content: meta.error, ...errorPrompt ; };
return { content: meta.error, ...errorPrompt };
}
} else {
return nu;
ll;
return null;
}
}

0 comments on commit e6bf808

Please sign in to comment.