Monday, April 3, 2023

more readable typescript errors in storybook via chatGPT

 PROTIP: "Subtle" Typescript errors (like stuff that might have been hidden at best in VS Code) often show up loudly in storybook (sub-PROTIP -the "real" errors is often listed at the top, even if its mupltiplied later) but they are often flattened. ChatGPT can help though:

could you indent Type '{ idle: { alignItems: string; display: string; flexDirection: string; padding: string; border: string; backgroundColor: string; }; hover: { alignItems: string; display: string; flexDirection: string; padding: string; border: string; backgroundColor: string; }; focusVisible: { ...; }; }' is missing the following properties from type '{ idle: CardStyles; hover: CardStyles; disabled: CardStyles; active: CardStyles; focusVisible: CardStyles; }': disabled, active in a logical way

Certainly! Here's a more readable version of the error message with proper indentation:

Type '{ 
  idle: { 
    alignItems: string; 
    display: string; 
    flexDirection: string; 
    padding: string; 
    border: string; 
    backgroundColor: string; 
  }; 
  hover: { 
    alignItems: string; 
    display: string; 
    flexDirection: string; 
    padding: string; 
    border: string; 
    backgroundColor: string; 
  }; 
  focusVisible: { 
    ...; 
  }; 
}' 
is missing the following properties from type '{ 
  idle: CardStyles; 
  hover: CardStyles; 
  disabled: CardStyles; 
  active: CardStyles; 
  focusVisible: CardStyles; 
}': 
  disabled, 
  active

 

No comments:

Post a Comment