aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/client/atoms
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-15 17:09:51 +0900
committernsfisis <nsfisis@gmail.com>2026-02-15 17:11:00 +0900
commit95bb8c70a98fabae2a60b251489a59065b2978d1 (patch)
treea145f686cc2d84f49979ea97b9054413f9e58306 /src/client/atoms
parent897f22233810919ba01608bffbfa69f2bb926388 (diff)
downloadkioku-95bb8c70a98fabae2a60b251489a59065b2978d1.tar.gz
kioku-95bb8c70a98fabae2a60b251489a59065b2978d1.tar.zst
kioku-95bb8c70a98fabae2a60b251489a59065b2978d1.zip
fix(types): use CardStateType instead of number for card state fields
Card and StudyCard interfaces used generic number for state, causing type errors when indexing Record<CardStateType, ...> maps. Also adds missing FSRS fields to client Card interface to match API response. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/client/atoms')
-rw-r--r--src/client/atoms/cards.ts10
-rw-r--r--src/client/atoms/study.ts3
2 files changed, 11 insertions, 2 deletions
diff --git a/src/client/atoms/cards.ts b/src/client/atoms/cards.ts
index 225d78c..4a6e72e 100644
--- a/src/client/atoms/cards.ts
+++ b/src/client/atoms/cards.ts
@@ -1,6 +1,7 @@
import { atomFamily } from "jotai-family";
import { atomWithSuspenseQuery } from "jotai-tanstack-query";
import { apiClient } from "../api/client";
+import type { CardStateType } from "../db";
export interface Card {
id: string;
@@ -9,12 +10,19 @@ export interface Card {
isReversed: boolean;
front: string;
back: string;
- state: number;
+ state: CardStateType;
due: string;
+ stability: number;
+ difficulty: number;
+ elapsedDays: number;
+ scheduledDays: number;
reps: number;
lapses: number;
+ lastReview: string | null;
createdAt: string;
updatedAt: string;
+ deletedAt: string | null;
+ syncVersion: number;
}
// =====================
diff --git a/src/client/atoms/study.ts b/src/client/atoms/study.ts
index fca17b7..73966fd 100644
--- a/src/client/atoms/study.ts
+++ b/src/client/atoms/study.ts
@@ -2,6 +2,7 @@ import { atomFamily } from "jotai-family";
import { atomWithSuspenseQuery } from "jotai-tanstack-query";
import { getStartOfStudyDayBoundary } from "../../shared/date";
import { apiClient } from "../api/client";
+import type { CardStateType } from "../db";
import { createSeededRandom, shuffle } from "../utils/random";
export interface StudyCard {
@@ -11,7 +12,7 @@ export interface StudyCard {
isReversed: boolean;
front: string;
back: string;
- state: number;
+ state: CardStateType;
due: string;
stability: number;
difficulty: number;