fix Serialized type
This commit is contained in:
parent
ab7a8a2dae
commit
746770ac3b
|
@ -47,6 +47,7 @@ export class WebhookService implements OnApplicationShutdown {
|
||||||
this.webhooks.push({
|
this.webhooks.push({
|
||||||
...body,
|
...body,
|
||||||
createdAt: new Date(body.createdAt),
|
createdAt: new Date(body.createdAt),
|
||||||
|
latestSentAt: body.latestSentAt ? new Date(body.latestSentAt) : null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -57,11 +58,13 @@ export class WebhookService implements OnApplicationShutdown {
|
||||||
this.webhooks[i] = {
|
this.webhooks[i] = {
|
||||||
...body,
|
...body,
|
||||||
createdAt: new Date(body.createdAt),
|
createdAt: new Date(body.createdAt),
|
||||||
|
latestSentAt: body.latestSentAt ? new Date(body.latestSentAt) : null,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
this.webhooks.push({
|
this.webhooks.push({
|
||||||
...body,
|
...body,
|
||||||
createdAt: new Date(body.createdAt),
|
createdAt: new Date(body.createdAt),
|
||||||
|
latestSentAt: body.latestSentAt ? new Date(body.latestSentAt) : null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -178,7 +178,14 @@ type EventUnionFromDictionary<
|
||||||
|
|
||||||
// redis通すとDateのインスタンスはstringに変換されるので
|
// redis通すとDateのインスタンスはstringに変換されるので
|
||||||
type Serialized<T> = {
|
type Serialized<T> = {
|
||||||
[K in keyof T]: T[K] extends Date ? string : T[K] extends Record<string, any> ? Serialized<T[K]> : T[K];
|
[K in keyof T]:
|
||||||
|
T[K] extends Date
|
||||||
|
? string
|
||||||
|
: T[K] extends (Date | null)
|
||||||
|
? (string | null)
|
||||||
|
: T[K] extends Record<string, any>
|
||||||
|
? Serialized<T[K]>
|
||||||
|
: T[K];
|
||||||
};
|
};
|
||||||
|
|
||||||
type SerializedAll<T> = {
|
type SerializedAll<T> = {
|
||||||
|
|
Loading…
Reference in New Issue