See this code where I cannot workaround the fact that I have to use ... as ...
:
vscode/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts
Line 315 in 81604a0
| | picker.selectedItems=picker.items.filter(item=>(itemasINotificationSourceFilter).filter===NotificationsFilter.OFF)as(IQuickPickItem&INotificationSourceFilter)[]; |
vscode/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts
Line 320 in 81604a0
| | for(constitemofpicker.itemsas(IQuickPickItem&INotificationSourceFilter)[]){ |
The returned type seems to include IQuickPickSeparator
and hence the casts are needed.
2条答案
按热度按时间wfsdck301#
这已经是这样了...我们在API中做的一件事是将分隔符与项目合并,并使用
kind
来区分:vscode/src/vscode-dts/vscode.d.ts
在ed220ef的第1857行
| | kind?: QuickPickItemKind; |
也许值得这样做...特别是考虑到分隔符正变得越来越像“项目”的功能,比如按钮。
k5ifujac2#
我本以为可以在选项中启用分隔符,除非我不这么做,否则不会返回分隔符类型。我假设在大多数情况下,简单选择器中不使用分隔符。