I am working with TypeScript and I want to design a module where a function is exported along with some additional functions added to it. Here is an example:
export default function log(msg: string) {
console.log(msg);
}
//Property 'warn' does not exist on type '(msg: string) => void'.
log.warn = function(msg: string) {
console.warn(msg);
};
To use this, you would do the following:
log('test');
log.warn('test');
How can I inform TypeScript that my function object includes extra properties so that it doesn't trigger the error message
Property 'warn' does not exist on type '(msg: string) => void'.
?