Complete the code to declare a function type that takes a number and returns a number.
type NumberFunc = (x: number) => [1];The function takes a number and returns a number, so the return type is number.
Complete the code to declare a higher-order function type that takes a function (number to number) and returns a function (number to number).
type HigherOrder = (fn: (x: number) => number) => [1];void as return type instead of a function type.The higher-order function returns another function that takes a number and returns a number, so the return type is (x: number) => number.
Fix the error in the function type declaration to correctly type a function that takes a function and returns void.
type Func = (callback: (msg: string) => void) => [1];void.The function takes a callback and returns nothing, so the return type is void.
Fill both blanks to declare a function type that takes a function returning a boolean and returns a function returning a string.
type ComplexFunc = (check: () => [1]) => () => [2];
void instead of the correct types.The parameter function returns a boolean, and the returned function returns a string.
Fill all three blanks to declare a higher-order function type that takes a function (string to number), returns a function taking a number and returning a boolean.
type HOF = (fn: (input: [1]) => [2]) => (arg: [3]) => boolean;
The input function takes a string and returns a number. The returned function takes a number and returns a boolean.