Created
August 26, 2016 22:33
-
-
Save maritz/e990a61173b5440b0e68b9b695ad718d to your computer and use it in GitHub Desktop.
strict null checks with function that always sets non-null (.js extension simply for highlighting... this is typescript)
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 foo: null | string = null; | |
function setFoo(newFoo = 'bar') { | |
foo = 'baz' + newFoo; | |
} | |
setFoo(); | |
console.log(foo.match('ba')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment