Semantic-Org / Semantic-UI

Semantic is a UI component framework based around useful principles from natural language.
http://www.semantic-ui.com
MIT License
51.09k stars 4.95k forks source link

[Search] TypeScript definitions are outdated, fullTextSearch missing #6961

Open KonradHoeffner opened 4 years ago

KonradHoeffner commented 4 years ago

Steps

Expected Result

The following code should be valid TypeScript:

   $('#'+this.uiSearch.id)
    .search({
      name: this.name+' Search',
      namespace: "search"+this.uiSearch.id,
      type: 'category',
      source: categoryContent,
      fullTextSearch: "exact",
      maxResults: 30,
      searchFields: ["category", "title", "description"],
      minCharacters: 0,
      onSelect: this.selectEntry,
    });

According to the Semantic UI Search documentation:

fullTextSearch 'exact' Specifying to "true" will use a fuzzy full text search, setting to "exact" will force the exact search to be matched somewhere in the string, setting to false will only match to start of string. (This setting was previously called searchFullText.)

Actual Result

The TypeScript definitions from the newest NPM package "@types/semantic-ui" seem to still be expecting the old name "searchFullText" and not the new one "fullTextSearch".

Error
js/browser/catalogueSelect.js:123:11 - error TS2769: No overload matches this call.
The last overload gave the following error.
 Argument of type '{
  name: string; namespace:
  string;
  type: string;
  source: { category: any; title: any; id: any; description: any; }[];
  fullTextSearch: string;
  maxResults: number;
  searchFields: string[];
  minCharacters: number;
  onSelect: (result: any, response: any) => void;
 }'
 is not assignable to parameter of type 'Param'.
  Object literal may only specify known properties, and 'fullTextSearch' does not exist in type 'Param'.

123           fullTextSearch: "exact",

node_modules/@types/semantic-ui-search/global.d.ts:100:9
100         (settings?: SearchSettings): JQuery;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The last overload is declared here.

See also https://stackoverflow.com/questions/60509642/typescript-incorrectly-throws-error-ts2769-for-semantic-ui-fulltextsearch-parame

Version