feat(overload): Use typescript-rtti to select implementations #4
@ -6,7 +6,10 @@ const adder = overload([
|
||||
throw new TypeError('Can only add numbers')
|
||||
},
|
||||
(x: string, y: string) => 'Yay' + x + y
|
||||
])
|
||||
] as const)
|
||||
|
||||
console.log(adder(1, 2))
|
||||
console.log(adder('a', 'b'))
|
||||
//@ts-expect-error
|
||||
console.log(adder(3n, 4n))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user