1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-09-28 15:29:01 +02:00

[typescript/*] remove dead links and format

This commit is contained in:
Boris Verkhovskiy
2024-04-18 21:34:40 -07:00
parent 51ff67f3a9
commit baf63b1f08
12 changed files with 64 additions and 87 deletions

View File

@@ -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/)