From f178a4337634ca1783ef1daaf40a6523c3837285 Mon Sep 17 00:00:00 2001 From: oizie Date: Fri, 4 Mar 2016 16:26:46 +0000 Subject: [PATCH] added new react scroll type definitions and tests --- react-scroll/react-scroll-tests.ts | 26 +++++++++++++++++++++ react-scroll/react-scroll.d.ts | 36 ++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 react-scroll/react-scroll-tests.ts create mode 100644 react-scroll/react-scroll.d.ts diff --git a/react-scroll/react-scroll-tests.ts b/react-scroll/react-scroll-tests.ts new file mode 100644 index 000000000..e6d728ceb --- /dev/null +++ b/react-scroll/react-scroll-tests.ts @@ -0,0 +1,26 @@ +/// + +import { Link, Element, Events, scroller } from 'react-scroll'; + +class LinkTest extends React.Component, {}> { + + render() { + return
+ +
+ } + +} + +class ElementTest extends React.Component, {}> { + + render() { + return
+ +
+ } +} + +scroller.scrollTo("test"); + + diff --git a/react-scroll/react-scroll.d.ts b/react-scroll/react-scroll.d.ts new file mode 100644 index 000000000..79bb1421c --- /dev/null +++ b/react-scroll/react-scroll.d.ts @@ -0,0 +1,36 @@ +// Type definitions for redux-immutable v3.0.5 +// Project: https://github.com/fisshy/react-scroll +// Definitions by: Pedro Pereira +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "react-scroll" { + import React = __React + + interface Link extends React.ClassicComponentClass {} + interface Element extends React.ClassicComponentClass {} + + interface scrollEvnt { + register(evtName: string, callback: Function) : void, + remove(evtName: string) : void + } + + interface Events { + scrollEvent: scrollEvnt + } + + interface scroller { + scrollTo(to: any, animate?: any, duration?: any, offset?: any) + } + + const Link: Link; + const Element: Element; + const Events: Events; + const scroller: scroller; + + export { + Link, + Element, + Events, + scroller + } +} \ No newline at end of file