DefinitelyTyped/react-swipeable/index.d.ts
Eric Anderson 9b53298395 Support Pick<> on setState now that TS 2.1 is out (#13155)
* Support Partial<> on setState now that TS 2.1 is out

* Update readme to reflect setState being typed correctly

* Switch setState to Pick

* Restore cloneELement portion of readme

* Use Pick<> | S for setState due to cast issue

* state and props should be readonly

* Fix nit + document why we

* Add typescript compiler header

* Update to properly order headers

* Update readme to reflect 2.1.5 fixing stPick

* Update readme now that 2.1.5 is out

* All that depend on react now require 2.1

* Fix definition that fails due to readonly state
2017-01-23 12:36:53 -08:00

52 lines
1.7 KiB
TypeScript

// Type definitions for react-swipeable 3.3.1
// Project: https://www.npmjs.com/package/react-swipeable
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
///<reference types='react' />
declare namespace ReactSwipeableModule {
interface onSwipingCallback {
(event: React.TouchEvent<any>, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number): void;
}
interface OnSwipedCallback {
(event: React.TouchEvent<any>, deltaX: number, deltaY: number, isFlick: boolean, velocity: number): void;
}
interface OnSwipedDirectionCallback {
(event: React.TouchEvent<any>, delta: number, isFlick: boolean): void;
}
interface OnSwipingDirectionCallback {
(event: React.TouchEvent<any>, delta: number): void;
}
interface Props {
onSwiped?: OnSwipedCallback;
onSwiping?: onSwipingCallback;
onSwipingUp?: OnSwipingDirectionCallback;
onSwipingRight?: OnSwipingDirectionCallback;
onSwipingDown?: OnSwipingDirectionCallback;
onSwipingLeft?: OnSwipingDirectionCallback;
onSwipedUp?: OnSwipedDirectionCallback;
onSwipedRight?: OnSwipedDirectionCallback;
onSwipedDown?: OnSwipedDirectionCallback;
onSwipedLeft?: OnSwipedDirectionCallback;
flickThreshold?: number;
delta?: number;
preventDefaultTouchmoveEvent?: boolean;
nodeName?: string;
}
interface ReactSwipeable extends React.ComponentClass<Props> { }
}
declare module "react-swipeable" {
let module: ReactSwipeableModule.ReactSwipeable;
export = module;
}