Typescript handy types

type ExtractArg<T> = T extends (arg: infer U) => any ? U : T;

type MapTuple<Tuple extends [...any[]]> = {
  [Index in keyof Tuple]: ExtractArg<Tuple[Index]>;
};

© 2020 DevDojo LLC. All rights reserved.