Earlier quoted context omitted.
You are right, my reasoning is as follows (though still 100% personal bias). For writing a web server library, like oak or flask or etc etc: First, resources own the methods, methods don't own the resources, so the path comes first, easy enough, its just a string with potentially placeholders whose values need to be shunted down the line Next is the method, for some reason a lot of libraries like to hardcode these? I…
Not sure I follow the first part of what you're saying. For the part where you're describing what's possible or not in TypeScript/JS, though, you're incorrect: You can't do something like title("hi") vs title({attr:123}, "hi") Yes, you can. In JS it's trivial; in TypeScript, you can even do it while preserving type safety. Here's the function in TypeScript: // First define which signatures are allowed function title(…
I should not have used "can't" at that point, correct
To be more clear, you "can't" have a difference between an arbitrary object and a record, unless you know the type of the object and a way to disambiguate that from a record.
Of course, you "can" have a difference, a record "is" `typeof record === 'object' && Object.getPrototypeOf(record) === Object.getPrototypeOf({})` (At least as long as no one uses plain objects as non-recordy things), but, this isn't something I've ever had to care about in any other language. In some you have multiple dispatch built into the language, in some you can just pass named arguments arbitrarily. Javascript and Typescript are very inflexible in this aspect.