In the preceding section, we have used the ReturnType type to extract the return type of a given function. The ReturnType type is included as a built-in type. TypeScript 2.8 includes many other types:
// Exclude from T those types that are assignable to Utype Exclude<T, U> = T extends U ? never : T;// Extract from T those types that are assignable to Utype Extract<T, U> = T extends U ? T : never;// string[] | number[]type Foo2 = Extract<boolean | string[] | number[], any[]>;// booleantype Bar2 = Exclude<boolean | string[] | number[], any[]>;// Exclude null and undefined from Ttype NonNullable<T> = T extends null | undefined ? never : T;// Obtain the return type of a function typetype ReturnType<T extends (...args: ...