Skip to content
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

Define set of i18n tokens via TypeScript #4927

Merged
merged 4 commits into from
Jul 6, 2021

Conversation

chandlerprall
Copy link
Contributor

Summary

To allow applications to confirm they define the whole set of our i18n tokens - and are updated when tokens are added or removed - this creates an EuiTokensObject definition in eui.d.ts that can be used to type the context mapping object.

Relevant change in Kibana to opt-in to this typing: https://github.com/elastic/kibana/blob/master/src/core/public/i18n/i18n_eui_mapping.tsx#L18

const euiContextMapping = {
becomes
const euiContextMapping: EuiTokensObject = {

Tested this by dropping the generated eui.d.ts into Kibana & making the above change. TypeScript then identified 9 tokens that are no longer in use and 15 that are missing from that mapping.

Checklist

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4927/

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Compared new eui.d.ts to the token changelog

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4927/

@chandlerprall chandlerprall merged commit cd5e954 into elastic:master Jul 6, 2021
@chandlerprall chandlerprall deleted the ts/i18n-token-defs branch July 6, 2021 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants