mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Add PouchDB heterogeneous generic test
This commit is contained in:
@@ -210,3 +210,26 @@ function testRemoteOptions() {
|
||||
skip_setup: true
|
||||
});
|
||||
}
|
||||
|
||||
interface Cat {
|
||||
meow: string;
|
||||
}
|
||||
|
||||
interface Boot {
|
||||
thud: boolean;
|
||||
}
|
||||
|
||||
async function heterogeneousGenericsDatabase(db: PouchDB.Database) {
|
||||
const cats = await db.allDocs<Cat>({ startkey: 'cat/', endkey: 'cat/\uffff', include_docs: true });
|
||||
for (let row of cats.rows) {
|
||||
if (row.doc) {
|
||||
row.doc.meow; // $ExpectType string
|
||||
}
|
||||
}
|
||||
const boots = await db.allDocs<Boot>({ startkey: 'boot/', endkey: 'boot/\uffff', include_docs: true });
|
||||
for (let row of boots.rows) {
|
||||
if (row.doc) {
|
||||
row.doc.thud; // $ExpectType boolean
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user