3 ms·
How is the RORO version better? function foo({a: string, b: string, c: string}) Give the params proper names, and the IDE will reveal them (inline even!)
by eevilspock 5y ago
How is the RORO version better?
function foo({a: string, b: string, c: string})
Give the params proper names, and the IDE will reveal them (inline even!) without RORO or its costs. Sure, for a return value like that, use an object with proper names. But that’s been a best practice without “RORO”.
- presentation 5y agoSorry, my example was bad - my point is that if you have it literally be named parameters in the RORO case there’s much lower chance to screw it up since the labels are apparent without needing to hover or trigger any kind of dialog. Chance you’ll mix them up just goes down, so while in theory it’s basically the same as the editor help case, in practice it’s way more foolproof. Would be cool though if VSCode and other editors had a way to make variable names somehow persistently visible on function invocations - that would be pretty interesting IMO!
- eevilspock 5y ago> Would be cool though if VSCode and other editors had a way to make variable names somehow persistently visible on function invocations - that would be pretty interesting IMO! Looks like you missed what I wrote (twice). They do. Others have pointed out that VSCode supports it too. Search the comments for "inlay hints". You also are shown the parameter names and types when writing the function call.
- presentation 5y agoOh I’m dumb, thanks for clarifying!