Skip to content

Commit b9f7c2e

Browse files
committed
Add type to BaseDatabase
1 parent 2882770 commit b9f7c2e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/index.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ declare module "@orbitdb/core" {
5555
onUpdate?: (log: Log, entry: LogEntry) => void;
5656
};
5757

58-
export type BaseDatabase = {
58+
export type InternalDatabase = {
5959
address: string;
6060
name: string;
6161
identity: Identity;
@@ -70,7 +70,9 @@ declare module "@orbitdb/core" {
7070
events: TypedEmitter<DatabaseEvents>;
7171
access: AccessController;
7272
};
73-
export function Database(args: CreateDatabaseOptions): Promise<BaseDatabase>;
73+
export function Database(args: CreateDatabaseOptions): Promise<InternalDatabase>;
74+
75+
export type BaseDatabase = InternalDatabase & { type: string };
7476

7577
export type DatabaseGenerator<T extends BaseDatabase = BaseDatabase> = (
7678
args: CreateDatabaseOptions,
@@ -79,7 +81,7 @@ declare module "@orbitdb/core" {
7981
T extends DatabaseGenerator<infer D> ? D : never;
8082
export type DatabaseGeneratorInitialiser<
8183
T extends BaseDatabase = BaseDatabase,
82-
> = () => DatabaseGenerator<T>;
84+
> = { type: T["type"] } & (() => DatabaseGenerator<T>);
8385
export type DatabaseFromGeneratorInitialiser<T> =
8486
T extends DatabaseGeneratorInitialiser<infer D> ? D : never;
8587

0 commit comments

Comments
 (0)