Skip to content

Commit

Permalink
fixing typo in Inference example comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dennybiasiolli committed Oct 1, 2019
1 parent 555553c commit 5fc508e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions chapters/More on Functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ function map<E, O>(arr: E[], func: (arg: E) => O): O[] {
return arr.map(func);
}

// Parameter 'n' is of type 'number'
// 'parsed' is of type 'string[]'
// Parameter 'n' is of type 'string'
// 'parsed' is of type 'number[]'
const parsed = map(["1", "2", "3"], n => parseInt(n));
```

Expand Down
4 changes: 2 additions & 2 deletions docs/chapters/more-on-functions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ <h3 id="inference"><a href="#inference">Inference</h3></a>
<span class="tm-kw">return</span> <span class="tm-vr">arr</span>.<span class="tm-mth">map</span>(<span class="tm-vr">func</span>);
}

<span class="tm-cmt">// Parameter 'n' is of type 'number'</span>
<span class="tm-cmt">// 'parsed' is of type 'string[]'</span>
<span class="tm-cmt">// Parameter 'n' is of type 'string'</span>
<span class="tm-cmt">// 'parsed' is of type 'number[]'</span>
<span class="tm-kw">const</span> <span class="tm-vr">parsed</span> = <span class="tm-mth">map</span>([<span class="tm-str">"1"</span>, <span class="tm-str">"2"</span>, <span class="tm-str">"3"</span>], <span class="tm-vr">n</span> <span class="tm-kw">=></span> <span class="tm-mth">parseInt</span>(<span class="tm-vr">n</span>));<a class="playground-link" href="https://www.typescriptlang.org/play/#src=function%20map%3CE%2C%20O%3E(arr%3A%20E%5B%5D%2C%20func%3A%20(arg%3A%20E)%20%3D%3E%20O)%3A%20O%5B%5D%20%7B%0A%20%20return%20arr.map(func)%3B%0A%7D%0A%0A%2F%2F%20Parameter%20'n'%20is%20of%20type%20'number'%0A%2F%2F%20'parsed'%20is%20of%20type%20'string%5B%5D'%0Aconst%20parsed%20%3D%20map(%5B%221%22%2C%20%222%22%2C%20%223%22%5D%2C%20n%20%3D%3E%20parseInt(n))%3B">Try</a></pre></p>
<p>Note that in this example, TypeScript could infer both the type of the <code>E</code> type parameter (from the given <code>string</code> array), as well as the type <code>O</code> based on the return value of the function expression.</p>
<h3 id="constraints"><a href="#constraints">Constraints</h3></a>
Expand Down
4 changes: 2 additions & 2 deletions docs/everything/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1177,8 +1177,8 @@ <h3 id="inference"><a href="#inference">Inference</h3></a>
<span class="tm-kw">return</span> <span class="tm-vr">arr</span>.<span class="tm-mth">map</span>(<span class="tm-vr">func</span>);
}

<span class="tm-cmt">// Parameter 'n' is of type 'number'</span>
<span class="tm-cmt">// 'parsed' is of type 'string[]'</span>
<span class="tm-cmt">// Parameter 'n' is of type 'string'</span>
<span class="tm-cmt">// 'parsed' is of type 'number[]'</span>
<span class="tm-kw">const</span> <span class="tm-vr">parsed</span> = <span class="tm-mth">map</span>([<span class="tm-str">"1"</span>, <span class="tm-str">"2"</span>, <span class="tm-str">"3"</span>], <span class="tm-vr">n</span> <span class="tm-kw">=></span> <span class="tm-mth">parseInt</span>(<span class="tm-vr">n</span>));<a class="playground-link" href="https://www.typescriptlang.org/play/#src=function%20map%3CE%2C%20O%3E(arr%3A%20E%5B%5D%2C%20func%3A%20(arg%3A%20E)%20%3D%3E%20O)%3A%20O%5B%5D%20%7B%0A%20%20return%20arr.map(func)%3B%0A%7D%0A%0A%2F%2F%20Parameter%20'n'%20is%20of%20type%20'number'%0A%2F%2F%20'parsed'%20is%20of%20type%20'string%5B%5D'%0Aconst%20parsed%20%3D%20map(%5B%221%22%2C%20%222%22%2C%20%223%22%5D%2C%20n%20%3D%3E%20parseInt(n))%3B">Try</a></pre></p>
<p>Note that in this example, TypeScript could infer both the type of the <code>E</code> type parameter (from the given <code>string</code> array), as well as the type <code>O</code> based on the return value of the function expression.</p>
<h3 id="constraints"><a href="#constraints">Constraints</h3></a>
Expand Down

0 comments on commit 5fc508e

Please sign in to comment.