Hacker News new | ask | show | jobs
by MaulingMonkey 2793 days ago
If you could just throw any data into JavaScript functions and have it work, we wouldn't need TypeScript.
2 comments

The poster is poking fun of the fact that you can partially apply or over apply a JavaScript function and it will still run.
One often doesn’t need TypeScript. TS solves some classes of problems that would otherwise become crippling in projects of certain sizes and of certain levels of complexity, but, by design, JavaScript tends to happily let you throw any data into functions and have it work (by some definition of “work”).
If you define work as not throwing an error. You can't just put anything in to a function and have it return a useful result. Thats why typed language programs like haskell programs often define datatypes that are just an Int because user_id is not the same kind of data as product_id even if they are just an int.