added new react scroll type definitions and tests

This commit is contained in:
oizie
2016-03-04 16:26:46 +00:00
parent 163a427719
commit f178a43376
2 changed files with 62 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
/// <reference path="./react-scroll.d.ts" />
import { Link, Element, Events, scroller } from 'react-scroll';
class LinkTest extends React.Component<React.Props<{}>, {}> {
render() {
return <div>
<Link to={'/'} />
</div>
}
}
class ElementTest extends React.Component<React.Props<{}>, {}> {
render() {
return <div>
<Element name="test" />
</div>
}
}
scroller.scrollTo("test");
+36
View File
@@ -0,0 +1,36 @@
// Type definitions for redux-immutable v3.0.5
// Project: https://github.com/fisshy/react-scroll
// Definitions by: Pedro Pereira <https://github.com/oizie>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "react-scroll" {
import React = __React
interface Link extends React.ClassicComponentClass<any> {}
interface Element extends React.ClassicComponentClass<any> {}
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
}
}