I get the following error in my application (npm 5.4.2, react 15.4, typescript 2.5.3, webpack 2.2.1, webpack-dev-server 2.4.1).
This will work:
The answer by superluminary doesn't work if you have nested style objects. In this case you can create a type:
import React, { CSSProperties } from 'react';
export interface StylesDictionary{
[Key: string]: CSSProperties;
}
And use it like so:
const styles:StylesDictionary = {
someStyle:{
display:'flex',
justifyContent:'center',
},
someOtherStyle:{
display:'flex',
justifyContent:'center',
alignItems:'center',
}
}
And then: