I am trying to convert a javascript code file to a typescript file, however, I have difficulties doing it when meeting to modify a function through the variable reference.
In javascript, the code was written as:
Object.getPrototypeOf(ctx).rounded_rect = function(){
}
where ctx
is a canvas rendering context 2d varibale
How do I convert this code to typescript code? When I copy and paste it to typescript file, it shows error saying Property 'rounded_rect' does not exist on type 'CanvasRenderingContext2D'.
Also, what is this line of code called?