You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But, the named argument looks most understandable.
Also, this is a great feature to lock the sense of the argument.
Let's change the order of the get function arguments
functiontest(x,y,a?,b?){}test(x: 1,y: 2)// Oktest(1,2,b: 3)// Oktest(x: 1,y: 2,b: 3)// Oktest(y: 1,x: 2)// Error, should be the same ordertest(1,2,b: 3,a: 4)// Error, should be the same order
Uh oh!
There was an error while loading. Please reload this page.
name: Feature Request
about: Suggest an idea
title: 'Named arguments'
labels: 'Named arguments'
assignees: 'somebody'
Search Terms
Suggestion
Now we can use an object to provide named arguments.
But we should create an object to use this.
Also, we should add default value equals to an empty object when all fields are optional.
I really don't like it.
I would like to see the simplest way to use named arguments.
This converts to ES like
It does not replace the named object arguments, just the sugar for positional arguments.
Use Cases
This is a great feature if we use a couple of optional arguments.
We could change it to
But, the named argument looks most understandable.
Also, this is a great feature to lock the sense of the argument.
Let's change the order of the get function arguments
Or we can change a couple of argument sense
That's why TypeScript was born.
Examples
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: