[Vuejs]-Typescript: dynamic list from tuple array without an intersection

0👍

Given that the error says "reference to an interface or literal type", I’m under the assumption that defining ButtonProps as an interface extending a base type should work:

type IntentAndSize = {
  [K in IntentType as `${Lowercase<K>}`]?: boolean;
};

interface ButtonProps extends IntentAndSize {
  intent?: IntentType;
  size?: SizeType;
}

Playground

Leave a comment