请参阅代码here
var IQuery = {
idxName: 'session',
//keyRange: window.IDBKeyRange.only('1')
keyRange: IDBKeyRange.only('1')
};
为什么它无法识别IDBKeyRange
?
在lib.d.ts
中,我看到了这些定义。
interface IDBKeyRange {
upper: any;
upperOpen: boolean;
lower: any;
lowerOpen: boolean;
bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange;
only(value: any): IDBKeyRange;
lowerBound(bound: any, open?: boolean): IDBKeyRange;
upperBound(bound: any, open?: boolean): IDBKeyRange;
}
declare var IDBKeyRange: {
prototype: IDBKeyRange;
new (): IDBKeyRange;
}