Emit TypeScript type definitions for variables extracted from themes#1750
Merged
weltenwort merged 4 commits intoelastic:masterfrom Mar 21, 2019
Merged
Conversation
72a71e0 to
22686c9
Compare
Member
Author
|
/cc @mattapperson @sqren |
sorenlouv
reviewed
Mar 20, 2019
Member
sorenlouv
left a comment
There was a problem hiding this comment.
So much awesome! Thanks! 👍👍👍
chandlerprall
approved these changes
Mar 21, 2019
Contributor
chandlerprall
left a comment
There was a problem hiding this comment.
This is beautiful. Pulled code and ran locally, confirmed output type files are named correctly and export the expected types.
weltenwort
added a commit
to weltenwort/eui
that referenced
this pull request
Mar 21, 2019
1 task
weltenwort
added a commit
that referenced
this pull request
Mar 21, 2019
weltenwort
added a commit
to elastic/kibana
that referenced
this pull request
Apr 1, 2019
This adds a specialization of the styled-components api, which is correctly typed according to the new theme variable type definitions included in EUI (elastic/eui#1750) and made available in Kibana via #33873.
weltenwort
added a commit
to weltenwort/kibana
that referenced
this pull request
Apr 2, 2019
…c#33607) This adds a specialization of the styled-components api, which is correctly typed according to the new theme variable type definitions included in EUI (elastic/eui#1750) and made available in Kibana via elastic#33873.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This enhances the
compile-scss.jsbuild script to also emit TypeScript type definitions for the JSON files generated from the theme variables. These type definitions are stored as.json.d.tsfiles indist/alongside the JSON files so the imports are typed correctly.When imported in downstream projects like Kibana, the imported symbols will be typed appropriately, which would reduce the risk involved in making breaking changes to these variables like #1590 did.
Letting the TypeScript compiler derive the types automatically was attempted twice in Kibana (elastic/kibana#24425 and elastic/kibana#25516). Both attempts failed due to limitations Kibana's build process and the TypeScript compiler.
Checklist
This was checked in mobileThis was checked in IE11This was checked in dark modeAny props added have proper autodocsDocumentation examples were addedJest tests were updated or added to match the most common scenariosThis was checked against keyboard-only and screenreader scenariosThis required updates to Framer X components