Skip to content

Commit 9a1246f

Browse files
committed
minor reversings
1 parent 5693bfd commit 9a1246f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

docs/destructuring.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ To assign an extracted variable to a new variable name you can do the following:
3636

3737
```ts
3838
// structure
39-
const obj = {"key": "value"};
39+
const obj = {"some property": "some value"};
4040

4141
// destructure
42-
const {"key": newKey} = obj;
43-
console.log(newKey === "value"); // true
42+
const {"some property": someProperty} = obj;
43+
console.log(someProperty === "some value"); // true
4444
```
4545

4646
Additionally you can get *deep* data out of a structure using destructuring. This is shown in the following example:

docs/enums.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ i.e. the compiler:
228228
1. *Inlines* any usages of the enum (`0` instead of `Tristate.False`).
229229
1. Does not generate any JavaScript for the enum definition (there is no `Tristate` variable at runtime) as its usages are inlined.
230230

231-
##### Const Enums and --preserveConstEnums
231+
##### Const enum preserveConstEnums
232232
Inlining has obvious performance benefits. The fact that there is no `Tristate` variable at runtime is simply the compiler helping you out by not generating JavaScript that is not actually used at runtime. However you might want the compiler to still generate the JavaScript version of the enum definition for stuff like *number to string* or *string to number* lookups as we saw. In this case you can use the compiler flag `--preserveConstEnums` and it will still generate the `var Tristate` definition so that you can use `Tristate["False"]` or `Tristate[0]` manually at runtime if you want. This does not impact *inlining* in any way.
233233

234234
### Enum with static functions

docs/tips/statefulFunctions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int main () {
1818
Since JavaScript (or TypeScript) doesn't have function statics you can achieve the same thing using various abstractions that wrap over a local variable e.g. using a `class` :
1919

2020
```ts
21-
const {called} = new class { // using object destructuring
21+
const {called} = new class {
2222
count = 0;
2323
called = () => {
2424
this.count++;

0 commit comments

Comments
 (0)