-
Notifications
You must be signed in to change notification settings - Fork 78
Closed
Labels
area: i18nInternationalisationInternationalisationenhancementNew feature or requestNew feature or request
Description
Enhancement
The format function in the i18n middleware is currently typed as (key: string, options?: any):
https://github.com/dojo/framework/blob/master/src/core/middleware/i18n.ts#L94
It would be useful to be able to ensure that the key argument was a type of the key of the messages in the bundle to prevent passing invalid key property.
Package Version: 7.0.0-pre
Code
Assume an .nls file as such:
const messages = {
foosAvailable: '{num} are available'
};
export default { messages };A widget with this behaviour in the render
const { messages, format } = i18n.localize(bundle);
// Later on
format('barsAvailable', { num: bars.length })}Expected behavior:
A type error occurs when using a no message bundle key.
Actual behavior:
There is no type error.
Metadata
Metadata
Assignees
Labels
area: i18nInternationalisationInternationalisationenhancementNew feature or requestNew feature or request