diff options
Diffstat (limited to 'typescript.html.markdown')
-rw-r--r-- | typescript.html.markdown | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/typescript.html.markdown b/typescript.html.markdown index 6346a986..f8e78d44 100644 --- a/typescript.html.markdown +++ b/typescript.html.markdown @@ -227,7 +227,7 @@ moreNumbers.length = 3; // Error, length is read-only numbers = moreNumbers; // Error, mutating methods are missing // Tagged Union Types for modelling state that can be in one of many shapes -type State = +type State = | { type: "loading" } | { type: "success", value: number } | { type: "error", message: string }; @@ -275,11 +275,11 @@ let foo = {} // Creating foo as an empty object foo.bar = 123 // Error: property 'bar' does not exist on `{}` foo.baz = 'hello world' // Error: property 'baz' does not exist on `{}` -// Because the inferred type of foo is `{}` (an object with 0 properties), you +// Because the inferred type of foo is `{}` (an object with 0 properties), you // are not allowed to add bar and baz to it. However with type assertion, // the following will pass: -interface Foo { +interface Foo { bar: number; baz: string; } @@ -290,7 +290,7 @@ foo.baz = 'hello world' ``` ## Further Reading - * [TypeScript Official website] (http://www.typescriptlang.org/) - * [TypeScript language specifications] (https://github.com/microsoft/TypeScript/blob/main/doc/spec-ARCHIVED.md) - * [Learn TypeScript] (https://learntypescript.dev/) - * [Source Code on GitHub] (https://github.com/Microsoft/TypeScript) + +* [Official TypeScript website](https://www.typescriptlang.org/) +* [Source code on GitHub](https://github.com/microsoft/TypeScript) +* [Learn TypeScript](https://learntypescript.dev/) |