Merge pull request #8391 from oizie/react-scroll

Added new react scroll type definitions and tests
This commit is contained in:
Masahiro Wakame
2016-03-12 01:00:54 +09:00
2 changed files with 48 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
/// <reference path="../react/react.d.ts" />
/// <reference path="./react-scroll.d.ts" />
import * as React from 'react';
import { Link, Element, scroller } from 'react-scroll';
let link = <Link to="test" />;
let element = <Element name="test" />;
scroller.scrollTo("test");
+38
View File
@@ -0,0 +1,38 @@
// 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
/// <reference path="../react/react.d.ts" />
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) : void
}
const Link: Link;
const Element: Element;
const Events: Events;
const scroller: scroller;
export {
Link,
Element,
Events,
scroller
}
}