Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
How to translate Cloud Vision function sample for firebase to javascript?

I would like to integrate cloud vision functionality into my firebase app without having to migrate my project to typescript at this time. All of my cloud functions are written in javascript. How might one translate the typescript example provided here (below for reference) to plain old javascript?

import vision from "@google-cloud/vision";

const client = new vision.ImageAnnotatorClient();

export const annotateImage = functions.https.onCall(async (data, context) => {
  if (!context.auth) {
    throw new functions.https.HttpsError(
      "unauthenticated",
      "annotateImage must be called while authenticated."
    );
  }
  try {
    return await client.annotateImage(JSON.parse(data));
  } catch (e) {
    throw new functions.https.HttpsError("internal", e.message, e.details);
  }
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I don't see any type annotations in the code you shared, so it looks like that plain-old JavaScript already. You should be able to paste it into your index.js files and use it as is.

If you ever find a file that contains type annotations and you want to use it in a pure JavaScript setting, you can use a tool like this TypeScript playground to convert TypeScript to JavaScript.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!