英文:
False typescript errors in the browser window
问题
label参数在截图中明显显示为字符串类型。然而,在编译代码后,浏览器窗口中出现了一个错误,指出label具有any类型。请告诉我是什么原因以及如何修复这个问题。
英文:
I have a line of code written using Typescript. The label argument has a string type this is clearly visible in the screenshot
At the same time, after compiling the code, an error appears in the browser window that says that label has the type any.
Please tell me what is the cause and how can I fix this behavior
答案1
得分: 1
指定标签为字符串类型
mdValue = filterData.value.map((label: string) => {
// ...
});
英文:
Specify the label to be of type string
mdValue = filterData.value.map((label: string) => {
// ...
});
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论