Skip to content

Commit cc290ed

Browse files
authored
Make AbstractSublevel#db type more specific (#119)
The getter now returns `TDatabase` if it is an `AbstractLevel`, `TDatabase["db"]` if an `AbstractSublevel`, else some indeterminable kind of `AbstractLevel`. Category: fix
1 parent 7df20ad commit cc290ed

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

types/abstract-sublevel.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ declare class AbstractSublevel<TDatabase, TFormat, KDefault, VDefault>
4343
/**
4444
* Root database. A read-only property.
4545
*/
46-
get db (): AbstractLevel<any, any, any>
46+
get db(): TDatabase extends AbstractSublevel<any, any, any, any>
47+
? TDatabase["db"]
48+
: TDatabase extends AbstractLevel<any, any, any>
49+
? TDatabase
50+
: AbstractLevel<any, any, any>
4751
}
4852

4953
/**

0 commit comments

Comments
 (0)