Learning TypeScript

Errata for Learning TypeScript

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected

function getRating(ratings: Ratings, key: 'audience' | 'critic'): number { return ratings[key]; // Ok } const ratings: Ratings = { audience: 66, critic: 84 }; getCountLiteral(ratings, 'audience'); // Ok getCountLiteral(ratings, 'not valid'); There is no getCountLiteral its supposed to be getRating(ratings, 'audience'); // Ok getRating(ratings, 'not valid');

Note from the Author or Editor:
Thanks for the catch!

Anonymous  Jun 10, 2022 
Safari Books Online
Optional Properties

In the Optional properties section [author?: string;] is optional, there is no error for [missing], in the graphic it shows the false error "// Error: Property 'author' is missing in type" for [missing] type Book = { author?: string; pages: number; }; const missing: Book = { pages: 80 };

Mark Oliver  May 28, 2022  Jun 03, 2022
Page 6
The praise quote for Lenz

The name is "Lenz Weber-Tronic" (with a 'c'), not "...Tronik" (with a 'k')

Note from the Author or Editor:
This was reported by Lenz. Sorry, and thank you for the note! Subsequent editions will have the correction.

Josh Goldberg  Jun 07, 2022 
Page 44
End of the code snippet

`'{ name: string; start: number; }'` should be `'{ born: number; name: string; }`

Josh Goldberg  Jun 05, 2022 
Page 76
Crow callout

Generics are covered in Chapter 10, "Generics", not Chapter 9, "Type Modifiers".

Josh Goldberg  Jun 05, 2022 
Page 79
Crow callout

TypeScript's configuration options are covered in Chapter 13, "Configuration Options", not Chapter 12, "Using IDE Features".

Josh Goldberg  Jun 05, 2022 
Page 101
Squirrel tip

The URL should be, not Both work but the latter is a redirect to the former.

Josh Goldberg  Jun 05, 2022 
Page 137
First sentence under

The `as const` syntax was introduced in Chapter 6, "Arrays", not Chapter 4, "Objects".

Joshua Goldberg
Jun 05, 2022 
Page 154
Bottom code snippet

The type of allExplicit is KeyValuePair<string, number>, not KeyValuePair<string, string>.

Josh Goldberg  Jun 05, 2022