How to use tensorflow js (tfjs) from typescript?
Note that there is unfortunately no simple way to tell whether types are available in a library since type definitions can be exported in a variety of ways.
If you do npm install --save @tensorflow/tfjs
, you will see that there is a node_modules/@tensorflow/tfjs/dist/index.d.ts
. Additionally in the package.json
for the project, there is "types": "dist/index.d.ts"
.
That is to say types are available for this library.
If types are not included with the package, you can check DefinitelyTyped to see if there is a third party definition available at @types/{package}
. Otherwise you'll be on your own for strong typing.