You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 20, 2023. It is now read-only.
Gives you an 'imageContext' does not exist in type 'ImprovedRequest | Buffer' TypeScript error.
Description
That might not be an issue only for the cropHints feature, but any ImageAnnotatorClient feature which method signature is equivalent/limited to (request: string | ImprovedRequest | Buffer).
The request actually works fine if you simply cast the method parameter through client.cropHints({ image: { source: { filename } }, imageContext: {} } as any): the imageContext is passed down to the underlying service and used as one could expect to generate the response.
Environment details
@google-cloud/visionversion: 2.4.0Steps to reproduce
Gives you an
'imageContext' does not exist in type 'ImprovedRequest | Buffer'TypeScript error.Description
That might not be an issue only for the
cropHintsfeature, but any ImageAnnotatorClient feature which method signature is equivalent/limited to(request: string | ImprovedRequest | Buffer).The appropriate JSON representation is documented here: https://cloud.google.com/vision/docs/reference/rest/v1/AnnotateImageRequest where we can see that
imageContextis possible, yet not in this packageImprovedRequestinterface. Then one could drill it down to https://cloud.google.com/vision/docs/reference/rest/v1/ImageContext to actually provide a thorough interface.Workaround
The request actually works fine if you simply cast the method parameter through
client.cropHints({ image: { source: { filename } }, imageContext: {} } as any): the imageContext is passed down to the underlying service and used as one could expect to generate the response.