Hacker News new | ask | show | jobs
by noduerme 1362 days ago
Reading this thread gave me my first encounter with `satisfies`. While I love the concept, the syntax really bothers me. I'm used to seeing the type right after the variable name when it's being defined, not looking after the assignment for it. The placement after assignment almost seems to imply that if you `let x = 1 satisfies number` with an implicit "any" you could reassign x and have it satisfy something else further on in the code, which would be an unbelievably terrible antipattern. (I'm assuming you can't do that?)

To me it seems more logical to use something like a double-colon or some other syntactic sugar to imply `satisfies` when you declare a variable... and possibly a <Satisfies Classname> or just <Classname*> prepend for casting.