VSCODE console error

0

I have this error in VSCODE .

ERROR in src/app/paginas/arquivo/arquivo-form/arquivo-form.component.ts(93,20): error TS2339: Property 'total' does not exist on type 'HttpEvent<{}>'.

Property 'total' does not exist on type 'HttpSentEvent'.
src/app/paginas/arquivo/arquivo-form/arquivo-form.component.ts(93,34): error TS2339: Property 'loaded' does not exist on type 'HttpEvent<{}>'.

Property 'loaded' does not exist on type 'HttpSentEvent'.
src/app/paginas/arquivo/arquivo-form/arquivo-form.component.ts(99,38): error TS2339: Property 'partialText' does not exist on type 'HttpEvent<{}>'.

Property 'partialText' does not exist on type 'HttpProgressEvent'.

But there is no error in the console when running.

this.arquivoService.salvarArquivo(this.currentFileUpload, this.arquivoSalvar).map(res => res).
      subscribe(event => {
        console.log(event);
        var tipoRetorno : boolean = false;
        if (event.type === HttpEventType.UploadProgress) {
          this.progress.percentage = Math.round(100 * event.loaded / event.total);
        } else if (event instanceof HttpResponse) {
          console.log('File is completely uploaded!');
        }
        if (event.type == 1){
          if(event.total > event.loaded){
            this.openSnackBar("Tamanho do Arquivo maior que o permitido !", tipoRetorno);
          }
        } else {
          if (event.type == 3){
            console.log(event);
            var array = String(event.partialText).split(",");
            var mensagem = String(array[4].replace('"', '').replace('"', '').replace('"', '').replace('"', '')).split(":");
            if(mensagem[1] != "ERRO"){
              tipoRetorno = true;
            }
            var mensagem = String(array[0].replace('"', '').replace('"', '').replace('"', '').replace('"', '')).split(":");
            this.openSnackBar(mensagem[1], tipoRetorno);
            if(mensagem[1] != "ERRO"){
              this.voltar();
            }
          }
        }
      }
    )

By debugging through the browser console, it returns these variables, so it builds the code. How can I resolve so that VSCODE does not show the error?

    
asked by anonymous 11.04.2018 / 12:25

0 answers