首页 > 解决方案 > Disable @types/node in tsconfig

问题描述

Given my codebase needs to contain nodejs and browser code and therefore @types/node is installed inside node_modules.

The frontend code contains setTimeout calls - which would always return a number for the browser.

Unfortunately @types/node provides different typings and therefore it always shows the following type error:

TS2345: Argument of type 'Timeout' is not assignable to parameter of type 'number'.

Is there any way to exclude or disable @types/node in my tsconfig.json?

标签: javascripttypescript

解决方案


不是在 package.json 文件中吗?

Obs:此文件位于项目文件夹的根目录中。


推荐阅读