Skip to content

Commit be040b3

Browse files
authored
fix: add object arrays (#274)
1 parent 28610ac commit be040b3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/use-replicant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { klona as clone } from "klona/json";
33

44
type JsonValue = boolean | number | string | null;
55

6-
type Json = JsonValue | JsonValue[] | { [key: string]: Json };
6+
type Json = JsonValue | JsonValue[] | { [key: string]: Json } | Json[];
77

88
export type UseReplicantOptions<T> = {
99
defaultValue?: T;

tests/use-replicant.spec.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,16 @@ interface RunnerNameProps {
7272
prefix?: string;
7373
}
7474

75+
type RunnerNameReplicant = {
76+
runner: {
77+
name: string;
78+
};
79+
};
80+
7581
const RunnerName: React.FC<RunnerNameProps> = (props) => {
7682
const { prefix } = props;
7783
const repName = `${prefix ?? "default"}:currentRun`;
78-
const [currentRun] = useReplicant(repName, {
84+
const [currentRun] = useReplicant<RunnerNameReplicant>(repName, {
7985
defaultValue: { runner: { name: "foo" } },
8086
});
8187
if (!currentRun) {

0 commit comments

Comments
 (0)