diff --git a/typeahead/typeahead-tests.ts b/typeahead/typeahead-tests.ts index 67fc8d31a..1044fe3bf 100644 --- a/typeahead/typeahead-tests.ts +++ b/typeahead/typeahead-tests.ts @@ -85,3 +85,8 @@ $('.example-countries .typeahead').typeahead({ prefetch: '../data/countries.json', limit: 10 }); + +module valueTest { + var value: string = $('foo').typeahead('val'); + $('foo').typeahead('val', value); +} \ No newline at end of file diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index f6f387986..bb8aaf31d 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -60,6 +60,17 @@ interface JQuery { * @param dataset Array of datasets */ typeahead(options: Twitter.Typeahead.Options, dataset: Twitter.Typeahead.Dataset): JQuery; + + /** + * Returns the current value of the typeahead. The value is the text the user has entered into the input element. + */ + typeahead(methodName: 'val'): string; + typeahead(methodName: string): string; + + /** + * Sets the value of the typeahead. This should be used in place of jQuery#val. + */ + typeahead(methodName: 'val', value: string): JQuery; } declare module Twitter.Typeahead {