@@ -8804,13 +8804,13 @@ interface IDBCursor {
8804
8804
* Delete the record pointed at by the cursor with a new value.
8805
8805
* If successful, request's result will be undefined.
8806
8806
*/
8807
- delete(): IDBRequest;
8807
+ delete(): IDBRequest<void> ;
8808
8808
/**
8809
8809
* Updated the record pointed at by the cursor with a new value.
8810
8810
* Throws a "DataError" DOMException if the effective object store uses in-line keys and the key would have changed.
8811
8811
* If successful, request's result will be the record's key.
8812
8812
*/
8813
- update(value: any): IDBRequest;
8813
+ update(value: any): IDBRequest<IDBValidKey> ;
8814
8814
}
8815
8815
8816
8816
declare var IDBCursor: {
@@ -8936,40 +8936,40 @@ interface IDBIndex {
8936
8936
* If successful, request's result will be the
8937
8937
* count.
8938
8938
*/
8939
- count(key?: IDBValidKey | IDBKeyRange): IDBRequest;
8939
+ count(key?: IDBValidKey | IDBKeyRange): IDBRequest<number> ;
8940
8940
/**
8941
8941
* Retrieves the value of the first record matching the
8942
8942
* given key or key range in query.
8943
8943
* If successful, request's result will be the value, or undefined if there was no matching record.
8944
8944
*/
8945
- get(key: IDBValidKey | IDBKeyRange): IDBRequest;
8945
+ get(key: IDBValidKey | IDBKeyRange): IDBRequest<IDBValue> ;
8946
8946
/**
8947
8947
* Retrieves the values of the records matching the given key or key range in query (up to count if given).
8948
8948
* If successful, request's result will be an Array of the values.
8949
8949
*/
8950
- getAll(query?: IDBValidKey | IDBKeyRange, count?: number): IDBRequest;
8950
+ getAll(query?: IDBValidKey | IDBKeyRange, count?: number): IDBRequest<any[]> ;
8951
8951
/**
8952
8952
* Retrieves the keys of records matching the given key or key range in query (up to count if given).
8953
8953
* If successful, request's result will be an Array of the keys.
8954
8954
*/
8955
- getAllKeys(query?: IDBValidKey | IDBKeyRange, count?: number): IDBRequest;
8955
+ getAllKeys(query?: IDBValidKey | IDBKeyRange, count?: number): IDBRequest<IDBValidKey[]> ;
8956
8956
/**
8957
8957
* Retrieves the key of the first record matching the
8958
8958
* given key or key range in query.
8959
8959
* If successful, request's result will be the key, or undefined if there was no matching record.
8960
8960
*/
8961
- getKey(key: IDBValidKey | IDBKeyRange): IDBRequest;
8961
+ getKey(key: IDBValidKey | IDBKeyRange): IDBRequest<IDBValidKey | undefined> ;
8962
8962
/**
8963
8963
* Opens a cursor over the records matching query,
8964
8964
* ordered by direction. If query is null, all records in index are matched.
8965
8965
* If successful, request's result will be an IDBCursorWithValue, or null if there were no matching records.
8966
8966
*/
8967
- openCursor(range?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest;
8967
+ openCursor(range?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest<IDBCursorWithValue | null> ;
8968
8968
/**
8969
8969
* Opens a cursor with key only flag set over the records matching query, ordered by direction. If query is null, all records in index are matched.
8970
8970
* If successful, request's result will be an IDBCursor, or null if there were no matching records.
8971
8971
*/
8972
- openKeyCursor(range?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest;
8972
+ openKeyCursor(range?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest<IDBCursor | null> ;
8973
8973
}
8974
8974
8975
8975
declare var IDBIndex: {
@@ -9048,19 +9048,19 @@ interface IDBObjectStore {
9048
9048
* Returns the associated transaction.
9049
9049
*/
9050
9050
readonly transaction: IDBTransaction;
9051
- add(value: any, key?: IDBValidKey | IDBKeyRange): IDBRequest;
9051
+ add(value: any, key?: IDBValidKey | IDBKeyRange): IDBRequest<any> ;
9052
9052
/**
9053
9053
* Deletes all records in store.
9054
9054
* If successful, request's result will
9055
9055
* be undefined.
9056
9056
*/
9057
- clear(): IDBRequest;
9057
+ clear(): IDBRequest<undefined> ;
9058
9058
/**
9059
9059
* Retrieves the number of records matching the
9060
9060
* given key or key range in query.
9061
9061
* If successful, request's result will be the count.
9062
9062
*/
9063
- count(key?: IDBValidKey | IDBKeyRange): IDBRequest;
9063
+ count(key?: IDBValidKey | IDBKeyRange): IDBRequest<number> ;
9064
9064
/**
9065
9065
* Creates a new index in store with the given name, keyPath and options and returns a new IDBIndex. If the keyPath and options define constraints that cannot be
9066
9066
* satisfied with the data already in store the upgrade
@@ -9075,7 +9075,7 @@ interface IDBObjectStore {
9075
9075
* If successful, request's result will
9076
9076
* be undefined.
9077
9077
*/
9078
- delete(key: IDBValidKey | IDBKeyRange): IDBRequest;
9078
+ delete(key: IDBValidKey | IDBKeyRange): IDBRequest<undefined> ;
9079
9079
/**
9080
9080
* Deletes the index in store with the given name.
9081
9081
* Throws an "InvalidStateError" DOMException if not called within an upgrade
@@ -9087,41 +9087,41 @@ interface IDBObjectStore {
9087
9087
* given key or key range in query.
9088
9088
* If successful, request's result will be the value, or undefined if there was no matching record.
9089
9089
*/
9090
- get(query: IDBValidKey | IDBKeyRange): IDBRequest;
9090
+ get(query: IDBValidKey | IDBKeyRange): IDBRequest<any | undefined> ;
9091
9091
/**
9092
9092
* Retrieves the values of the records matching the
9093
9093
* given key or key range in query (up to count if given).
9094
9094
* If successful, request's result will
9095
9095
* be an Array of the values.
9096
9096
*/
9097
- getAll(query?: IDBValidKey | IDBKeyRange, count?: number): IDBRequest;
9097
+ getAll(query?: IDBValidKey | IDBKeyRange, count?: number): IDBRequest<any[]> ;
9098
9098
/**
9099
9099
* Retrieves the keys of records matching the
9100
9100
* given key or key range in query (up to count if given).
9101
9101
* If successful, request's result will
9102
9102
* be an Array of the keys.
9103
9103
*/
9104
- getAllKeys(query?: IDBValidKey | IDBKeyRange, count?: number): IDBRequest;
9104
+ getAllKeys(query?: IDBValidKey | IDBKeyRange, count?: number): IDBRequest<IDBValidKey[]> ;
9105
9105
/**
9106
9106
* Retrieves the key of the first record matching the
9107
9107
* given key or key range in query.
9108
9108
* If successful, request's result will be the key, or undefined if there was no matching record.
9109
9109
*/
9110
- getKey(query: IDBValidKey | IDBKeyRange): IDBRequest;
9110
+ getKey(query: IDBValidKey | IDBKeyRange): IDBRequest<IDBValidKey | undefined> ;
9111
9111
index(name: string): IDBIndex;
9112
9112
/**
9113
9113
* Opens a cursor over the records matching query,
9114
9114
* ordered by direction. If query is null, all records in store are matched.
9115
9115
* If successful, request's result will be an IDBCursorWithValue pointing at the first matching record, or null if there were no matching records.
9116
9116
*/
9117
- openCursor(range?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest;
9117
+ openCursor(range?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest<IDBCursorWithValue | null> ;
9118
9118
/**
9119
9119
* Opens a cursor with key only flag set over the records matching query, ordered by direction. If query is null, all records in store are matched.
9120
9120
* If successful, request's result will be an IDBCursor pointing at the first matching record, or
9121
9121
* null if there were no matching records.
9122
9122
*/
9123
- openKeyCursor(query?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest;
9124
- put(value: any, key?: IDBValidKey | IDBKeyRange): IDBRequest;
9123
+ openKeyCursor(query?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest<IDBCursor | null> ;
9124
+ put(value: any, key?: IDBValidKey | IDBKeyRange): IDBRequest<any> ;
9125
9125
}
9126
9126
9127
9127
declare var IDBObjectStore: {
@@ -9134,7 +9134,7 @@ interface IDBOpenDBRequestEventMap extends IDBRequestEventMap {
9134
9134
"upgradeneeded": IDBVersionChangeEvent;
9135
9135
}
9136
9136
9137
- interface IDBOpenDBRequest extends IDBRequest {
9137
+ interface IDBOpenDBRequest extends IDBRequest<IDBDatabase> {
9138
9138
onblocked: ((this: IDBOpenDBRequest, ev: Event) => any) | null;
9139
9139
onupgradeneeded: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null;
9140
9140
addEventListener<K extends keyof IDBOpenDBRequestEventMap>(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -9153,14 +9153,14 @@ interface IDBRequestEventMap {
9153
9153
"success": Event;
9154
9154
}
9155
9155
9156
- interface IDBRequest extends EventTarget {
9156
+ interface IDBRequest<T> extends EventTarget {
9157
9157
/**
9158
9158
* When a request is completed, returns the error (a DOMException), or null if the request succeeded. Throws
9159
9159
* a "InvalidStateError" DOMException if the request is still pending.
9160
9160
*/
9161
9161
readonly error: DOMException | null;
9162
- onerror: ((this: IDBRequest, ev: Event) => any) | null;
9163
- onsuccess: ((this: IDBRequest, ev: Event) => any) | null;
9162
+ onerror: ((this: IDBRequest<T> , ev: Event) => any) | null;
9163
+ onsuccess: ((this: IDBRequest<T> , ev: Event) => any) | null;
9164
9164
/**
9165
9165
* Returns "pending" until a request is complete,
9166
9166
* then returns "done".
@@ -9171,7 +9171,7 @@ interface IDBRequest extends EventTarget {
9171
9171
* or undefined if the request failed. Throws a
9172
9172
* "InvalidStateError" DOMException if the request is still pending.
9173
9173
*/
9174
- readonly result: any ;
9174
+ readonly result: T ;
9175
9175
/**
9176
9176
* Returns the IDBObjectStore, IDBIndex, or IDBCursor the request was made against, or null if is was an open
9177
9177
* request.
@@ -9182,15 +9182,15 @@ interface IDBRequest extends EventTarget {
9182
9182
* If this as an open request, then it returns an upgrade transaction while it is running, or null otherwise.
9183
9183
*/
9184
9184
readonly transaction: IDBTransaction | null;
9185
- addEventListener<K extends keyof IDBRequestEventMap>(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
9185
+ addEventListener<K extends keyof IDBRequestEventMap>(type: K, listener: (this: IDBRequest<T> , ev: IDBRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
9186
9186
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
9187
- removeEventListener<K extends keyof IDBRequestEventMap>(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
9187
+ removeEventListener<K extends keyof IDBRequestEventMap>(type: K, listener: (this: IDBRequest<T> , ev: IDBRequestEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
9188
9188
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
9189
9189
}
9190
9190
9191
9191
declare var IDBRequest: {
9192
- prototype: IDBRequest;
9193
- new(): IDBRequest;
9192
+ prototype: IDBRequest<any> ;
9193
+ new(): IDBRequest<any> ;
9194
9194
};
9195
9195
9196
9196
interface IDBTransactionEventMap {
0 commit comments