infer icon indicating copy to clipboard operation
infer copied to clipboard

Generating type annotations

Open jarble opened this issue 3 years ago • 0 comments

Is infer able to generate type annotations for JavaScript functions?

It would be useful to have a tool that could transform a JavaScript function like this:

function distance_formula(x1,y1,x2,y2){
    return Math.sqrt(Math.pow((x1-x2),2.0)+Math.pow((y1-y2),2.0));
}

and generate type annotations like this (using TypeScript syntax):

function distance_formula(x1:number,y1:number,x2:number,y2:number):number{
    return Math.sqrt(Math.pow((x1-x2),2.0)+Math.pow((y1-y2),2.0));
}

jarble avatar Dec 04 '20 04:12 jarble