使用 tfjs-node 时添加类型

Adding types when using tfjs-node

我想在使用 tensorflow/tfjs-node 时安装类型,因为我正在使用 Typescript。

我通过 npm install @tensorflow/tfjs-node 安装了它

但他们中没有一个正在安装类型:

npm install --save @types/tensorflow/tfjs-node
npm install --save @types/tfjs-node

您不需要单独安装这些类型,因为它们已经存在 bundled with the main repository

要从 @types/... 中删除旧类型,请使用 npm uninstall。之后,当使用 TypeScript 并通过 import 导入数据时,它应该会自动选择正确的类型。