JSFiddle - React, Tailwind, and code Playground
TypeScript
const foo = (x: number) => {
console.log("foo")
return x * x;
}
const isXUndefined = (x?: number) => x === undefined;
const boo = (x?: number) => {
if (isXUndefined(x)) {
return 0;
}
return foo(x!);
}
console.log(boo(1))