Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

218
Visualizações
Cannot Find Name Long

I am trying to design software on angular that guess the correct written word correctly using tensorflow.js with angular

app.component.ts

import { Component, ViewChild, OnInit } from '@angular/core';

import * as tf from '@tensorflow/tfjs';
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {

linearModel?: tf.Sequential;
prediction: any;



  ngOnInit(){
    // this.trainNewModel();

   }
//   async trainNewModel(){

//     this.linearModel = tf.sequential();

//     this.linearModel.add(tf.layers.dense({
//       units: 1,
//       inputShape:[1]
//     }));

//     this.linearModel.compile({
//       loss: 'meanSquareError',
//       optimizer: 'sgd'
//     });


//     const xs = tf.tensor1d([3.2,4.4,5.5,6.71,6.98,7.168,9.779,7.59,2.16]);
//     const ys = tf.tensor1d([1.6,2.7,2.9,3.19,1.684,2.53,3.366,2.596,2.53,1.22]);

//     await this.linearModel.fit(xs,ys);


//     console.log('model trained!');


//   }


// linearPrediction(val:any){
//   const output = this.linearModel.predict(tf.tensor2d([val], [1, 1])) as any;
//   this.prediction = Array.from(output.dataSync())[0]
// }


 }



app.component.html

<!--
<h4> preicted value: {{ prediction }}</h4>

<input type = "number" (change)= "linearPrediction()"> -->

the error looks like this

ERROR

node_modules/@tensorflow/tfjs-core/dist/hash_util.d.ts:2:49 - error TS2304: Cannot find name 'Long'.

2 export declare function hexToLong(hex: string): Long;
                                                  ~~~

I couldn't find the right documentation that clearly state the usage of tensorflow.js on angular; could anyone please show me?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Nothing to do with AngularJS, its due to TypeScript strict type checks being enabled globally in your project for all dependencies, not just your code

And this is a known issue - TFJS is written using old TS 3.x and typedefs are not fully up to par

Best suggestion is to disable type checks on items inside TFJS by setting skipLibCheck=true in your tsconfig.json

But if you really want to use type checks on TS, good luck - and you'll need to include long@4.0.0 as a dependency in your app (newest version long@5.x is NOT compatible)

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda