Last active
June 21, 2019 16:40
-
-
Save dagda1/bad226eff297bf332517ed837b5f3faf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
interface Foo { | |
value?: string; | |
} | |
const item1: Foo = { value: 'foo' } | |
// ERROR: Object is possibly 'undefined'. | |
console.log(`Message ${item1.value.substring(4)}`); | |
const item2 = { value: 'foo' } | |
// all good in the hood | |
console.log(`Message ${item2.value.substring(4)}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment