The following code in Kotlin return out of the parent function if the result of nextbitmap() is null
val bitmap = nextbitmap() ?: return
// something the relies on bitmap not being null
What is the Typescript equivalent of such operator ?
There is no such operator, and return can never be part of an expression. In TypeScript, you'll have to use a separate if statement for this:
const bitmap = nextbitmap();
if (!bitmap) return;
// something the relies on bitmap not being null
(or use bitmap != null in the condition, if bitmap has a primitive type)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With