Closed
Description
This seems like a bug; but let me know if this would be better suited for SO
TypeScript Version: 2.4.1 (and prior)
Code
import * as React from 'react';
import * as dapper from '@convoy/dapper';
const STYLES = dapper.compile({
root: { padding: 10 },
});
export class App extends React.Component {
styles = dapper.reactTo(this, STYLES);
render() {
return <div className={this.styles.root}>;
}
}
Expected behavior:
Compiles without complaint
Actual behavior:
When render()
references this.styles.root
, both styles
and render
are flagged with:
'[property]' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
If I remove the reference to this.styles.root
, neither property has an error. Also, the type of styles
appears correctly inferred as { root: string }