Skip to content

Instantly share code, notes, and snippets.

@isaacbatst
Created November 4, 2022 19:01
Show Gist options
  • Save isaacbatst/df9b9fe6ac464ddbdf8c3eb38f123e55 to your computer and use it in GitHub Desktop.
Save isaacbatst/df9b9fe6ac464ddbdf8c3eb38f123e55 to your computer and use it in GitHub Desktop.
// "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