mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
[react-select] fix field name in AutocompleteResult (#13439)
* fix field name in AutocompleteResult, test was not testing it properly * add myself to contributors
This commit is contained in:
12
react-select/index.d.ts
vendored
12
react-select/index.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for react-select v1.0.0
|
||||
// Project: https://github.com/JedWatson/react-select
|
||||
// Definitions by: ESQUIBET Hugo <https://github.com/Hesquibet/>, Gilad Gray <https://github.com/giladgray/>, Izaak Baker <https://github.com/iebaker/>, Tadas Dailyda <https://github.com/skirsdeda/>
|
||||
// Definitions by: ESQUIBET Hugo <https://github.com/Hesquibet/>, Gilad Gray <https://github.com/giladgray/>, Izaak Baker <https://github.com/iebaker/>, Tadas Dailyda <https://github.com/skirsdeda/>, Mark Vujevits <https://github.com/vujevits/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as React from 'react';
|
||||
@@ -10,7 +10,7 @@ export = ReactSelectClass;
|
||||
declare namespace ReactSelectClass {
|
||||
export interface AutocompleteResult {
|
||||
/** the search-results to be displayed */
|
||||
data: Option[],
|
||||
options: Option[],
|
||||
/** Should be set to true, if and only if a longer query with the same prefix
|
||||
* would return a subset of the results
|
||||
* If set to true, more specific queries will not be sent to the server.
|
||||
@@ -438,10 +438,10 @@ declare namespace ReactSelectClass {
|
||||
searchingText?: string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
declare class ReactSelectClass extends React.Component<ReactSelectClass.ReactSelectProps, {}> { }
|
||||
|
||||
declare module ReactSelectClass {
|
||||
declare module ReactSelectClass {
|
||||
class Creatable extends React.Component<ReactCreatableSelectProps, {}> { }
|
||||
class Async extends React.Component<ReactAsyncSelectProps, {}> { }
|
||||
}
|
||||
class Async extends React.Component<ReactAsyncSelectProps, {}> { }
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
|
||||
import Select = require("react-select");
|
||||
import { Option, ReactSelectProps, ReactCreatableSelectProps, ReactAsyncSelectProps, MenuRendererProps } from "react-select";
|
||||
import { Option, ReactSelectProps, ReactCreatableSelectProps, ReactAsyncSelectProps, MenuRendererProps, AutocompleteResult } from "react-select";
|
||||
|
||||
const CustomOption = React.createClass({
|
||||
propTypes: {
|
||||
@@ -158,9 +158,12 @@ class SelectWithStringValueTest extends React.Component<React.Props<{}>, {}> {
|
||||
class SelectAsyncTest extends React.Component<React.Props<{}>, {}> {
|
||||
|
||||
render() {
|
||||
const getOptions = (input: string, callback: Function) => {
|
||||
const getOptions = (input: string, callback: (err: any, result: AutocompleteResult) => any) => {
|
||||
setTimeout(function() {
|
||||
callback(null, options);
|
||||
callback(null, {
|
||||
options: options,
|
||||
complete: true
|
||||
});
|
||||
}, 500);
|
||||
};
|
||||
const options: Option[] = [{ label: "Foo", value: "bar" }];
|
||||
|
||||
Reference in New Issue
Block a user