Generic Type Aliases in TypeScript
samundrak
JavaScript Dev- You can set generic in function by doing
Function <T> trigger(event: Event<T>){ return event.target; }
and here type of Event is typeEvent<T> = { target: T }
Function <T> trigger(event: Event<T>){ return event.target; }
and here type of Event is type Event<T> = { target: T }
TS tuples are the same as an array but are subtypes of the array. Tuple can be defined in a special way that has fixed lengths where the values at each index have a specific and known value. Tuples have to be