diff --git a/src/use-replicant.ts b/src/use-replicant.ts index b28b093..86050e3 100644 --- a/src/use-replicant.ts +++ b/src/use-replicant.ts @@ -3,7 +3,7 @@ import { klona as clone } from "klona/json"; type JsonValue = boolean | number | string | null; -type Json = JsonValue | JsonValue[] | { [key: string]: Json }; +type Json = JsonValue | JsonValue[] | { [key: string]: Json } | Json[]; export type UseReplicantOptions = { defaultValue?: T; diff --git a/tests/use-replicant.spec.tsx b/tests/use-replicant.spec.tsx index 6a28933..ef5ecbe 100644 --- a/tests/use-replicant.spec.tsx +++ b/tests/use-replicant.spec.tsx @@ -72,10 +72,16 @@ interface RunnerNameProps { prefix?: string; } +type RunnerNameReplicant = { + runner: { + name: string; + }; +}; + const RunnerName: React.FC = (props) => { const { prefix } = props; const repName = `${prefix ?? "default"}:currentRun`; - const [currentRun] = useReplicant(repName, { + const [currentRun] = useReplicant(repName, { defaultValue: { runner: { name: "foo" } }, }); if (!currentRun) {