Reputation: 35483
Support there is some value:
let value: string | null;
then somewhere along the way I'm certain that it's never null. But there is a function that expects a non-nullable type:
function my_func(arg: string){}
How do I tell TypeScript that my value is alright for it?
my_func(value);
// Argument of type 'string | null' is not assignable
// to parameter of type 'string'
Upvotes: 0
Views: 303