Skip to content

Commit

Permalink
typescript declaration file added
Browse files Browse the repository at this point in the history
  • Loading branch information
Denys Krasnoshchok authored and Denys Krasnoshchok committed Dec 19, 2016
1 parent 0f543d6 commit 0a1c486
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
19 changes: 19 additions & 0 deletions autocomplete.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export interface AutocompleteItem<T> {
label: string;
item: T;
group?: string;
}
export interface AutocompleteSettings<T> {
input: HTMLInputElement;
render?: (item: AutocompleteItem<T>) => HTMLDivElement | undefined;
renderGroup?: (name: string) => HTMLDivElement | undefined;
className?: string;
minLength?: number;
emptyMsg?: string;
onSelect: (item: T, input: HTMLInputElement) => void;
fetch: (text: string, update: (items: Array<AutocompleteItem<T>>) => void) => void;
}
export interface AutocompleteResult {
destroy: () => void;
}
export declare function autocomplete<T>(settings: AutocompleteSettings<T>): AutocompleteResult;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "autocompleter",
"version": "1.0.12",
"version": "1.0.13",
"description": "Blazing fast and lightweight autocomplete library without dependencies. 1KB gzipped.",
"main": "autocomplete.js",
"scripts": {
Expand All @@ -24,6 +24,7 @@
"bugs": {
"url": "https://github.com/kraaden/autocomplete/issues"
},
"types": "./autocomplete.d.ts",
"keywords": [
"autocomplete",
"autocompleter",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"noFallthroughCasesInSwitch": true,
"newLine": "CRLF",
"noImplicitThis": true,
"strictNullChecks": true
"strictNullChecks": true,
"declaration": true
}
}

0 comments on commit 0a1c486

Please sign in to comment.