Is it possible to enforce a strict return type in TypeScript? For example, if I have the following code:
function codeToMsg(a: number): string {
if (a == 200)
return "OK";
}
let msg = codeToMsg(123456);
The compiler does not throw an error even though the function may not always return a value of type string. How can we ensure this is enforced?