diff --git a/chapters/More on Functions.md b/chapters/More on Functions.md index cf380f7..11aec14 100644 --- a/chapters/More on Functions.md +++ b/chapters/More on Functions.md @@ -128,8 +128,8 @@ function map(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)); ``` diff --git a/docs/chapters/more-on-functions/index.html b/docs/chapters/more-on-functions/index.html index 93a7d2c..dfebeca 100644 --- a/docs/chapters/more-on-functions/index.html +++ b/docs/chapters/more-on-functions/index.html @@ -100,8 +100,8 @@

Inference

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));Try

Note that in this example, TypeScript could infer both the type of the E type parameter (from the given string array), as well as the type O based on the return value of the function expression.

Constraints

diff --git a/docs/everything/index.html b/docs/everything/index.html index 5572757..46d5468 100644 --- a/docs/everything/index.html +++ b/docs/everything/index.html @@ -1177,8 +1177,8 @@

Inference

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));Try

Note that in this example, TypeScript could infer both the type of the E type parameter (from the given string array), as well as the type O based on the return value of the function expression.

Constraints