-
-
Notifications
You must be signed in to change notification settings - Fork 211
feat(transloco): transpile function arguments in FunctionalTranspiler (#829) #832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…jsverse#829) Signed-off-by: isc-auf <[email protected]>
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it simple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the changes and test the pkg-pr-new release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please call the super like in the code I suggested
5597e5d
to
ec8ff1c
Compare
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 {{). |
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