mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
react-select: Export the Option interface (#9110)
* Add an export for Option so we can use it directly * Update tests to import the newly exported Option
This commit is contained in:
committed by
Masahiro Wakame
parent
08ed4e9f18
commit
0c33358b1e
@@ -5,16 +5,16 @@
|
||||
import * as React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
|
||||
import Select from "react-select";
|
||||
import Select, { Option } from "react-select";
|
||||
|
||||
class SelectTest extends React.Component<React.Props<{}>, {}> {
|
||||
|
||||
render() {
|
||||
const options: ReactSelect.Option[] = [{ label: "Foo", value: "bar" }];
|
||||
const options: Option[] = [{ label: "Foo", value: "bar" }];
|
||||
const onChange = (value: any) => console.log(value);
|
||||
const onOpen = () => { return; };
|
||||
const onClose = () => { return; };
|
||||
const optionRenderer = (option: ReactSelect.Option) => <span>{option.label}</span>
|
||||
const optionRenderer = (option: Option) => <span>{option.label}</span>
|
||||
return <div>
|
||||
<Select
|
||||
name="test-select"
|
||||
@@ -46,7 +46,7 @@ class SelectAsyncTest extends React.Component<React.Props<{}>, {}> {
|
||||
callback(null, options);
|
||||
}, 500);
|
||||
};
|
||||
const options: ReactSelect.Option[] = [{ label: "Foo", value: "bar" }];
|
||||
const options: Option[] = [{ label: "Foo", value: "bar" }];
|
||||
const onChange = (value: any) => console.log(value);
|
||||
return <div>
|
||||
<Select.Async
|
||||
|
||||
3
react-select/react-select.d.ts
vendored
3
react-select/react-select.d.ts
vendored
@@ -302,5 +302,8 @@ declare namespace ReactSelect {
|
||||
|
||||
declare module "react-select" {
|
||||
const select: ReactSelect.ReactSelectClass;
|
||||
interface Option extends ReactSelect.Option {}
|
||||
|
||||
export default select;
|
||||
export { Option };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user