相关疑难解决方法(0)

打字稿2.0.tsconfig.json中的"types"字段

我不明白types字段的含义tsconfig.json.在文档中我读过这样的文字:

"types": {
  "description": "Type declaration files to be included in compilation. Requires TypeScript version 2.0 or later.",
  "type": "array",
  "items": {
    "type": "string"
  }
},
Run Code Online (Sandbox Code Playgroud)

到目前为止,据我所知,如果我安装,@types/express我应该添加这样的字符串tsconfig.json

{
  "compilerOptions": {
     ...
     "types": ["lodash"]
   }
} 
Run Code Online (Sandbox Code Playgroud)

但没有它,一切都很好.现在我不明白,为什么我需要types田地

typescript typescript-typings typescript2.0

45
推荐指数
3
解决办法
3万
查看次数