3 Minutes With Kent

How to use TypeScript errors to guide your callbacks

Informações:

Sinopse

Your friends it's a beautiful day it's Monday and I wanted to share just something that I discovered while I was working on something just kind of an interesting workflow that I've come to start to use and that is if you are trying to use something and you don't know what type it requires rather than and assuming that it's written in touch script or at least has type definitions so like say you're passing a function to an API and some sort of callback, for example, maybe you're on an input in a j in your JSX and you have an on change in your not sure what type. The event should be or that first argument or you don't even know whether it accepts arguments or anything so the way that I do this is rather than opening up the docks and digging around and trying to find how this is to find out what I'm expected to do here you put in a function that you're pretty confident is going to break the types in some way and so for our input on change example, you can just put an inline function in there that takes a single