From b12b813bdefeba75f752a1635a0573f39248384e Mon Sep 17 00:00:00 2001 From: Kar Rui Lau Date: Wed, 14 Jul 2021 13:06:41 +0800 Subject: [PATCH] feat: correctly type FormFeedbackDto --- shared/types/form/form_feedback.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/shared/types/form/form_feedback.ts b/shared/types/form/form_feedback.ts index cbe70feee2..840e4ca201 100644 --- a/shared/types/form/form_feedback.ts +++ b/shared/types/form/form_feedback.ts @@ -1,3 +1,4 @@ +import { Merge } from 'type-fest' import { DateString } from '../generic' import { FormDto } from './form' @@ -14,10 +15,15 @@ export type FormFeedbackBase = { rating: number comment?: string formId: FormDto['_id'] - created?: DateString - lastModified?: DateString + created?: Date + lastModified?: Date } -export type FormFeedbackDto = FormFeedbackBase + +// Convert to serialized version. +export type FormFeedbackDto = Merge< + FormFeedbackBase, + { created?: DateString; lastModified?: DateString } +> export type ProcessedFeedbackMeta = { index: number