【问题标题】:Element implicitly has an 'any' type because expression of type '"hot"' can't be used to index type 'NodeModule'元素隐式具有“any”类型,因为“hot”类型的表达式不能用于索引类型“NodeModule”
【发布时间】:2022-01-17 14:14:18
【问题描述】:

元素隐式具有“任何”类型,因为“热”类型的表达式不能用于索引类型“NodeModule”。 类型'NodeModule'.ts(7053) 上不存在属性'hot'

【问题讨论】:

  • 请包括有问题的代码和您遇到的任何错误。有了这么少的信息,您不太可能得到答案,更不用说有帮助了。

标签: typescript


【解决方案1】:

节点模块的热属性不是标准的。 您需要安装所需的类型定义。运行以下命令:

npm install --save-dev @types/webpack-env

运行上述命令后,将以下类型添加到您的 tsconfig.app.json 中:

{
"compilerOptions": {
    ...
    "types": ["webpack-env"]
  },
 ...
}

【讨论】:

    猜你喜欢
    • 2022-01-17
    • 2022-10-08
    • 2020-11-14
    • 2022-08-17
    • 2021-11-11
    • 2022-11-10
    • 2021-12-24
    • 2019-11-24
    • 2023-01-09
    相关资源
    最近更新 更多