Adds a rule to make sure that optional params can't come before required#2274
Adds a rule to make sure that optional params can't come before required#2274Bashamega wants to merge 1 commit intomicrosoft:mainfrom
Conversation
|
Thanks for the PR! This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged. |
| "param": [ | ||
| { | ||
| "name": "message", | ||
| "optional": false |
There was a problem hiding this comment.
This was ok because it was one-off, but it's not great to automate this nonideal workaround.
Given the IDL parameters of "required, optional, and then required" pattern, both form of the function call should be allowed:
func(required);
func(required, undefined, required);
This can be only done with overloads in current TS. I'm not sure it's worth right now given it's very rare to have this problem.
| } | ||
|
|
||
| function convertArgument(arg: webidl2.Argument): Browser.Param { | ||
| function hasRequiredArgumentAfter(arr: webidl2.Argument[], i: number): boolean { |
There was a problem hiding this comment.
Also I think this is a wrong layer to solve the problem. widlprocess should be about conversion to the format that the build script understands, and not about changing anything. That should be part of the emitter, as the comment above says.
|
Okay |
No description provided.