I try to import tfjs in a Typescript environment. However, I get the following error:
node_modules/@tensorflow/tfjs-layers/dist/keras_format/types.d.ts:12:5 - error TS2411: Property 'config' of type 'T' is not assignable to string index type 'PyJsonValue'.
This can be easily reproduced with the following steps:
npm init
npm i @tensorflow/tfjs
npm i typescript
Create a index.ts:
import * as tf from '@tensorflow/tfjs';
// Define a model for linear regression.
const model = tf.sequential();
Configure and compile:
tsc --init
tsc
The package.json
then contains the following:
"dependencies": {
"@tensorflow/tfjs": "^0.15.1",
"typescript": "3.3.3"
}
And the tsconfig
looks like this:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": true,
"esModuleInterop": true
}
}