fix: allow null value for number and date (#1472)

This commit is contained in:
Jérémy M
2023-09-06 11:03:12 +02:00
committed by GitHub
parent f332c3bee2
commit cbcb49cd1e
3 changed files with 5 additions and 7 deletions

View File

@ -100,7 +100,7 @@ export type FieldMetadata =
export type FieldTextValue = string; export type FieldTextValue = string;
export type FieldChipValue = string; export type FieldChipValue = string;
export type FieldDateValue = string; export type FieldDateValue = string | null;
export type FieldPhoneValue = string; export type FieldPhoneValue = string;
export type FieldURLValue = string; export type FieldURLValue = string;
export type FieldNumberValue = number | null; export type FieldNumberValue = number | null;

View File

@ -5,8 +5,7 @@ export function isFieldDateValue(
fieldValue: unknown, fieldValue: unknown,
): fieldValue is FieldDateValue { ): fieldValue is FieldDateValue {
return ( return (
fieldValue !== null && fieldValue === null ||
fieldValue !== undefined && (fieldValue !== undefined && typeof fieldValue === 'string')
typeof fieldValue === 'string'
); );
} }

View File

@ -5,8 +5,7 @@ export function isFieldNumberValue(
fieldValue: unknown, fieldValue: unknown,
): fieldValue is FieldNumberValue { ): fieldValue is FieldNumberValue {
return ( return (
fieldValue !== null && fieldValue === null ||
fieldValue !== undefined && (fieldValue !== undefined && typeof fieldValue === 'number')
typeof fieldValue === 'number'
); );
} }