refactor: fix types

This commit is contained in:
syuilo 2022-02-13 12:46:52 +09:00
parent 51aad804d6
commit 93cb26e879

View file

@ -266,7 +266,7 @@ export default abstract class Chart<T extends Schema> {
const currentLog = await repository.findOne({ const currentLog = await repository.findOne({
date: Chart.dateToTimestamp(current), date: Chart.dateToTimestamp(current),
...(group ? { group: group } : {}), ...(group ? { group: group } : {}),
}) as RawRecord<T>; }) as RawRecord<T> | undefined;
// ログがあればそれを返して終了 // ログがあればそれを返して終了
if (currentLog != null) { if (currentLog != null) {
@ -306,7 +306,7 @@ export default abstract class Chart<T extends Schema> {
const currentLog = await repository.findOne({ const currentLog = await repository.findOne({
date: date, date: date,
...(group ? { group: group } : {}), ...(group ? { group: group } : {}),
}) as RawRecord<T>; }) as RawRecord<T> | undefined;
// ログがあればそれを返して終了 // ログがあればそれを返して終了
if (currentLog != null) return currentLog; if (currentLog != null) return currentLog;
@ -576,7 +576,7 @@ export default abstract class Chart<T extends Schema> {
order: { order: {
date: -1, date: -1,
}, },
}) as RawRecord<T>; }) as RawRecord<T> | undefined;
if (recentLog) { if (recentLog) {
logs = [recentLog]; logs = [recentLog];
@ -593,7 +593,7 @@ export default abstract class Chart<T extends Schema> {
order: { order: {
date: -1, date: -1,
}, },
}) as RawRecord<T>; }) as RawRecord<T> | undefined;
if (outdatedLog) { if (outdatedLog) {
logs.push(outdatedLog); logs.push(outdatedLog);