TypeScript features which may be difficult to locate in the official documentation if you don't know what you are looking for
I've recently picked up TS again after a year hiatus and this is really the most difficult part; trying to solve a more complex typing, but not having any idea what to look for. It also doesn't help that I don't find the official TS docs very intuitive.
So, does anyone have any recommendations on good learning resources for TS? More so on advanced concepts.
Strangely enough I think I picked up the most useful information by trying to read Preact's index.d.ts and internal.d.ts which are strictly types and then back-filling with the official documentation to discover "what did I just read there?" - failing that searching for a quick article online.
One key revelation that helped me a bit was that the advanced features are less about declaring types as one might be used to from mainstream languages with a nominal type system but are more about extracting types - and that JavaScript exists in Value Space while TypeScript types exist in Type Space (which unfortunately TS syntax often conflates).
At times searching for information online can be a chore if you don't know the right terminology - terms like Non-null assertion operator or Assertion Function don't exactly suggest themselves when you are reading code.
I've recently picked up TS again after a year hiatus and this is really the most difficult part; trying to solve a more complex typing, but not having any idea what to look for. It also doesn't help that I don't find the official TS docs very intuitive.
So, does anyone have any recommendations on good learning resources for TS? More so on advanced concepts.
Strangely enough I think I picked up the most useful information by trying to read Preact's index.d.ts and internal.d.ts which are strictly types and then back-filling with the official documentation to discover "what did I just read there?" - failing that searching for a quick article online.
That said comlink is still giving me headaches.
One key revelation that helped me a bit was that the advanced features are less about declaring types as one might be used to from mainstream languages with a nominal type system but are more about extracting types - and that JavaScript exists in Value Space while TypeScript types exist in Type Space (which unfortunately TS syntax often conflates).
Thanks. I also dig through other projects typings, Preact's is a good tip. It's much cleaner than some of the typings I've seen out there 😬
That Gitbook you've referenced to looks very useful, thanks for that!
If you are interested in using typescript mapped types, you can check my blog catchts.com . All examples are taken from stackoverflow
At times searching for information online can be a chore if you don't know the right terminology - terms like Non-null assertion operator or Assertion Function don't exactly suggest themselves when you are reading code.
A Glossary of TypeScript attempts to sort out some of the type related terminology.
Very nice. That glossary is excellent 👌