This is a type predicate - if x is "truthy", then it's T.

This can be used with Array's .filter() method to remove non-truthy values from an array, e.g.

const array = [0, 5, false, true, "", "hello", undefined, null]; const truthyArray = array.filter(isTruthy);

truthyArray will be [5, true, "hello"] and will have the following type: Array<string | number | true>.