Complete the code to declare a callback type that takes a number and returns void.
type Callback = (num: number) => [1];The callback function returns void because it does not return any value.
Complete the code to define a function that accepts a callback with a string parameter.
function greet(callback: (message: [1]) => void) { callback('Hello!'); }
The callback expects a string parameter because it receives a greeting message.
Fix the error in the callback type to accept two parameters: a number and a string.
type MyCallback = ([1]) => void;The callback must accept two parameters: a number and a string, separated by a comma.
Fill both blanks to declare a callback type that takes a boolean and returns a number.
type BoolToNum = (flag: [1]) => [2];
The callback takes a boolean and returns a number.
Fill all three blanks to define a function that accepts a callback with two parameters and returns void.
function processData(callback: ([1]: number, [2]: string) => [3]) { callback(42, 'data'); }
The callback parameters are named id and name, and the return type is void.