Last active
April 19, 2016 17:41
-
-
Save joshaber/9880c708157f42bbeec1f3afa9ea07e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let thing: ?string = ... // `thing` is a nullable string | |
if (thing) { | |
// Within this `if`, `thing` is of type `string`. No longer nullable. | |
} | |
// Outside the `if`, `thing` is still a nullable string. | |
if (!thing) return | |
// Since we returned if `thing` is null, `thing` is now of type `string`. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment