-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] TypeScript example project and guide to withStyles #8694
Conversation
1ef6e1a
to
764fccd
Compare
620a3c6
to
45b454f
Compare
989bfd4
to
6ed02b1
Compare
6ed02b1
to
fbf0484
Compare
@pelotom Thanks, this is a great first iteration! Let's see the feedback we can get :). |
@pelotom Thanks for the work on this Guide. Quick question, why when using some JSS properties such as
Is this something you have encountered? |
@stevegeek I'm going to guess your code looks something like this: const decorate = withStyles(theme => ({
root: {
justifyContent: 'center'
}
})); The problem is that TypeScript is inferring the type of const styles: StyleRulesCallback<'root'> = theme => ({
root: {
justifyContent: 'center'
}
});
const decorate = withStyles(styles); const decorate = withStyles(theme => ({
root: {
justifyContent: 'center'
} as React.CSSProperties
})); const decorate = withStyles<'root'>(theme => ({
root: {
justifyContent: 'center'
}
})); |
@pelotom Interesting, thanks for that. I wonder why it seems to be able to infer the string as the type literals in certain cases and not others (eg |
I opened a TypeScript bug about this: microsoft/TypeScript#19360 |
@stevegeek textAlign?: CSSWideKeyword | any; Note the |
@pelotom Great, interesting to see what they say |
This includes a port of the
create-react-app-with-flow
example to TypeScript, as well as a guide to usingwithStyles
. Resolves #8598.