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
interfaceRangeProps{range?: false;onApply?: (value: Date)=>void;}interfaceSingleProps{range: true;onApply?: (value: [Date,Date])=>void;}typeCalendarProps=RangeProps|SingleProps;functionapply(props: CalendarProps){if(props.onApply){if(props.range){// Should work as already inside props.onApply check.props.onApply([newDate(),newDate()]);}else{// Should work as already inside props.onApply check.props.onApply(newDate());}}}
Expected behavior:
Above code should not throw error.
Actual behavior:
Error at lines after comment: Cannot invoke an object which is possibly 'undefined'.
TypeScript Version: 3.4.0-dev.20190202
Search Terms: Conditional Resolution, Optionals
Code
Expected behavior:
Above code should not throw error.
Actual behavior:
Error at lines after comment: Cannot invoke an object which is possibly 'undefined'.
Playground Link:
Related Issues:
Tried my best, sorry but could not find any
Please also change/suggest the title of issue if it does not reflect on the error.
The text was updated successfully, but these errors were encountered: