My Google Cloud function is simple and looks like this:
import * as functions from 'firebase-functions';
var util = require('util')
export const repeat = functions.https.onCall(
function (data, context) {
console.log(' repeat1 '+ util.inspect(data) + util.inspect(context) );
return { fld1: 'xyz', fld2: 10};
}
);
I am attempting to separate the function by trying the following approach:
import * as functions from 'firebase-functions';
var util = require('util')
export const repeat = functions.https.onCall(
xyzFunction
);
function xyzFunction(data: any, context: CallableContext)
{
console.log(' repeat1 '+ util.inspect(data) + util.inspect(context) );
return { fld1: 'xyz', fld2: 10};
}
However, I encounter an error. While I can solve it using any, the https.d.ts file declares it as CallableContext, so I'd like to maintain the same type. Coming from a Java background, I am unsure of what import I should use.
TS2304: Cannot find name 'CallableContext'