ReadGame型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A game read back: which game it is, and the game itself.
インポート
import type { ReadGame } from "@johnmorrisdotca/toranpu";
定義
type ReadGame = {
[K in CardGameKind]: {
kind: K;
game: GameOf<K>;
};
}[CardGameKind];
例
import { fromJSON, newGame, toJSON } from "@johnmorrisdotca/toranpu";
import type { ReadGame } from "@johnmorrisdotca/toranpu";
const game = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
const value: ReadGame = fromJSON(toJSON("hearts", game))!;
console.log(value.kind);hearts出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。