From 9fd33e689dcd086b91430705df7cfb3fa3b5dea7 Mon Sep 17 00:00:00 2001 From: wassname Date: Fri, 8 Apr 2016 09:27:51 +0800 Subject: [PATCH] Bugfix in ReactSelect.Async definitions --- react-select/react-select-tests.tsx | 59 ++++++++++++++++++++++++----- react-select/react-select.d.ts | 10 +++-- 2 files changed, 56 insertions(+), 13 deletions(-) diff --git a/react-select/react-select-tests.tsx b/react-select/react-select-tests.tsx index 444551a67..cc2cc7376 100644 --- a/react-select/react-select-tests.tsx +++ b/react-select/react-select-tests.tsx @@ -1,30 +1,69 @@ - /// /// /// -import * as React from "react" -import * as ReactDOM from "react-dom" +import * as React from "react"; +import * as ReactDOM from "react-dom"; -import * as Select from "react-select" +import * as Select from "react-select"; + +import * as React from "react"; +import * as ReactDOM from "react-dom"; + +import * as Select from "react-select"; class SelectTest extends React.Component, {}> { render() { - const options: ReactSelect.Option[] = [{ label: "Foo", value: "bar" }] + const options: ReactSelect.Option[] = [{ label: "Foo", value: "bar" }]; + const onChange = (value: any) => console.log(value); return
- +
; } - } class SelectAsyncTest extends React.Component, {}> { render() { + const getOptions = (input: string, callback: Function) => { + setTimeout(function() { + callback(null, options); + }, 500); + }; + const options: ReactSelect.Option[] = [{ label: "Foo", value: "bar" }]; + const onChange = (value: any) => console.log(value); return
- -
+ + ; } } diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts index c9e385a15..3414b4472 100644 --- a/react-select/react-select.d.ts +++ b/react-select/react-select.d.ts @@ -210,12 +210,16 @@ declare namespace ReactSelect { } interface ReactSelect extends __React.ReactElement { } - interface ReactSelectClass extends __React.ComponentClass { - Async: __React.ComponentClass; + interface ReactSelectAsyncClass extends __React.ComponentClass { } + const Async: ReactSelectAsyncClass; + interface ReactSelectClass extends __React.ComponentClass { + Async: ReactSelectAsyncClass; + } + } declare module "react-select" { - var select: ReactSelect.ReactSelectClass; + const select: ReactSelect.ReactSelectClass; export = select; }