Problem receiving data on a promise

0

I ask this question because I have a problem when it comes to receiving some data in a promise.

return res.status(200).send({message: 'Se ha subido el archivo de video satisfactoriamente.', video: updatedVideo, file_name: file_name});

That's what the video controller returns, made in NodeJs.

        (result) => {
            console.log(result);
            this.video.setFile(result.file_name);
            alert('Se ha actualizado el video del registro.');
        },

and this is the part of TypeScript in which I receive the name of the file. But when I'm going to run the application it tells me this error:

  

TS2339 error: Property 'file_name' does not exist on type '{}'.

The fact is that once I have run it, commenting on the phrases that caused the error, and causing it to appear in the console "result" I receive perfectly file_name, etc. Anyone who can help me receive that: "file_name" correctly? Thanks in advance.

    
asked by H. Díaz 09.10.2017 в 14:12
source

1 answer

0

I have managed to access the value I needed in this way:

(result) => {
        console.log(result);
        this.video.image = result['file_name'];
        alert('Se ha actualizado la imagen del registro.');
},

Thank you very much aldanux for the attention provided.

    
answered by 09.10.2017 в 15:02