Type 'string' is not assignable to type '"inherit" | "initial" | "unset" | "fixed" | "absolute" | "static" | "relative" | "sticky"' : <p>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).</p>

<p>This will work:</p>

<pre><code>&lt;div style={{position: 'absolute'}}&gt;working&lt;/div&gt;
</code></pre>

<p>This will not compile:</p>

<pre><code>const mystyle = {
    position: 'absolute'            
} 

&lt;div style={mystyle}&gt;not working&lt;/div&gt;
</code></pre>

<p>The compile error is:</p>

<pre><code>ERROR in ./src/components/Resource.tsx
(61,18): error TS2322: Type '{ style: { position: string; }; children: string; }' is not assignable to type 'DetailedHTMLProps&lt;HTMLAttributes&lt;HTMLDivElement&gt;, HTMLDivElement&gt;'.
  Type '{ style: { position: string; }; children: string; }' is not assignable to type 'HTMLAttributes&lt;HTMLDivElement&gt;'.
    Types of property 'style' are incompatible.
      Type '{ position: string; }' is not assignable to type 'CSSProperties'.
        Types of property 'position' are incompatible.
          Type 'string' is not assignable to type '"inherit" | "initial" | "unset" | "fixed" | "absolute" | "static" | "relative" | "sticky"'.
webpack: Failed to compile.
</code></pre>

<p>But what't the difference? 
I can fix it with: </p>

<pre><code>const mystyle = {
    position: 'absolute' as 'absolute'            
} 
</code></pre>

<p>but is this a good solution? </p>

<p>I don't have this problem with other style/css properties.</p>

<p>I found a similar problem on github: 
<a href="https://github.com/Microsoft/TypeScript/issues/11465" rel="noreferrer">https://github.com/Microsoft/TypeScript/issues/11465</a>
but if understand it right, it was a typescript bug in an ealier version. </p>

<p>Any help appreciated.</p>
