Skip to content

Commit

Permalink
Fix and update the TypeScript typings (#553)
Browse files Browse the repository at this point in the history
* Add autocompleteSeparator to type definition file.

* Add spaceSelectsMatch to type definition file.

* Fix type definition file by specifying array type.
  • Loading branch information
simonlary authored Oct 14, 2020
1 parent 05dd4c7 commit cc67538
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tributejs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export type TributeCollection<T extends {}> = {
//specify whether to put Tribute in autocomplete mode
autocompleteMode?: boolean;

// specify a regex to define after which characters the autocomplete option should open
autocompleteSeparator?: RegExp;

// Customize the elements used to wrap matched strings within the results list
searchOpts?: TributeSearchOpts;

Expand All @@ -79,6 +82,9 @@ export type TributeCollection<T extends {}> = {

// require X number of characters to be entered before menu shows
menuShowMinLength?: number;

// specify if the current match should be selected when the spacebar is hit
spaceSelectsMatch?: boolean;
};

export type TributeOptions<T> =
Expand All @@ -88,7 +94,7 @@ export type TributeOptions<T> =
collection: Array<TributeCollection<{ [key: string]: any }>>;
};

type TributeElement = Element | NodeList | HTMLCollection | Array;
type TributeElement = Element | NodeList | HTMLCollection | Array<Element>;

export default class Tribute<T extends {}> {
constructor(options: TributeOptions<T>);
Expand Down

0 comments on commit cc67538

Please sign in to comment.