Type 'InputType' is not assignable to type 'Partial<INumberHash>'... and many others
What is wrong?
With Angular 17 during the compilation errors like
Error: node_modules/brain.js/dist/src/neural-network-gpu.d.ts:23:84 - error TS2344: Type 'InputType' does not satisfy the constraint 'INeuralNetworkData'. Type 'InputType' is not assignable to type 'Partial<INumberHash>'. and many others are in the bash.
IDE (VS Code) shows a lot errors inside the *.ts files. Eg.: neural-network-gpu.d.ts Property 'outputs' in type 'NeuralNetworkGPU<InputType, OutputType>' is not assignable to the same property in base type 'NeuralNetwork<InputType, OutputType>'. Type 'KernelOutput[]' is not assignable to type 'Float32Array[]'. Type 'KernelOutput' is not assignable to type 'Float32Array'. Type 'number' is not assignable to type 'Float32Array'.
Where does it happen?
Mac OS X Ventura Typescript 5.3.3 Angular 17.2.1 node 18.17.0 brain.js 2.0.0-beta.23
How do we replicate the issue?
- install Angular
npm install -g @angular/cli - create new Angular project
ng new brain-test - install brain.js
npm i --save brain.js - import brain.js to eg. app.component.ts
import { NeuralNetwork } from 'brain.js' - run angular app
ng serve
Expected behavior (i.e. solution)
Should works ;)
As we may need more information:
I am getting the same error, and importing brain.js within the Angular app will be enough to get this error.
Typescript 5.7.2 Angular 19.0.0 node 20.10.0 brain.js 2.0.0-beta.24