feat(transloco): transpile function arguments in FunctionalTranspiler (#829)#832
feat(transloco): transpile function arguments in FunctionalTranspiler (#829)#832f-aubert wants to merge 3 commits intojsverse:masterfrom
Conversation
…jsverse#829) Signed-off-by: isc-auf <frederic.aubert@isc-ejpd.admin.ch>
@jsverse/transloco
@jsverse/transloco-locale
@jsverse/transloco-messageformat
@jsverse/transloco-optimize
@jsverse/transloco-persist-lang
@jsverse/transloco-persist-translations
@jsverse/transloco-preload-langs
@jsverse/transloco-scoped-libs
@jsverse/transloco-utils
@jsverse/transloco-validator
commit: |
|
@shaharkazaz ? May I assist you in letting this merged? thxs |
| return func.transpile(...getFunctionArgs(args)); | ||
| return func.transpile( | ||
| ...getFunctionArgs(args).map((arg) => | ||
| this.transpile({ value: arg, ...rest }), | ||
| ), |
There was a problem hiding this comment.
The question here do we want to support nested function transpilations? I'm not sure that would actually work.
Add a test case, if that works, cool. otherwise let's skip directly to the parent transpiler
const transpiledArgs = super.transpile({value: getFunctionArgs(args), ...rest});
return func.transpile(...transpiledArgs);
There was a problem hiding this comment.
You are right. As far as I can tell, this PR doesn't implements nesting function because getFunctionArgs use a simple pattern to separate the args, namely on comma. A regexp engine with support of nesting would be needed. I sure can look into that, but I could also live with this limitation.
There was a problem hiding this comment.
Make the changes and test the pkg-pr-new release
There was a problem hiding this comment.
Not exactly sure what do you want me to do / change? I think the original code with the map call should do it... Thks
There was a problem hiding this comment.
Please call the super like in the code I suggested
5597e5d to
ec8ff1c
Compare
…jsverse#829) Signed-off-by: isc-auf <frederic.aubert@isc-ejpd.admin.ch>
|
I pushed what you suggested. I called this.transpile (instead of super.transpile) on the functionArgs. It shouldn't have any impact, but would allow nesting function if we ever improved the parsing in getFunctionArgs (to ignore coma when in a nested context such as [[ or {{). |
|
Hello @shaharkazaz would you agree to go forwards? I'd enjoy this or a new similar pr merged |
|
Hello @shaharkazaz? Can we imagine merging it? Thks |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: 829
What is the new behavior?
Does this PR introduce a breaking change?
Other information