Material-ui: [withStyles] [typescript] flexDirection column is not a valid type

Created on 19 Jun 2019  路  2Comments  路  Source: mui-org/material-ui

Expected Behavior 馃


It was expected that the "column" value would be accepted in the flexDirection property in a styles object of the withStyles function. As in the MDN definitions.

Current Behavior 馃槸


The Typescript is currently returning:
Argument of type '{ root: { flexDirection: string; }; }' is not assignable to parameter of type 'Styles<Theme, {}, "root">'.

Steps to Reproduce 馃暪


Reproduction.

| Tech | Version |
|--------------|---------|
| Material-UI | v4.1.1 |
| React | v16.8.6 |
| TypeScript | v3.5.2 |

question typescript

Most helpful comment

I have the exact same issue when using makeStyles or createStyles.

All 2 comments

This is a common pitfall caused by TypeScript's type-widening by default. See Using createStyles to defeat type widening for more information on how to prevent those issues.

I have the exact same issue when using makeStyles or createStyles.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

activatedgeek picture activatedgeek  路  3Comments

mattmiddlesworth picture mattmiddlesworth  路  3Comments

sys13 picture sys13  路  3Comments

rbozan picture rbozan  路  3Comments

ryanflorence picture ryanflorence  路  3Comments