Fixed bug in typeahead definition

There was a bug in the definition of the `Templates` interface. This stated that the `suggestion` property was a `string`, but this is actually a function. This PR fixes that issue and also adds tests.