VSCode 哈希图自动完成功能不起作用
我不确定我在哪里做错了。这是我的代码。
type.d.ts:
type _MaterialTable = {
weight: number
price: number
}
type Material = {
[index: string]: _MaterialTable
}
test.js:
/** @type {Material} */
WeightTable = {};
/** @type {map<string, _MaterialTable} */
WeightTable2 = {}
const x1 = WeightTable['test'];
const x2 = WeightTable2['test'];
The result was always any
type.不是_MaterialTable
类型。
我该如何正确键入?谢谢
I am not sure where I did wrong.. This below is my code.
type.d.ts:
type _MaterialTable = {
weight: number
price: number
}
type Material = {
[index: string]: _MaterialTable
}
test.js:
/** @type {Material} */
WeightTable = {};
/** @type {map<string, _MaterialTable} */
WeightTable2 = {}
const x1 = WeightTable['test'];
const x2 = WeightTable2['test'];
The result was always any
type. Not _MaterialTable
type.
How can I type this properly? Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论