We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript Version: 2.5.3
Code
declare const obj: { props?: string[] } obj.props // string[] | undefined if (obj.props) { obj.props // string[] obj.props.forEach(p => obj.props // string[] | undefined <-- Expected string[] ) }
Expected behavior: obj.props inside forEach callback to be string[]
obj.props
forEach
string[]
Actual behavior: obj.props inside forEach callback goes back to possibly undefined, leading to errors if not again type guarded
The text was updated successfully, but these errors were encountered:
Please see #10982
Sorry, something went wrong.
Thanks, seems TS was telling me something I missed after all :)
No branches or pull requests
TypeScript Version: 2.5.3
Code
Expected behavior:
obj.props
insideforEach
callback to bestring[]
Actual behavior:
obj.props
insideforEach
callback goes back to possibly undefined, leading to errors if not again type guardedThe text was updated successfully, but these errors were encountered: