Typescript 节点模块实现在哪里

Where do Typescript Node Module Implementations live

所以我正在使用 Typescript 编写应用程序。我正在使用以下库;

https://www.npmjs.com/package/@types/request

所以我 运行 npm install --save @types/request 并决定检查我的 node_modules 文件夹。在其中我可以看到包含这些文件的请求库:

在打字稿中,以.d.ts结尾的文件是定义文件,其中不存在实现。

当我实际编写代码时,我可以从这个库中导入并使用它 API 就好了。但是这个 API 的实现实际上在哪里,它似乎不存在。

request NPM 包中:https://github.com/request/request. The @types/request 包只是它的 TypeScript 定义。如果包本身没有 TypeScript 定义,TypeScript 将在 @types/packageName.

中查找它们
npm i --save request

import * as request from 'request'