Skip to content

Get data from API in Custom function #1119

@callmehero

Description

@callmehero

Description

I am using runfunction in FunctionPlugin for showing API result. but it not working as expected due to return executed before the api response.

SO I used to promise inside the fn param but it showing this error

ERROR:
Argument of type ‘(result: any) => Promise’ is not assignable to parameter of type ‘(…arg: any) => InterpreterValue’.
Type ‘Promise’ is not assignable to type ‘InterpreterValue’.ts(2345)

Steps to reproduce

return this.runFunction(

ast.args,

state,

this.metadata("VLOOKUPSHEETFN"),

(param) => {

let item = this.paramFn();

console.log("skjdbvds", item);

return new Promise((resolve, reject) => {
return item = Api call result
});

return Hello , ${item}!;

},

);

Demo

Your environment

angular 13

  • HyperFormula version: 12.0.1 (handsontable version)
  • Browser Name and version: chrome latest
  • Operating System: Windows

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions