Extract<T, U> keeps only the members of union T that are assignable to U. Exclude<T, U> removes from T those assignable to U.
Implement filterByType(values, type) at runtime — it takes an array of mixed values and a type string ("string" | "number" | "boolean") and returns only the values of that type.
Examples
filterByType([1, 'a', true, 2, 'b'], 'number') → [1, 2]filterByType([1, 'a', true, 2, 'b'], 'string') → ['a', 'b']filterByType([1, 'a', true], 'boolean') → [true]Sample tests