typescript - TypeScript 为 Semantic UI fullTextSearch 参数错误地抛出错误 TS2769
问题描述
当我将 TypeScript 与语义 UI 搜索功能一起使用时,即使存在参数“fullTextSearch”,我也会收到以下错误。为什么 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,
});
错误
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.
文档
根据语义 UI 搜索文档:
fullTextSearch 'exact' 指定为“true”将使用模糊全文搜索,设置为“exact”将强制精确搜索匹配字符串中的某处,设置为 false 将仅匹配字符串的开头。(此设置以前称为 searchFullText。)
细节
- 打字稿版本 3.7.5
- 带有 JSDoc 注释的 JavaScript 代码,通过
tsc --noEmit
- package.json 包括
"@types/semantic-ui": "^2.2.7"
PS:我误解了错误消息,似乎“类型参数”描述了实际输入,而不是预期的输入,并且 global.d.ts 文件包含旧参数名称“searchFullText”而不是新参数名称“fullTextSearch ”。
解决方案
@types/semantic-ui: "^2.2.7"
已过时。
它仍然包含旧的“searchFullText”而不是新的“fullTextSearch”。我在以下网址报告了这一点:https ://github.com/Semantic-Org/Semantic-UI/issues/6961
推荐阅读
- python - 当我尝试访问 MailItem COM 中的任何日期相关字段时,Python 崩溃
- powershell - 将依赖程序设置为始终首先使用 PowerShell 运行
- symfony - 控制 Symfony 3.4 框架进入生产或开发模式的正确方法是什么?
- python - 如何在 Keras 中正确设置 steps_per_epoch 和 validation_steps?
- openstreetmap - OpenStreetMap立交桥查询
- asynchronous - 我如何有条件地返回不同类型的期货?
- laravel - BelongsToMany 通过 laravel 中的数组值
- c# - 使用httpclient下载zip的有效方法
- elasticsearch - Elasticsearch集群Nest搜索期间的小写文档类型
- linux - 用于用户空间范围内存泄漏检测的密件抄送工具 memleak