3 ms·
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 on
by ponyous 8y ago
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.
- littlecranky67 8y agoWell 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.