I'm writing TypeScript code that is then compiled to Javascript, and several dynamic function calls are made directly from the browser to the Javascript, not the typescript. When you write a TypeScript function with type annotations, it will throw an error if something is of the wrong type. For example, the simple function
function add(a: number, b: number): number{
return a + b;
}
is compiled to the type-less
function add(a, b) {
return a + b;
}
Is there any option to compile it and add type-checking at the entry point of the function?