Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typeahead: Remove unused code #888

Closed
wants to merge 1 commit into from

Conversation

AlBlanc
Copy link

@AlBlanc AlBlanc commented Aug 24, 2016

When i am using ng2-bootstrap with angular2 rc5 and typescript 2.0, i am facing this issue which happens because query is of type string so the condition typeof query === 'object' will never be fulfilled.

ERROR in [default] /web-app/node_modules/ng2-bootstrap/components/typeahead/typeahead-container.component.ts:149:34 Property 'length' does not exist on type 'never'.

@codecov-io
Copy link

codecov-io commented Aug 24, 2016

Current coverage is 86.05% (diff: 100%)

Merging #888 into feat-rc5 will not change coverage

@@           feat-rc5       #888   diff @@
==========================================
  Files            25         25          
  Lines           760        760          
  Methods         142        142          
  Messages          0          0          
  Branches        110        110          
==========================================
  Hits            654        654          
  Misses          106        106          
  Partials          0          0          

Powered by Codecov. Last update 4bffd5e...909bc27

@Martin-Luft
Copy link
Contributor

Martin-Luft commented Sep 1, 2016

This is not true. Please look at typeahead.directive.ts:

this.container.query = this.typeaheadSingleWords
  ? TypeaheadUtils.tokenize(normalizedQuery, this.typeaheadWordDelimiters, this.typeaheadPhraseDelimiters)
  : normalizedQuery;
...
this.container.query = this.typeaheadSingleWords
  ? TypeaheadUtils.tokenize(normalizedQuery, this.typeaheadWordDelimiters, this.typeaheadPhraseDelimiters)
  : normalizedQuery;

And TypeaheadUtils.tokenize() returns Array<string>.

So the correct solution would be to change the type from query:string to query: string | string[] (TypeScript 2) or to query: any (TypeScript 1.8).

@Martin-Luft Martin-Luft closed this Sep 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants