zurb / tribute

ES6 Native @mentions

Home Page:https://zurb.github.io/tribute/example/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type definitions are wrong for the selectTemplate option

stof opened this issue · comments

The type definition declares the selectTemplate option as a callable with the signature (item: TributeItem<T>) => string.
However, based on errors I got in my logs, it seems like the argument can also be undefined sometimes. And the defaultSelectTemplate indeed handles the case of undefined.

Either the types should be updated to reflect that or the case of undefined should be handled by the caller directly.

Also, as the callback is called with the Tribute object as context, this should also be reflected in the type IMO.

Can you submit a PR to fix this?

@mrsweaters sure. Here it is.