I know that you can declare a type as nullable in typescript
But this doesn't force the user to do a null check, e.g.
function maybeReturnString(): string | null { ... }
function getOnlyString(str: string) { ... }
const maybeString = maybeReturnString();
getOnlyString(maybeString) // OK
What's the proper way to make the build fail in case I don't check for null?
Is there something similar to Option[String] in Scala or String? in Kotlin?