When working with Typescript, encountering a duplicate type error can be frustrating. For instance, consider the following code snippet:
export type Action<T> = (arg:T) => void
export type Action<T1,T2> = (arg1:T1, arg2:T2) => void
How can we define a generic Action type similar to .net that allows for a variable number of arguments, each with a different type?
One potential solution I have come across is described below:
export type Action1<T> = (arg:T) => void
export type Action2<T1,T2> = (arg1:T1, arg2:T2) => void