2 ms·
The closest thing to named parameters in TypeScript is using objects with readonly properties and const assertions where appropriate. It makes it so the objects
by benatkin 5y ago
The closest thing to named parameters in TypeScript is using objects with readonly properties and const assertions where appropriate. It makes it so the objects are basically just fixed key/value pairs. They're used in Deno.
https://blog.logrocket.com/const-assertions-are-the-killer-new-typescript-feature-b73451f35802/ https://blog.logrocket.com/const-assertions-are-the-killer-n...
It isn't just about protecting the caller of a function from having to deal with the function unexpectedly modifying the object. It's also about an async function not having to make a copy of it to prevent the app calling it from changing it before it's returned.