Comment

Comment by quickthrower2

I like this sort of idea for typifying dynamic languages (like JS)

What if instead of TS, you had plain JS as-is (no compiler needed!) then just add comment like:

    /* x is an integer, x > 0 ... */ 
    function add(x, y) { ...
Sorry the example ain't great but the point is that you can be precise with refinement types. I think refinement types (less all the mathy explanations) are more intuitive. They would be like assertions or C# code contracts. The content of those types would look "business-ey" rather than "category theory-ish".

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton