Skip to content

Commit

Permalink
Fixed double quote typo in description
Browse files Browse the repository at this point in the history
  • Loading branch information
Penchy authored Jan 20, 2022
1 parent 55b4957 commit d060311
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ person.on("ageChanged", newAge => {
Here we made `on` into a generic method.
When a user calls with the string `"firstNameChanged'`, TypeScript will try to infer the right type for `Key`.
When a user calls with the string `"firstNameChanged"`, TypeScript will try to infer the right type for `Key`.
To do that, it will match `Key` against the content prior to `"Changed"` and infer the string `"firstName"`.
Once TypeScript figures that out, the `on` method can fetch the type of `firstName` on the original object, which is `string` in this case.
Similarly, when called with `"ageChanged"`, TypeScript finds the type for the property `age` which is `number`.
Expand Down

0 comments on commit d060311

Please sign in to comment.