Add typings for react-split-pane (#9160)

This commit is contained in:
Roger Chen
2016-05-01 09:09:52 -07:00
committed by Masahiro Wakame
parent 15d1bacc2b
commit 53c91ff9a7
2 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
/// <reference path="../react/react.d.ts" />
/// <reference path="./react-split-pane.d.ts"/>
import * as React from "react";
import * as SplitPane from "react-split-pane";
class SplitPaneTest extends React.Component<React.Props<{}>, {}> {
render() {
return (
<SplitPane
allowResize={true}
className="pane"
defaultSize={30}
maxSize={50}
minSize={20}
split="vertical"
>
<div />
<div />
</SplitPane>
);
}
}

41
react-split-pane/react-split-pane.d.ts vendored Normal file
View File

@@ -0,0 +1,41 @@
// Type definitions for react-split-pane v0.1.38
// Project: https://github.com/tomkp/react-split-pane
// Definitions by: Roger Chen <https://github.com/rcchen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../react/react.d.ts"/>
declare namespace ReactSplitPane {
interface ReactSplitPaneProps {
allowResize?: boolean;
className?: string;
/**
* Either a number (in pixels) or string (percentage)
*/
defaultSize?: number | string;
/**
* Either a number (in pixels) or string (percentage)
*/
maxSize?: number | string;
/**
* Either a number (in pixels) or string (percentage)
*/
minSize?: number | string;
onChange?: Function;
onDragFinished?: Function;
onDragStarted?: Function;
primary?: string;
/**
* Either a number (in pixels) or string (percentage)
*/
size?: number | string;
split?: string;
}
interface ReactSplitPaneClass extends __React.ComponentClass<ReactSplitPaneProps> { }
}
declare module "react-split-pane" {
var split: ReactSplitPane.ReactSplitPaneClass;
export = split;
}