You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
export default class ScrollWrapper extends React.Component<PropsType, StateType> {
static defaultProps = { // <- TSLint: member-variable-declaration expected: 'defaultProps' to have a typedef (typedef)
width: 400,
height: 400,
};
state = { // <- TSLint: member-variable-declaration: 'state' to have a typedef (typedef)
init: false,
};
componentDidMount(): void { ... }
render(): React.ReactElement<'div'> { ... }
}
I think it's wrong validating, because we already put typing inReact.Component<PropsType, StateType> and it's work
type StateType = {
init: boolean;
};
export default class ScrollWrapper extends React.Component<PropsType, StateType> {
state = { // <- Error:(25, 3) TS2416: Type 'string' is not assignable to type 'boolean'.
init: '',
};
}
Example
I think it's wrong validating, because we already put typing in
React.Component<PropsType, StateType>
and it's workFurthermore, there will soon be an update https://blogs.msdn.microsoft.com/typescript/2018/07/12/announcing-typescript-3-0-rc/#default-props-support
Can we fix this?
The text was updated successfully, but these errors were encountered: