-
Notifications
You must be signed in to change notification settings - Fork 12.8k
noImplicitReturns control flow errors with explicit type guard checks #23271
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
Duplicate
An existing issue was already created
Comments
# for free
to subscribe to this conversation on GitHub.
Already have an account?
#.
TypeScript Version: 2.8.1 & 2.9.0-dev.20180409
Search Terms: noImplicitReturns throw type guard
Code
Expected behavior:
Type check should pass without error.
Actual behavior:
Happens only with
noImplicitReturns
turned on.getAOrThrow
errors on its return value withFunction lacks ending return statement and return type does not include 'undefined'.
.If I remove the second type guard call (
isB
) and just leave it as a catch-all else, there is no error.Playground Link:
Cannot reproduce in playground due to
noImplicitReturns
being turned off.Related Issues:
Couldn't find any.
The text was updated successfully, but these errors were encountered: