Complete the code to extract the type of elements from the array.
type ElementType = Extract<[1], string[]>;The Extract utility type extracts from the first type those types that are assignable to the second. Here, it extracts string[] from the union.
Complete the code to extract only the string literal types from the union.
type OnlyStrings = Extract<'a' | 1 | true, [1]>;
The Extract type keeps only the types assignable to string, so only the string literals remain.
Fix the error in the code to correctly extract the function type from the union.
type FuncType = Extract<() => void | string, [1]>;Function which is too broad.The Extract type extracts the function type () => void from the union.
Fill both blanks to extract only the number types from the union and assign it to the variable.
type NumbersOnly = Extract<[1], [2]>;
The first blank is the union type containing strings, numbers, and booleans. The second blank is number to extract only number types.
Fill all three blanks to extract the types assignable to string or boolean from the union.
type Extracted = Extract<[1], [2] | [3]>;
number instead of boolean.The first blank is the union type with string, number, and boolean literals. The second and third blanks are string and boolean to extract those types.