Skip to content

TouchEvent on() handlers in "lib.d.ts" #5708

Closed

Description

@GoToLoop

Diff. from any other event handler in "lib.d.ts", the 4 TouchEvent callbacks are merely declared as any:

declare var ontouchcancel: any;
declare var ontouchend: any;
declare var ontouchmove: any;
declare var ontouchstart: any;

They should be declared this way instead:

declare var ontouchcancel: (ev: TouchEvent) => any;
declare var ontouchend: (ev: TouchEvent) => any;
declare var ontouchmove: (ev: TouchEvent) => any;
declare var ontouchstart: (ev: TouchEvent) => any;

Activity

  1. added
    Bug
    Domain: lib.d.ts
    on Nov 18, 2015
  2. mhegazy commented on Nov 19, 2015

    @mhegazy
    Contributor
  3. added this to the milestone on Dec 8, 2015
  4. DanielRosenwasser commented on Feb 3, 2016

    @DanielRosenwasser
    Member

    I think those should return void

  5. GoToLoop commented on Feb 3, 2016

    @GoToLoop
    Author
    • I was just following the model which was already there.
    • That is, all event handlers are declared as returning any.
    • Therefore if we change 1 of them to void, all of the rest gotta follow suit as well.
    • However, any "onEventType" handler callback can indeed return false in most cases as replacement for preventDefault() method or ev.returnValue = false.
    • Therefore I believe most correct returning type is boolean. Or at least void | boolean.

    http://www.QuirksMode.org/js/events_early.html

  6. added
    Breaking Change
    on Feb 11, 2016
  7. modified the milestones: TypeScript 2.0, on Feb 11, 2016
  8. added
    Fixed
    and removed on Apr 27, 2016
  9. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking ChangeBugDomain: lib.d.tsFixed

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions