operational-ui icon indicating copy to clipboard operation
operational-ui copied to clipboard

Table loose type safety when stylized

Open fabien0102 opened this issue 6 years ago • 0 comments

Problem

If we use styled(Table)({}), the resulted component is not type safe anymore, and also not really styled.

Snippet

const MyPimpTable = styled(Table)`
  backgroundcolor: pink; /* Because it's girly ! */
`;

const data = [
  { name: "dora", isGirly: true },
  { name: "batman", isGirly: false },
  { name: "barby", isGirly: true }
];

const App = () => (
  <OperationalUI>
    {/* This is type safe */}
    <Table data={data} columns={["name", "plop"]} />
    {/* This is NOT type safe, and also not girly… */}
    <MyPimpTable data={data} columns={["name", "plop"]} />
  </OperationalUI>
);

Codesandbox

Edit n7rl7y03km

fabien0102 avatar Nov 16 '18 14:11 fabien0102