Compile error in @tensorflow/tfjs-layers/dist/models.d.ts
See original GitHub issueTensorFlow.js version
+-- @tensorflow/tfjs@0.10.3
| +-- @tensorflow/tfjs-core@0.8.4
| | `-- seedrandom@2.4.3
| `-- @tensorflow/tfjs-layers@0.5.3
`-- typescript@2.8.3
Browser version
N/A
Describe the problem or feature request
Cannot import @tensorflow/tfjs
from TypeScript.
import * as tf from "@tensorflow/tfjs"
node_modules/@tensorflow/tfjs-layers/dist/models.d.ts:27:5 - error TS2416: Property 'build' in type 'Sequential' is not assignable to the same property in base type 'Model'.
Type '(inputShape?: number[] | undefined) => void' is not assignable to type '(inputShape: number[] | number[][]) => void'.
Types of parameters 'inputShape' and 'inputShape' are incompatible.
Type 'number[] | number[][]' is not assignable to type 'number[] | undefined'.
Type 'number[][]' is not assignable to type 'number[] | undefined'.
Type 'number[][]' is not assignable to type 'number[]'.
Type 'number[]' is not assignable to type 'number'.
27 build(inputShape?: Shape): void;
~~~~~
Code to reproduce the bug / link to feature request
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Results From Across the Web
TFJS throws TS2411 as error when importing using Typescript
However, I get the following error: node_modules/@tensorflow/tfjs-layers/dist/keras_format/types.d.ts:12:5 - error TS2411: Property 'config ...
Read more >tensorflowjs module cann't be compiled correctly - Super User
when I compile the project ng serve , it always gets the errors as below: ... node_modules/@tensorflow/tfjs-layers/dist/activations.d.ts(29 ...
Read more >tf in nodejs - Google Groups
One of examples errors I get after yarn start node_modules/@tensorflow/tfjs-core/dist/engine.d.ts(65,24): error TS2304: Cannot find name 'ImageData'.
Read more >Setup | TensorFlow.js
Installation from NPM and using a build tool like Parcel, WebPack, or Rollup. If you are new to web development, or have never...
Read more >Error TS1005: '>' expected. node_modules/@tensorflow/tfjs ...
node_modules/@tensorflow/tfjs-layers/dist/engine/training_utils.d.ts-angular.js. Search.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found the compile error happens if I enabled
"strictNullChecks": true
build option.The
"strictNullChecks": true
option is very useful option to prevent null dereference errors. It’s very inconvenient if I cannot use the option in all software that uses tensorflow.js.See https://stackoverflow.com/questions/40164034/typescript-strictnullchecks-with-limited-scope
In your project use the skipLibCheck option added in Typescript 2.0 to skip checking the *.d.ts files of your dependencies. This will also speed up compilation.