[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:
Mark Vujevits
2016-12-28 01:34:51 +01:00
committed by Andy
parent 80c92082f3
commit bec25785d7
2 changed files with 12 additions and 9 deletions

View File

@@ -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, {}> { }
}

View File

@@ -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" }];