3 Minutes With Kent
Don't Side-step TypeScript
- Autor: Vários
- Narrador: Vários
- Editora: Podcast
- Duração: 0:02:56
- Mais informações
Informações:
Sinopse
Hello everyone So today I'm going to talk about TypeScript and tricking type script versus fixing your code So, you know, the the null non-null assertion thing where you put the exclamation point at the end of something to say, hey type script this isn't going to be no or whatever. I don't really use that. There's actually two reasons. One of them is because it looks like when you're looking at the code that looks like that's a feature of JavaScript, but it's not and so I don't really like using things that look like they could be a feature of JavaScript but aren't I don't know maybe that's just weird of me. But the the biggest reason is that most often if TypeScript thinks that this can be null it's most likely that it actually can be no and and you could put that bang there or you can do type assertions or casting and whatever but it's I I don't like telling TypeScript that no this like this won't be this value when it actually could be that value. So I'm thinking about a specific example that my friend Pet