const myFunction: () => void = () => {
console.log('I am able to export my function like this');
};
export default myFunction;
export default () => void = () => {
console.log('I am unable to export my function like this (Parsing error: Expression expected.)');
};
As you can see from the code above, it is possible to declare and assign a function in different ways. However, the arrow function cannot be exported using the same syntax with the export default
statement. Why is that?
Any insights or explanations would be greatly appreciated.