brain.js icon indicating copy to clipboard operation
brain.js copied to clipboard

Type 'InputType' is not assignable to type 'Partial<INumberHash>'... and many others

Open tomas-javurek opened this issue 1 year ago • 0 comments

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 ;)

tomas-javurek avatar Feb 20 '24 15:02 tomas-javurek