I’ve successfully added a number of addFormula’s to my code using a combination of reused parameters and local parameters. On my latest formula, I’m getting a “Failed Typescript validation” on my execute statement but I’ve verified all my ParameterType’s are String and all my other POST api calls are also returning: resultType: coda.ValueType.String
Any suggestions would be appreciated
Here is the relevant code:
const usingParameter = coda.makeParameter({
…
const customerIDParameter = coda.makeParameter({
type: coda.ParameterType.String,
name: “customerid”,
description: “A unique string which all charges from the same customer share.”,
});
const billingEmailParameter = coda.makeParameter({
type: coda.ParameterType.String,
name: “billingEmail”,
description: “The email address of the customer to send an invoice to.”,
});
…
});pack.addFormula({
name: “Update_Customer”,
description: “Update customer emails and invoicing type in ChargeDesk”,
resultType: coda.ValueType.String,
isAction: true,parameters: [
customerIDParameter,
billingEmailParameter,
coda.makeParameter({
type: coda.ParameterType.String,
name: “contactEmail”,
description: “Primary contact email address”
}),
coda.makeParameter({
type: coda.ParameterType.String,
name: “chargeTiming”,
description: “Timing of client invoicing / charging”
}),
],execute: async function ([customerid, billingEmail, contactEmail, chargeTiming], context) {
let response = await context.fetcher.fetch({
method: “POST”,
url: “https://api.chargedesk.com/v1/customers/” + customerid,
form: {
‘send_email_to’: billingEmail,
‘email’: contactEmail,
‘description’: chargeTiming,
},
});
return response;
},
});
Here is the error message I’m getting:
On line 251 Type ‘([customerid, billingEmail, contactEmail, chargeTiming]: ParamValues<[ParamDefFromOptionsUnion<ParameterType, { type: ParameterType.String; name: string; description: string; }>, ParamDefFromOptionsUnion<ParameterType, { …; }>, ParamDefFromOptionsUnion<…>, ParamDefFromOptionsUnion<…>]>, context: ExecutionConte…’ is not assignable to type ‘({ (params: ParamValues<[ParamDefFromOptionsUnion<ParameterType, { type: ParameterType.String; name: string; description: string; }>, ParamDefFromOptionsUnion<ParameterType, { …; }>, ParamDefFromOptionsUnion<…>, ParamDefFromOptionsUnion<…>]>, context: ExecutionContext): string | Promise<…>; (params: ParamVal…’. Type ‘([customerid, billingEmail, contactEmail, chargeTiming]: ParamValues<[ParamDefFromOptionsUnion<ParameterType, { type: ParameterType.String; name: string; description: string; }>, ParamDefFromOptionsUnion<ParameterType, { …; }>, ParamDefFromOptionsUnion<…>, ParamDefFromOptionsUnion<…>]>, context: ExecutionConte…’ is not assignable to type ‘{ (params: ParamValues<[ParamDefFromOptionsUnion<ParameterType, { type: ParameterType.String; name: string; description: string; }>, ParamDefFromOptionsUnion<ParameterType, { …; }>, ParamDefFromOptionsUnion<…>, ParamDefFromOptionsUnion<…>]>, context: ExecutionContext): string | Promise<…>; (params: ParamValu…’. Type ‘([customerid, billingEmail, contactEmail, chargeTiming]: ParamValues<[ParamDefFromOptionsUnion<ParameterType, { type: ParameterType.String; name: string; description: string; }>, ParamDefFromOptionsUnion<ParameterType, { …; }>, ParamDefFromOptionsUnion<…>, ParamDefFromOptionsUnion<…>]>, context: ExecutionConte…’ is not assignable to type ‘{ (params: ParamValues<[ParamDefFromOptionsUnion<ParameterType, { type: ParameterType.String; name: string; description: string; }>, ParamDefFromOptionsUnion<ParameterType, { …; }>, ParamDefFromOptionsUnion<…>, ParamDefFromOptionsUnion<…>]>, context: ExecutionContext): string | Promise<…>; (params: ParamValu…’. Type ‘Promise<FetchResponse>’ is not assignable to type ‘string | Promise’. Type ‘Promise<FetchResponse>’ is not assignable to type ‘Promise’. Type ‘FetchResponse’ is not assignable to type ‘string’.