nodejs-vision icon indicating copy to clipboard operation
nodejs-vision copied to clipboard

Why do the methods return an array containing the results?

Open SametSahin10 opened this issue 3 years ago • 0 comments

I'm trying to use ImageAnnotatorClient to annotate images. I've realized that the methods that are called on the ImageAnnotatorClient instance return Promise<[protoTypes.google.cloud.vision.v1.IAnnotateImageResponse]>. And in the examples the result is assigned and used like below:

const [result] = await client.labelDetection('./resources/wakeupcat.jpg');
const labels = result.labelAnnotations;

What is the reason of this? Why do methods not return Promise<[protoTypes.google.cloud.vision.v1.IAnnotateImageResponse]> directly?

SametSahin10 avatar Mar 13 '22 22:03 SametSahin10