lib.dom.d.ts: IDBKeyPath defined as string instead of string|string[].
See original GitHub issueTypeScript Version: 2.1.6
Code
let request = window.indexedDB.open('database', /*version=*/1);
request.onsuccess = (event: Event) => {
let db = (event.target as IDBOpenDBRequest).result as IDBDatabase;
db.createObjectStore('employees', {
keyPath: ['company_id', 'employee_id']
});
};
Expected behavior: Compiles.
Actual behavior:
test_db.ts(26,35): error TS2345: Argument of type '{ keyPath: string[]; }' is not assignable to parameter of type 'IDBObjectStoreParameters | undefined'.
Type '{ keyPath: string[]; }' is not assignable to type 'IDBObjectStoreParameters'.
Types of property 'keyPath' are incompatible.
Type 'string[]' is not assignable to type 'string | undefined'.
Type 'string[]' is not assignable to type 'string'.
Notes: IndexedDB definition of keypath: https://www.w3.org/TR/IndexedDB/#dfn-key-path
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
lib.dom.d.ts: IDBKeyPath defined as string instead of string
TypeScript Version: 2.1.6 Code let request = window.indexedDB.open('database', /*version=*/1); request.onsuccess = (event: Event) => { let ...
Read more >IDBObjectStore | typescript - v3.7.7 - Microsoft Open Source
Returns the key path of the store, or null if none. name. name: string. Defined in node_modules/typedoc/node_modules/ ...
Read more >node_modules/typescript/lib/lib.dom.d.ts - Google Git
interface IDBObjectStoreParameters {. autoIncrement?: boolean;. keyPath?: string | string[] | null;. } interface IDBVersionChangeEventInit extends EventInit ...
Read more >Indexed Database API 3.0 - W3C
A key path is a string or list of strings that defines how to extract a key from a value. A valid key...
Read more >https://raw.githubusercontent.com/Microsoft/TypeSc...
Instead, if it is negative, NaN, or not a number, the resulting ... BufferSource; } interface RsaOtherPrimesInfo { d?: string; r?: string; t?:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
IDBObjectStore.getAll()
is also not defined.PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.