Created
November 4, 2022 19:01
-
-
Save isaacbatst/df9b9fe6ac464ddbdf8c3eb38f123e55 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
// "strictPropertyInitialization": false, | |
class Person { | |
name: string | |
} | |
const person = new Person(); | |
// erro no runtime: cannot read properties of undefined, reading "length" | |
person.name.length | |
// "strictPropertyInitialization": true (padrão, basta remover a regra), | |
class Person { | |
name: string | |
// erro no compile time: A propriedade 'name' não tem nenhum inicializador e não está definitivamente atribuída no construtor. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment