refactor: update inline-schema to import accessors

This commit is contained in:
2026-04-15 14:56:48 +08:00
parent 7e98e5e546
commit 09148f5b13
12 changed files with 31 additions and 27 deletions
+2 -2
View File
@@ -6,5 +6,5 @@ type BoopPartTable = readonly {
export type BoopPart = BoopPartTable[number];
declare const data: BoopPartTable;
export default data;
declare function getData(): BoopPartTable;
export default getData;
+2 -1
View File
@@ -1,4 +1,4 @@
import parts from './boopPart.csv';
import getParts from './boopPart.csv';
import {createRegion, moveToRegion, Region} from "@/core/region";
import {createPartsFromTable} from "@/core/part-factory";
import {BoopPart} from "@/samples/boop/types";
@@ -6,6 +6,7 @@ import {BOARD_SIZE} from "@/samples/boop/constants";
import {PlayerType, PieceType, RegionType} from "@/samples/boop/types";
export function createInitialState() {
const parts = getParts();
const pieces = createPartsFromTable(
parts,
(item, index) => `${item.player}-${item.type}-${index + 1}`,