Skip to content

Commit 74a3c2b

Browse files
authored
fix(types): add typescript type declaration for useClient react hook (#23)
1 parent 68af5b9 commit 74a3c2b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

types/index.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@ export type config = {schema?: Schema, initialData?: Transaction };
44
export type Entity = {
55
get: (...params:string[]) => any;
66
}
7+
export type Datom = [number, string, string | number | object | Array<any>, number, boolean];
8+
export type homebaseClient = {
9+
dbToString: () => string,
10+
dbFromString: (dbString: string) => any,
11+
dbToDatoms: () => Datom[],
12+
addTransactListener: (listener: (changedDatoms: Datom[]) => any) => any,
13+
removeTransactListener: () => any,
14+
transactSilently: (transaction: Transaction) => any
15+
}
716

817
export function HomebaseProvider(props: {config?:config, children:any}): any;
918
export function useTransact(): [(transaction:Transaction) => any];
1019
export function useEntity(lookup: object | number): [Entity];
1120
export function useQuery(query: object | string, ...args: any): [Array<Entity>];
21+
export function useClient(): homebaseClient;

0 commit comments

Comments
 (0)