I18N: Strongly typed sprintf
#52985
Labels
[Package] i18n
/packages/i18n
[Type] Code Quality
Issues or PRs that relate to code quality
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
I just stumbled upon https://hacklewayne.com/a-truly-strongly-typed-printf-in-typescript and was wondering whether a solution like this could be considered for
@tannin/sprintf
.Right now with the existing JSDoc every arg needs to be a string, when in fact the values will be cast to ints and floats anyway depending on the format.
What is your proposed solution?
A strongly typed implementation could make this more robust.
This would also help catch issues where the number of arguments doesn't match the number of placeholders.
From that article:
Note: this doesn't support named arguments yet.
Related
sprintf
aduth/tannin#15The text was updated successfully, but these errors were encountered: