We are using strict mode.
If I do `setState({ undefinedStateKey: 123});` it warns me. Just checked. It may be linting not TypeScript. We have IState defined only as Generic Type Argument.
We define defaultProps as static in class. And you are right defaultProps are not being type-checked against Generic Type Argument IProps.
Re:A guide to useEffect in React
by littlecranky67 on Monday March 11, 2019 @07:36AM
(#19358148)
Well if you are in strict mode, it should break the build with an error, not a warning. This seems to be a linting rule.
But you see the issue with defaultProps and state here. You can basically assign anything to defaultProps or use in setState() even so you were explicit of the props type in the Generic Type Argument.
And I sure as hell bet you do not use "strict" compilation in TS, which opens typing issues everywhere.