export types references

This commit is contained in:
Konstantin Vasilev
2017-06-06 10:04:43 +03:00
parent 52fbfebcb6
commit 76879cce23
2 changed files with 42 additions and 40 deletions

View File

@@ -1,39 +1,41 @@
// Type definitions for react-swipeable 4.0
// Project: https://www.npmjs.com/package/react-swipeable
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>,
// Konstantin Vasilev <https://github.com/mctep>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as React from 'react';
type onSwipingCallback = (event: React.TouchEvent<HTMLElement>, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number) => void;
type OnSwipedCallback = (event: React.TouchEvent<HTMLElement>, deltaX: number, deltaY: number, isFlick: boolean, velocity: number) => void;
type OnSwipedDirectionCallback = (event: React.TouchEvent<HTMLElement>, delta: number, isFlick: boolean) => void;
type OnSwipingDirectionCallback = (event: React.TouchEvent<HTMLElement>, delta: number) => void;
type OnTapCallback = (event: React.TouchEvent<HTMLElement>) => void;
declare class ReactSwipeable extends React.Component<ReactSwipeable.SwipeableProps, void> {}
interface Props extends React.ClassAttributes<ReactSwipeable>, React.HTMLAttributes<HTMLElement> {
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<HTMLElement>, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number) => void;
type OnSwipedCallback = (event: React.TouchEvent<HTMLElement>, deltaX: number, deltaY: number, isFlick: boolean, velocity: number) => void;
type OnSwipedDirectionCallback = (event: React.TouchEvent<HTMLElement>, delta: number, isFlick: boolean) => void;
type OnSwipingDirectionCallback = (event: React.TouchEvent<HTMLElement>, delta: number) => void;
type OnTapCallback = (event: React.TouchEvent<HTMLElement>) => void;
interface SwipeableProps extends React.ClassAttributes<ReactSwipeable>, React.HTMLAttributes<HTMLElement> {
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<Props, void> {}
declare namespace ReactSwipeable {}
export = ReactSwipeable;

View File

@@ -1,18 +1,18 @@
import * as React from 'react';
import * as Swipeable from 'react-swipeable';
class SampleComponent extends React.PureComponent<void, void> {
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<Swipeable.SwipeableProps, void> {
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() {