Skip to content

Commit

Permalink
fix(typescript): allow using types without providing a generic type
Browse files Browse the repository at this point in the history
would break code where a ChainReference or SocketDBClientAPI type was used as it required generics.
added any as default generic type
  • Loading branch information
TimoBechtel committed Oct 17, 2021
1 parent abe7739 commit a973a93
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import { createStore, Store } from './store';
import { BatchedUpdate, createUpdateBatcher } from './updateBatcher';
import { deepClone, isObject, mergeDiff } from './utils';

export type SocketDBClientAPI<Schema extends SchemaDefinition> = {
export type SocketDBClientAPI<Schema extends SchemaDefinition = any> = {
disconnect: () => void;
} & ChainReference<Schema>;

type Unsubscriber = () => void;

type SchemaDefinition = KeyValue | Value;

export type ChainReference<Schema extends SchemaDefinition> = {
export type ChainReference<Schema extends SchemaDefinition = any> = {
get<Key extends keyof Schema>(
path: Schema extends KeyValue ? Key : never
): ChainReference<Schema extends KeyValue ? Schema[Key] : never>;
Expand Down

0 comments on commit a973a93

Please sign in to comment.