hegel
hegel copied to clipboard
Function overloading with different result type
¿How I can define and implement an overloaded function with different result type?
Example:
function generate(type: 'number' | 'string') {
if (type === 'number') {
return 1234
} else {
return 'hello'
}
}
const aNumber = generate('number') // I expect the result type as number
const aString = generate('string') // I expect the result type as string
Thanks for this amazing work.
Hello. "Function overloading" is in plans, so, it will be added after we will fix known bugs. Thank you for the contribution ^_^