mirror of https://github.com/portainer/portainer
19 lines
455 B
TypeScript
19 lines
455 B
TypeScript
|
import { FormikErrors } from 'formik';
|
||
|
|
||
|
export function isErrorType<T>(
|
||
|
error: string | FormikErrors<T> | undefined
|
||
|
): error is FormikErrors<T> {
|
||
|
return error !== undefined && typeof error !== 'string';
|
||
|
}
|
||
|
|
||
|
export function isArrayErrorType<T>(
|
||
|
error:
|
||
|
| string[]
|
||
|
| FormikErrors<T>[]
|
||
|
| string
|
||
|
| undefined
|
||
|
| (FormikErrors<T> | undefined)[]
|
||
|
): error is FormikErrors<T>[] {
|
||
|
return error !== undefined && typeof error !== 'string';
|
||
|
}
|