TypeScript is a great language that allows type-checking your code in order to make it more robust and understandable.
In this guide, I will lead ...
For further actions, you may consider blocking this person and/or reporting abuse
Great advice. Really easy to do and a surprising number of people don't realise you can do this.
Minor nitpicky point, but you can get away with simplifying a couple of your examples, especially if you (and the other people reading your code) are comfortable with type inference:
Hovering the mouse over the variable name in VS Code is a great way to sanity check the types that have been inferred.
(You could argue that my first two examples are a possible source of confusion for people who are new to TypeScript, so feel free to completely ignore this advice.)
Pretty good stuff :), I will add that you need always set the return type of a function if you are working on strict mode (typescript). Another thing is that you can add read only to the reducers state
I needed this thank you good sir. Typescript new to my stack no more hacky code ~0~;;
Glad it helps
Is there a way to apply types to
useContext
that prohibits using hook in case, the respective Provider won't be used with this component? It prevents forgetting the usage of providers.Good job.
You always provide good content. Simple and easy to understand. Great job!
Wow! Thanks a lot
Good post, really useful!
Thanks for reading👍
Well written and very rewarding