mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
The async parameter of Bloodhound.search is now optional (#23365)
The search function assigns a noop call inside the function body if the async parameter is omitted (bloodhound.js line 137), so it's safe to make this optional in the type signature.
This commit is contained in:
2
types/typeahead/index.d.ts
vendored
2
types/typeahead/index.d.ts
vendored
@@ -1186,7 +1186,7 @@ declare class Bloodhound<T> {
|
||||
* @param async Async callback.
|
||||
* @returns The data that matches query.
|
||||
*/
|
||||
public search(query: string, sync: (datums: T[]) => void, async: (datums: T[]) => void): T[];
|
||||
public search(query: string, sync: (datums: T[]) => void, async?: (datums: T[]) => void): T[];
|
||||
|
||||
/**
|
||||
* Returns all items from the internal search index.
|
||||
|
||||
@@ -213,10 +213,11 @@ function test_bloodhout() {
|
||||
// search
|
||||
var sync: (datums: string[]) => {};
|
||||
var async: (datums: string[]) => {};
|
||||
var data2: string[] = engine.search("query", sync, async);
|
||||
var data2: string[] = engine.search("query", sync);
|
||||
var data3: string[] = engine.search("query", sync, async);
|
||||
|
||||
// all
|
||||
var data3: string[] = engine.all();
|
||||
var data4: string[] = engine.all();
|
||||
|
||||
// clear
|
||||
var engine1: Bloodhound<string> = engine.clear();
|
||||
@@ -463,4 +464,4 @@ function test_bloodhout() {
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user