-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
Because TypeScript do not recognize React defaultProps, sometimes in our react+typescript project, access props.foo will cause strictNullChecks warning, even if props.foo had beed set in defaultProps.
So in our codebase, we use below code to walk around strictNullChecks warning:
let { foo } = this.props;
foo = foo!;
// then use foo in below code will not cause strictNullChecks warning.But we found after ts compile, foo = foo still left in js file, it's redundancy, IMO TypeScript compiler should auto remove it.
ref: ant-design/ant-design-mobile#1873
TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx)
Code
// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.Expected behavior:
Actual behavior:
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created