Skip to content

Commit dada3c3

Browse files
author
Michael Lehenbauer
committed
Remove inappropriate IDBKeyRange usages from lib.dom.d.ts.
I hit a compile error because IDBCursor.primaryKey was incorrectly typed as `IDBValidKey | IDBKeyRange` instead of just `IDBValidKey`. I fixed it and manually audited the rest of the instances of `IDBValidKey | IDBKeyRange` and fixed them. If there's a better way to fix these other than manual audit based on my understanding of the IndexedDB API, let me know. -
1 parent 21e7af7 commit dada3c3

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

baselines/dom.generated.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8691,12 +8691,12 @@ interface IDBCursor {
86918691
* Returns the key of the cursor.
86928692
* Throws a "InvalidStateError" DOMException if the cursor is advancing or is finished.
86938693
*/
8694-
readonly key: IDBValidKey | IDBKeyRange;
8694+
readonly key: IDBValidKey;
86958695
/**
86968696
* Returns the effective key of the cursor.
86978697
* Throws a "InvalidStateError" DOMException if the cursor is advancing or is finished.
86988698
*/
8699-
readonly primaryKey: IDBValidKey | IDBKeyRange;
8699+
readonly primaryKey: IDBValidKey;
87008700
/**
87018701
* Returns the IDBObjectStore or IDBIndex the cursor was opened from.
87028702
*/
@@ -8710,12 +8710,12 @@ interface IDBCursor {
87108710
* Advances the cursor to the next record in range matching or
87118711
* after key.
87128712
*/
8713-
continue(key?: IDBValidKey | IDBKeyRange): void;
8713+
continue(key?: IDBValidKey): void;
87148714
/**
87158715
* Advances the cursor to the next record in range matching
87168716
* or after key and primaryKey. Throws an "InvalidAccessError" DOMException if the source is not an index.
87178717
*/
8718-
continuePrimaryKey(key: IDBValidKey | IDBKeyRange, primaryKey: IDBValidKey | IDBKeyRange): void;
8718+
continuePrimaryKey(key: IDBValidKey, primaryKey: IDBValidKey): void;
87198719
/**
87208720
* Delete the record pointed at by the cursor with a new value.
87218721
* If successful, request's result will be undefined.
@@ -8964,7 +8964,7 @@ interface IDBObjectStore {
89648964
* Returns the associated transaction.
89658965
*/
89668966
readonly transaction: IDBTransaction;
8967-
add(value: any, key?: IDBValidKey | IDBKeyRange): IDBRequest<IDBValidKey>;
8967+
add(value: any, key?: IDBValidKey): IDBRequest<IDBValidKey>;
89688968
/**
89698969
* Deletes all records in store.
89708970
* If successful, request's result will
@@ -9037,7 +9037,7 @@ interface IDBObjectStore {
90379037
* null if there were no matching records.
90389038
*/
90399039
openKeyCursor(query?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest<IDBCursor | null>;
9040-
put(value: any, key?: IDBValidKey | IDBKeyRange): IDBRequest<IDBValidKey>;
9040+
put(value: any, key?: IDBValidKey): IDBRequest<IDBValidKey>;
90419041
}
90429042

90439043
declare var IDBObjectStore: {

baselines/webworker.generated.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,12 +1394,12 @@ interface IDBCursor {
13941394
* Returns the key of the cursor.
13951395
* Throws a "InvalidStateError" DOMException if the cursor is advancing or is finished.
13961396
*/
1397-
readonly key: IDBValidKey | IDBKeyRange;
1397+
readonly key: IDBValidKey;
13981398
/**
13991399
* Returns the effective key of the cursor.
14001400
* Throws a "InvalidStateError" DOMException if the cursor is advancing or is finished.
14011401
*/
1402-
readonly primaryKey: IDBValidKey | IDBKeyRange;
1402+
readonly primaryKey: IDBValidKey;
14031403
/**
14041404
* Returns the IDBObjectStore or IDBIndex the cursor was opened from.
14051405
*/
@@ -1413,12 +1413,12 @@ interface IDBCursor {
14131413
* Advances the cursor to the next record in range matching or
14141414
* after key.
14151415
*/
1416-
continue(key?: IDBValidKey | IDBKeyRange): void;
1416+
continue(key?: IDBValidKey): void;
14171417
/**
14181418
* Advances the cursor to the next record in range matching
14191419
* or after key and primaryKey. Throws an "InvalidAccessError" DOMException if the source is not an index.
14201420
*/
1421-
continuePrimaryKey(key: IDBValidKey | IDBKeyRange, primaryKey: IDBValidKey | IDBKeyRange): void;
1421+
continuePrimaryKey(key: IDBValidKey, primaryKey: IDBValidKey): void;
14221422
/**
14231423
* Delete the record pointed at by the cursor with a new value.
14241424
* If successful, request's result will be undefined.
@@ -1663,7 +1663,7 @@ interface IDBObjectStore {
16631663
* Returns the associated transaction.
16641664
*/
16651665
readonly transaction: IDBTransaction;
1666-
add(value: any, key?: IDBValidKey | IDBKeyRange): IDBRequest<IDBValidKey>;
1666+
add(value: any, key?: IDBValidKey): IDBRequest<IDBValidKey>;
16671667
/**
16681668
* Deletes all records in store.
16691669
* If successful, request's result will
@@ -1736,7 +1736,7 @@ interface IDBObjectStore {
17361736
* null if there were no matching records.
17371737
*/
17381738
openKeyCursor(query?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest<IDBCursor | null>;
1739-
put(value: any, key?: IDBValidKey | IDBKeyRange): IDBRequest<IDBValidKey>;
1739+
put(value: any, key?: IDBValidKey): IDBRequest<IDBValidKey>;
17401740
}
17411741

17421742
declare var IDBObjectStore: {

inputfiles/overridingTypes.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@
697697
"add": {
698698
"name": "add",
699699
"override-signatures": [
700-
"add(value: any, key?: IDBValidKey | IDBKeyRange): IDBRequest<IDBValidKey>"
700+
"add(value: any, key?: IDBValidKey): IDBRequest<IDBValidKey>"
701701
]
702702
},
703703
"clear": {
@@ -721,7 +721,7 @@
721721
"put": {
722722
"name": "put",
723723
"override-signatures": [
724-
"put(value: any, key?: IDBValidKey | IDBKeyRange): IDBRequest<IDBValidKey>"
724+
"put(value: any, key?: IDBValidKey): IDBRequest<IDBValidKey>"
725725
]
726726
},
727727
"get": {
@@ -1254,11 +1254,11 @@
12541254
"property": {
12551255
"key": {
12561256
"name": "key",
1257-
"override-type": "IDBValidKey | IDBKeyRange"
1257+
"override-type": "IDBValidKey"
12581258
},
12591259
"primaryKey": {
12601260
"name": "primaryKey",
1261-
"override-type": "IDBValidKey | IDBKeyRange"
1261+
"override-type": "IDBValidKey"
12621262
}
12631263
}
12641264
},
@@ -1267,13 +1267,13 @@
12671267
"continue": {
12681268
"name": "continue",
12691269
"override-signatures": [
1270-
"continue(key?: IDBValidKey | IDBKeyRange): void"
1270+
"continue(key?: IDBValidKey): void"
12711271
]
12721272
},
12731273
"continuePrimaryKey": {
12741274
"name": "continuePrimaryKey",
12751275
"override-signatures": [
1276-
"continuePrimaryKey(key: IDBValidKey | IDBKeyRange, primaryKey: IDBValidKey | IDBKeyRange): void"
1276+
"continuePrimaryKey(key: IDBValidKey, primaryKey: IDBValidKey): void"
12771277
]
12781278
},
12791279
"delete": {

0 commit comments

Comments
 (0)