after updting some angular dependencies (15.1 to 15.2) (and possibly some transitive stuff downwards) I get errors in my pouchdb calls.
Simplified code:
// db is PouchDB.Database
const allDocs = await db.allDocs<Stuff>({
include_docs: true,
attachments: true,
binary: true,
keys: ['some', 'keys', 'from', 'somewhere', 'else']
});
console.log(allDocs.rows[0].doc._id);
Leads to an error:
error TS2339: Property 'id' does not exist on type
'{ key: string; error: "not_found"; } |
{ doc?: ExistingDocument<Photo & AllDocsMeta>; id: string; key: string; value: { rev: string; deleted?: boolean; }; }'.
Property 'doc' does not exist on type '{ key: string; error: "not_found"; }'
This worked fine with the previous angular/dependency versions. Any idea what I'm missing?
Edit: I also tried the same stuff in a completly new project:
- create project/dependencies
# install latest angular cli
npm install -g @angular/cli
# create a new project
ng new angular15-pouchdb
# add pouchdb
npm i [email protected]
# add types for pouchdb
npm i @types/[email protected] --save-dev
- tsconfig.json:
- add "allowSyntheticDefaultImports": true to compilerOptions of tsconfig.json
- create test code
import PouchDB from 'pouchdb';
class Stuff {
}
export class Foo {
private async foo(db: PouchDB.Database) {
const allDocs = await db.allDocs<Stuff>({
include_docs: true,
attachments: true,
binary: true,
keys: ['some', 'keys', 'from', 'somewhere', 'else']
});
console.log(allDocs.rows[0].doc._id);
}
}
Results in same error.