当我使用npm来安装这样的TypeScript定义时

npm install --save @types/express

我无法使用已安装的模块,因为它们无法相互解决 . 例如,@ types / express需要@ types / express-static-server-core,但由于 @types/express/index.d.ts 包含 express-static-server-core 的相对路径,因此无法解析模块:

node_modules/@types/express/index.d.ts(16,30): error TS2307: Cannot find module 'serve-static'.
node_modules/@types/express/index.d.ts(17,23): error TS2307: Cannot find module 'express-serve-static-core'.
node_modules/@types/serve-static/index.d.ts(15,26): error TS2307: Cannot find module 'express-serve-static-core'.
node_modules/@types/serve-static/index.d.ts(16,20): error TS2307: Cannot find module 'mime'.

我该如何解决这个问题?安装TypeScript定义的最佳方法是什么?

据我所知,不推荐使用typings,所以我尝试从@types安装类型定义,然后使用

tsc --target ES5 --module commonjs index.ts

但它还没有奏效 . 我究竟做错了什么?