VS Code comes with inbuilt TypeScript intelligence. TypeScript is telling us that event.target could be null — not based on our code, but on the definitions themselves. It is possible for the Event’s target property to be null (for example, a directly created Event object with no target given) This works in the browser and all is well.
Table of contents
The goodOver 200k developers use LogRocket to create better digital experiencesThe not-so-goodTake the good with the badWriting a lot of TypeScript? Watch the recording of our recent TypeScript meetup to learn about writing more readable code.Sort: