Top products from r/typescript
We found 6 product mentions on r/typescript. We ranked the 5 resulting products by number of redditors who mentioned them. Here are the top 20.
1. Head First Object-Oriented Analysis and Design
Sentiment score: 1
Number of reviews: 1
O Reilly Media
2. Pro TypeScript: Application-Scale JavaScript Development
Sentiment score: 0
Number of reviews: 1
3. Building Microservices: Designing Fine-Grained Systems
Sentiment score: 1
Number of reviews: 1
O Reilly Media
If you’re willing to spend $30, I wrote O’Reilly’s Programming TypeScript, which goes into depth on all of TypeScript’s features (including more advanced ones that I haven’t seen covered elsewhere). I also tried to explain the “why” behind each of those features, and what kinds of problems they help you solve. The book was edited by Daniel of the TypeScript team, and has tons of examples, exercises, pictures, explanations, etc.
https://www.amazon.com/gp/product/1492037656
If you don’t have $30 to spend, the book is on Safari, which has a free trial: https://learning.oreilly.com/register/.
Or if you don’t have the time to read a whole book, check out one of the online resources people in this thread linked — the TS handbook and Marius’s blog are both great.
Thanks for your advice. The O'reilly book you mentioned is this one? (Building-Microservices-Sam-Newman). And could you send me some material that you like please? (blog posts included).
This book is chock full of good design patterns and written in Java. Much of the code will translate very nicely to TypeScript: https://www.amazon.com/Head-First-Object-Oriented-Analysis-Design/dp/0596008678/ref=sr_1_8?ie=UTF8&qid=1496408897&sr=8-8&keywords=object+oriented+programming
Of course, it's not the only book, but I found it really useful.
I've been writing a book on TypeScript and just finished the first cut at TypeScript classes. It has a number of examples. They are very simple, but get into interfaces, classes and so forth. Here's the link: https://pagalvin.gitbooks.io/yet-another-typescript-book/content/
Classes are covered in chapter 7 and especially chapter 8.
Actually, there is no problem in sending an object:
const obj1 = {
name: "obj1",
otherField: "whatever"
};
...as a parameter to a function that takes an object of type:
type MyType = {
name: string
};
typeof obj1
is a subtype ofMyType
, as it includes all the properties ofMyType
(namelyname: string
).I just tested that code with
strict
set totrue
, and the only error I get is insidefoo
, when you try to:console.log(bar.otherField)
At that point, TypeScript has no way of knowing that
bar
has.otherField
at runtime, and it's a perfectly legitimate complaint on its part. If you wantfoo
to execute logic specific totypeof obj1
and to do something with the result, it's a good use case for higher order functions.e.g.
const foo2 = <T extends MyType>(obj: T, fn: (obj: T) => / whatever fn should return /) => / implementation /
I highly recommend the book Effective TypeScript: 62 Specific Ways to Improve Your TypeScript
I'm a C# dev and I found this book useful Pro TypeScript: Application-Scale JavaScript Development https://www.amazon.co.uk/dp/1484232488/ref=cm_sw_r_cp_apa_aCn3AbXHX24T6