Complete the code to declare a variable of type string in a declaration file.
declare let message: [1];The declare keyword is used to declare variables in a declaration file. Here, message is declared as a string.
Complete the code to declare a function that takes a number and returns a string.
declare function formatNumber(value: [1]): string;The function formatNumber takes a parameter value of type number and returns a string.
Fix the error in the interface declaration by completing the property type.
interface User {
id: [1];
name: string;
}The id property is usually a number to uniquely identify a user.
Fill both blanks to declare a module and export a constant string.
declare module "myModule" { export const version: [1]; export function getName(): [2]; }
The constant version and the return type of getName are both string types.
Fill all three blanks to declare a namespace with an interface and a function.
declare namespace Utils {
interface Logger {
log(message: [1]): void;
}
function createLogger(level: [2]): Logger;
const defaultLevel: [3];
}number for log message or logging level.The log method takes a string message. The level parameter and defaultLevel constant are boolean to indicate if logging is enabled or not.