Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can't test the function or endpoint from a business definition "does the right thing" perspective?


You cannot because if you're testing the type level wizardry, the failure case will not compile.


Maybe not checked in, but I've made "tests" before where the code really doesn't assert things, but whether it compiles or not is what I'm after.

It's far too easy in Typescript to do something where you actually lose your type safety without realizing. So I could for instance have some dummy code that calls foo.bar() but crashes in runtime, and my goal is to fix the typing throughout some generic functions so that it catches the mistake compile time.


Test your functions and endpoints, nobody cares about the internal wizardry. That's an implementation detail.

There's a reason you coded the endpoint, and often times the business logic required is inelegant, self-contradictory and stupid. That's what has to work.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: