typescript-book
typescript-book copied to clipboard
Create a section on `definite-assignment` similar to strict null checks
Document the definite assignment operator for class properties and variables in general :
class C {
foo!: number;
// ^
// Notice this exclamation point!
// This is the "definite assignment assertion" modifier.
constructor() {
this.initialize();
}
initialize() {
this.foo = 0;
}
}
and
let x!: number[];
initialize();
x.push(4);
function initialize() {
x = [0, 1, 2, 3];
}
Ref: https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#stricter-class-property-checks
@basarat Hello, I would like to translate to Spanish but I do not know how. I would like to do it by means of pull request :)
@jossue33 You could fork this project, then join GitBook (which @basarat uses to publish this book) and add your fork from the “GitHub” option. Then you can host your translated site under your own account. @basarat would probably be able to link to it from the main book’s homepage.
@j-f1 ok thanks