Skip to content

(event: TouchEvent) => void is not assignable "touchstart" event. #22565

Closed
microsoft/TypeScript-DOM-lib-generator
#394
@Glinkis

Description

@Glinkis

TypeScript Version: 2.8.0-dev.20180314

Code

const onTouchStart = (event: TouchEvent) {}
document.addEventListener("touchstart", onTouchStart);

Expected behavior:
onTouchStart should be treated as an event listener.

Actual behavior:

Argument of type '(event: TouchEvent) => void' is not assignable to parameter of type 'EventListenerOrEventListenerObject'.
  Type '(event: TouchEvent) => void' is not assignable to type 'EventListenerObject'.

Playground Link: link
Though the playground does not really demonstrate the issue, as it's not on the newest typescript version.

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