-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
Feature(transloco|transloco-locale): Provide complete type definitions for pipes used in strict mode #755
Comments
You are welcome to open a PR for it 👍 |
Kaemmelot
added a commit
to Kaemmelot/transloco
that referenced
this issue
Jun 6, 2024
Keep null and undefined intact and provide overloads with null and undefined values for all pipes. BREAKING CHANGE: 🧨 Pipes return null or undefined instead of an empty string if the input is null or undefined ✅ Closes: jsverse#755
13 tasks
Kaemmelot
added a commit
to Kaemmelot/transloco
that referenced
this issue
Jul 24, 2024
Keep null and undefined intact and provide overloads with null and undefined values for all pipes. BREAKING CHANGE: 🧨 Pipes return null or undefined instead of an empty string if the input is null or undefined ✅ Closes: jsverse#755
Kaemmelot
added a commit
to Kaemmelot/transloco
that referenced
this issue
Jul 24, 2024
Keep null and undefined intact and provide overloads with null and undefined values for all pipes. BREAKING CHANGE: 🧨 Pipes return null or undefined instead of an empty string if the input is null or undefined ✅ Closes: jsverse#755
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there an existing issue for this?
Which Transloco package(s) will this feature affect?
Transloco, Locale
Is your feature request related to a problem? Please describe
Only the transloco pipe allows to pass
undefined
ornull
as input values in strict mode. Other pipes like the date pipe or decimal pipe cannot be used with these values. Additionally, the transloco pipe does not provide the types returned by theTranslocoMissingHandler
, so returningundefined
there is also a problem in strict mode.Describe the solution you'd like
I think each pipe should have multiple overloads that consider
null
andundefined
:The transloco pipe should probably provide similar overloads. But I'm not sure about the return value for that pipe, because the
TranslocoMissingHandler
can returnany
, which probably needs to be restricted before providing better return types for that pipe. That would be a breaking change.I would also return the unchanged input value if it was
null
orundefined
. This would not print anything if used in a template, but would allow to use the correct typescript features to check for these input values based on the result and without introducing a variable (for example if the input is the output of another pipe):Describe alternatives you've considered
I have looked at how the Angular team provided their pipes, like for example the date pipe or the decimal pipe which is one reason for this ticket.
I also saw that they only provide
null
as return value, because they could not addundefined
later on as described here, so I don't think transloco should follow that example for the return values.Additional context
Related to #311 and #488
I would like to make a pull request for this feature
Yes 🚀
The text was updated successfully, but these errors were encountered: