Skip to content

Instantly share code, notes, and snippets.

@jeffmo
Last active May 18, 2016 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffmo/528ba625bd3c69adcd88cabfae1564a9 to your computer and use it in GitHub Desktop.
Save jeffmo/528ba625bd3c69adcd88cabfae1564a9 to your computer and use it in GitHub Desktop.
let foo: ?number;
function bar() {
if (foo == null) {
return;
}
setTimeout(() => {
// I refined above, so this should work right?
// (hint: wrong. If `foo` were const, then it would be a correct/more intuitive assumption)
let someNum: number = foo;
}, offset);
}
// ...in a galaxy far far away...
foo = null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment