From 76879cce23fcae9847a57bb61cc27432e2a20532 Mon Sep 17 00:00:00 2001 From: Konstantin Vasilev Date: Tue, 6 Jun 2017 10:04:43 +0300 Subject: [PATCH] export types references --- types/react-swipeable/index.d.ts | 58 ++++++++++--------- .../react-swipeable/react-swipeable-tests.tsx | 24 ++++---- 2 files changed, 42 insertions(+), 40 deletions(-) diff --git a/types/react-swipeable/index.d.ts b/types/react-swipeable/index.d.ts index 489964ee0c..b646a46268 100644 --- a/types/react-swipeable/index.d.ts +++ b/types/react-swipeable/index.d.ts @@ -1,39 +1,41 @@ // Type definitions for react-swipeable 4.0 // Project: https://www.npmjs.com/package/react-swipeable -// Definitions by: Giedrius Grabauskas +// Definitions by: Giedrius Grabauskas , +// Konstantin Vasilev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 import * as React from 'react'; -type onSwipingCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number) => void; -type OnSwipedCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, isFlick: boolean, velocity: number) => void; -type OnSwipedDirectionCallback = (event: React.TouchEvent, delta: number, isFlick: boolean) => void; -type OnSwipingDirectionCallback = (event: React.TouchEvent, delta: number) => void; -type OnTapCallback = (event: React.TouchEvent) => void; +declare class ReactSwipeable extends React.Component {} -interface Props extends React.ClassAttributes, React.HTMLAttributes { - onSwiped?: OnSwipedCallback; - onSwiping?: onSwipingCallback; - onSwipingUp?: OnSwipingDirectionCallback; - onSwipingRight?: OnSwipingDirectionCallback; - onSwipingDown?: OnSwipingDirectionCallback; - onSwipingLeft?: OnSwipingDirectionCallback; - onSwipedUp?: OnSwipedDirectionCallback; - onSwipedRight?: OnSwipedDirectionCallback; - onSwipedDown?: OnSwipedDirectionCallback; - onSwipedLeft?: OnSwipedDirectionCallback; - onTap?: OnTapCallback; - flickThreshold?: number; - delta?: number; - preventDefaultTouchmoveEvent?: boolean; - stopPropagation?: boolean; - nodeName?: string; - trackMouse?: boolean; - children?: React.ReactNode; +declare namespace ReactSwipeable { + type OnSwipingCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number) => void; + type OnSwipedCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, isFlick: boolean, velocity: number) => void; + type OnSwipedDirectionCallback = (event: React.TouchEvent, delta: number, isFlick: boolean) => void; + type OnSwipingDirectionCallback = (event: React.TouchEvent, delta: number) => void; + type OnTapCallback = (event: React.TouchEvent) => void; + + interface SwipeableProps extends React.ClassAttributes, React.HTMLAttributes { + onSwiped?: OnSwipedCallback; + onSwiping?: OnSwipingCallback; + onSwipingUp?: OnSwipingDirectionCallback; + onSwipingRight?: OnSwipingDirectionCallback; + onSwipingDown?: OnSwipingDirectionCallback; + onSwipingLeft?: OnSwipingDirectionCallback; + onSwipedUp?: OnSwipedDirectionCallback; + onSwipedRight?: OnSwipedDirectionCallback; + onSwipedDown?: OnSwipedDirectionCallback; + onSwipedLeft?: OnSwipedDirectionCallback; + onTap?: OnTapCallback; + flickThreshold?: number; + delta?: number; + preventDefaultTouchmoveEvent?: boolean; + stopPropagation?: boolean; + nodeName?: string; + trackMouse?: boolean; + children?: React.ReactNode; + } } -declare class ReactSwipeable extends React.Component {} -declare namespace ReactSwipeable {} - export = ReactSwipeable; diff --git a/types/react-swipeable/react-swipeable-tests.tsx b/types/react-swipeable/react-swipeable-tests.tsx index 05e057c11f..c75869bdb0 100644 --- a/types/react-swipeable/react-swipeable-tests.tsx +++ b/types/react-swipeable/react-swipeable-tests.tsx @@ -1,18 +1,18 @@ import * as React from 'react'; import * as Swipeable from 'react-swipeable'; -class SampleComponent extends React.PureComponent { - private handleSwiped = () => {}; - private handleSwiping = () => {}; - private handleSwipingUp = () => {}; - private handleSwipingRight = () => {}; - private handleSwipingDown = () => {}; - private handleSwipingLeft = () => {}; - private handleSwipedUp = () => {}; - private handleSwipedRight = () => {}; - private handleSwipedDown = () => {}; - private handleSwipedLeft = () => {}; - private handleTap = () => {}; +class SampleComponent extends React.PureComponent { + private handleSwiped: Swipeable.OnSwipedCallback = () => {}; + private handleSwiping: Swipeable.OnSwipingCallback = () => {}; + private handleSwipingUp: Swipeable.OnSwipingDirectionCallback = () => {}; + private handleSwipingRight: Swipeable.OnSwipingDirectionCallback = () => {}; + private handleSwipingDown: Swipeable.OnSwipingDirectionCallback = () => {}; + private handleSwipingLeft: Swipeable.OnSwipingDirectionCallback = () => {}; + private handleSwipedUp: Swipeable.OnSwipedDirectionCallback = () => {}; + private handleSwipedRight: Swipeable.OnSwipedDirectionCallback = () => {}; + private handleSwipedDown: Swipeable.OnSwipedDirectionCallback = () => {}; + private handleSwipedLeft: Swipeable.OnSwipedDirectionCallback = () => {}; + private handleTap: Swipeable.OnTapCallback = () => {}; private handleClick = () => {}; render() {