-
Notifications
You must be signed in to change notification settings - Fork 9
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
What are the types of MessageFunction's argument and option values? #27
Comments
While the TS-ish types for these values is indeed proposal-intl-messageformat/README.md Lines 396 to 403 in eca10b1
The idea here is for the function to make it sufficiently simple for a function to enforce its own expectations on its inputs to avoid the need to wrap every value in an otherwise unnecessary object wrapper. For instance proposal-intl-messageformat/README.md Lines 470 to 478 in eca10b1
Its support for MessageValue-wrapped values that are coming from e.g. For proposal-intl-messageformat/README.md Lines 546 to 547 in eca10b1
Could this approach be considered a suitable balance between performance and ease of use? |
Closing as presumably answered. |
The signature of
MessageFunction
introduced in #22 is as follows:In one of the earlier versions of the PR it was more specific:
Since we expect the users of the API to implement their own custom functions, it would be beneficial for their signatures to use narrower types with known methods, like
formatToString()
.However, even with narrower types, custom function implementations may need to do a lot of
instanceof
to handle different subclasses ofMessageValue
.The text was updated successfully, but these errors were encountered: