TypeScript is testing

TypeScript is testing

Released Thursday, 20th May 2021
Good episode? Give it some love!
TypeScript is testing

TypeScript is testing

TypeScript is testing

TypeScript is testing

Thursday, 20th May 2021
Good episode? Give it some love!
Rate Episode

https://kcd.im/trophyhttps://kentcdodds.com/blog/eliminate-an-entire-category-of-bugs-with-a-few-simple-toolsTypeScript is tests. Tests are type script. So type script is just a way togive yourself more confidence. Sure, it helps you in your workflow, itmakes you a faster as you're developing because you have autocomplete andstuff like that. And testing does the same thing as well as yourefactoring, you know that you didn't break anything you get a much fasterfeedback when you you're running your tests as you're working on things.And both of these also make the initial code take longer. So it takes moretime to think.About the types that you're writing takes more time toactually write the tests. And they can also be an enormous time sink whereyou spend a ton of time working on a task or a ton of time working on theon the types and then you've later realized that you don't need that codeat all so you just throw all that work away.So, I I find that typescript and testing are way more related than they areor similar than they are different. And I think this is a good thingthough, the whole goal is to be more confident in the changes thatwere.Making in the application that were shipping. And the cool thing aboutTypeScript is that it eliminates an entire category of bugs.I actually have a blog post about that. And it also eliminates an entirecategory of tests, which you're probably not writing but maybe you should.So one of the things about code coverage is that it doesn't what we reallyactually need is data coverage or use case coverage because you may have afunction called ad that accepts two numbers and add.S them together and you could write a couple of tests for that if youwanted to but you're probably not writing like it's not very normal forpeople to write a test that says what happens if I pass a string whathappens if I pass a boolean but you know, what a you might have a test thatsays what happens if I don't pass the arguments or something and becausethere are some defaults.But and that and because there are defaults you're going to want to coverthat. But we've very often don't do a whole lot of defensive programmingand runtime and type assertions of.You know, what the arguments that werepassed? Maybe you do that for some of your functions, but probably not all.And so you can you don't get a much confidence in in that aspect. And youyou could but it's just way easier to just use a type to language likeTypeScript and then that entire category of bugs in the entire category oftests don't need to be written. So type script is tests.

Show More
Rate

Join Podchaser to...

  • Rate podcasts and episodes
  • Follow podcasts and creators
  • Create podcast and episode lists
  • & much more

Episode Tags

Do you host or manage this podcast?
Claim and edit this page to your liking.
,

Unlock more with Podchaser Pro

  • Audience Insights
  • Contact Information
  • Demographics
  • Charts
  • Sponsor History
  • and More!
Pro Features