discriminated union as props

is there anything noticeably wrong with this
type SidebareOpenContentsProps = {
  showSkeletons: boolean;
  sidebarItems: MockSidebarItems | {};
} & (
  | {
      showSkeletons: true;
      sidebarItems: {};
    }
  | {
      showSkeletons: false;
      sidebarItems: MockSidebarItems;
    }
);
, when used like
        <SidebarOpenContents
          sidebarItems={status === "success" ? sidebarItems : {}}
          showSkeletons={status === "loading"}
        />


I'm getting a "false is not assignable to boolean" error, but I thought this would be the only way to use discrimnated union to type narrow properly here.
Was this page helpful?