|
|
|
|
|
by mohsen1
2687 days ago
|
|
> Naively, someone might think you’d write fewer tests with TypeScript. That someone would be wrong. Have you seen unit tests that check "what if I don't send the right number/type of arguments"? Yeah those unit tests are not necessary if you use TypeScript. |
|
You'd presumably have at least some tests in the form of "Give these input, get that output". By checking that output, you pretty much confirm its the right type at the same time.
I've seen a lot of test suites that have stuff like:
"given input A, test that result is defined. Given input A again, test that result is 1234". It's like, yo, if result is 1234, its obviously defined.
There are edge cases, so yeah, the amount of tests you don't write in TS is > 0, but it's far and few in between.