So we can do:
export function myMethod (param: number) :number
export function myMethod (param: string) :string
export function myMethod (param: string | number): string | number {
if (typeof param === 'string') {
return param.toUpperCase()
} else {
return param + 1
}
}
Can I declare and implement it with arrow function?
export var myMethodArror = (param: string): string
export var myMethodArror = (param: number): number
export var myMethodArror = (param: string | number): string | number => {
..
}
I am aware of that it is not possible to duplicate the variables declaration, but my question is: is it possible to make function overload using arrow notation?
question from:https://stackoverflow.com/questions/39187614/typescript-overload-arrow-functions