module error in VS Code
See original GitHub issueHi,
I get this error in Visual Studio Code when compiling during testing with an Ionic 4 app (with Angular) The database and entry are created fine though. idb version 4.0.0
[ng] ERROR in node_modules/idb/build/esm/entry.d.ts(375,13): error TS2339: Property 'asyncIterator' does not exist on type 'SymbolConstructor'. [ng] node_modules/idb/build/esm/entry.d.ts(375,31): error TS2304: Cannot find name 'AsyncIterableIterator'. [ng] node_modules/idb/build/esm/entry.d.ts(382,98): error TS2304: Cannot find name 'AsyncIterableIterator'. [ng] node_modules/idb/build/esm/entry.d.ts(441,13): error TS2339: Property 'asyncIterator' does not exist on type 'SymbolConstructor'. [ng] node_modules/idb/build/esm/entry.d.ts(441,31): error TS2304: Cannot find name 'AsyncIterableIterator'. [ng] node_modules/idb/build/esm/entry.d.ts(450,109): error TS2304: Cannot find name 'AsyncIterableIterator'. [ng] node_modules/idb/build/esm/entry.d.ts(502,13): error TS2339: Property 'asyncIterator' does not exist on type 'SymbolConstructor'. [ng] node_modules/idb/build/esm/entry.d.ts(502,31): error TS2304: Cannot find name 'AsyncIterableIterator'. [ng] node_modules/idb/build/esm/entry.d.ts(534,13): error TS2339: Property 'asyncIterator' does not exist on type 'SymbolConstructor'. [ng] node_modules/idb/build/esm/entry.d.ts(534,31): error TS2304: Cannot find name 'AsyncIterableIterator'.
`import { Component } from ‘@angular/core’; import { openDB } from ‘idb’;
@Component({ selector: ‘app-home’, templateUrl: ‘home.page.html’, styleUrls: [‘home.page.scss’], }) export class HomePage {
constructor(){ this.createDB(); }
async createDB() {
const db = await openDB(‘IDBtest’, 1, {
upgrade(db) {
console.log(‘making a new object store’);
db.createObjectStore(‘testsettings’, { autoIncrement: true });
}
});
await db.put(‘testsettings’, { server: ‘127.0.0.1’ }, 1);
}
}`
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:21 (8 by maintainers)
Adding
esnext.asynciterable
to tsconfig worked for me.Hi, maybe the problem depends on the configuration of tsconfig.json and/or the import of the node_modules/@types… I have an Angular project with this tsconfig.json
In the idb/build/esm/entry.d.ts file I get the errors “Property ‘asyncIterator’ does not exist on type ‘SymbolConstructor’.” and “Cannot find name ‘AsyncIterableIterator’.” probably because it is not finding the correct file where the definitions are. It searches in the …\node_modules\typescript\lib\lib.es2015.iterable.d.ts file, while the idm/lib/entry.ts file correctly search the interfaces in …\node_modules\typescript\lib\lib.esnext.asynciterable.d.ts
How is the correct way to set things in order to work?