Add type annotations so st.altair_chart supports all Altair chart types. #10202
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.
Describe your changes
Altair charts can have different types depending on what you did to them, but our type annotations don't currently account for that. This PR addresses that.
If you have
c1andc2like this......then those have type
AltairChart, butc1 + c2is aLayerChart,c1 | c2is aHConcatChart, etc.So this PR makes
st.altair_chartaccept all possible Altair chart types. This is a typing-only change -- it doesn't impact behavior. In fact, what this does is make our type annotations match what our current behavior.The only thing anyone will notice is that people's editors will stop complaining when you pass these types of charts into
st.altair_chart.GitHub Issue Link (if applicable)
n/a
Testing Plan
Unit Tests (JS and/or Python)E2E TestsContribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.