Skip to content

IDBRequest result attribute typed as any #25547

Closed
@LinusU

Description

@LinusU

TypeScript Version: master

Search Terms: IDBRequest

Code

new Promise((resolve, reject) => {
  const req = indexedDB.open(name, 1)
  req.onerror = () => reject(req.error)
  req.onsuccess = () => resolve(req.result)

  req.onupgradeneeded = () => {
    req.result.createObjectStore('keyval', { notValidKey: false })
  }
})

Expected behavior: notValidKey should not be accepted in the second argument to createObjectStore

Actual behavior: Since req.result is typed as any, anything goes

Playground Link: link

Related Issues: none

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions