I get a tslint error when I use any to pass the state in my React application written in typescript to a function.
no-any: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
class AssetDrillDown extends React.Component<{}, IDetailsListAssetsState> {
constructor(props: {}) {
super(props);
this.state = {
items: _items
};
}
public componentDidMount(): void {
this.getData(this);
}
public getData(that: any): void {
// not relevant code
that.setState({items: _items});
}
}
I would like to not use any, and use a type to fix this issue. How can I do that, please guide.