【发布时间】:2020-06-29 10:25:19
【问题描述】:
我使用下面的代码
interface State {
resourceGroup: QuickPickItem | string;
}
setEvent(state.resourceGroup?.label).catch(err => console.error(err));
为此我收到以下错误
any
Property 'label' does not exist on type 'string | QuickPickItem'.
Property 'label' does not exist on type 'string'.
https://code.visualstudio.com/api/references/vscode-api#QuickPickItem
知道如何避免这个错误吗? 不使用 ts-ignore 抑制它 因为我无法更改 QuickPickItem ...
更新
我尝试执行答案中的建议,但仍然遇到同样的错误
【问题讨论】:
标签: javascript node.js typescript vscode-extensions