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

fix: Update LegendType typescript definition to support 3rd (discrete) type #3954

Closed
hydrosquall opened this issue Jul 31, 2024 · 0 comments · Fixed by #3957
Closed

fix: Update LegendType typescript definition to support 3rd (discrete) type #3954

hydrosquall opened this issue Jul 31, 2024 · 0 comments · Fixed by #3957
Labels
bug For bugs or other software errors

Comments

@hydrosquall
Copy link
Member

Motivation

The source code handles 3 types of legend at runtime

// resolve legend type (symbol, gradient, or discrete gradient)
type = legendType(spec, scope.scaleType(scale));

// discrete gradient legend
else if (type === Discrete) {

The types definitions only permit 2 types of legend at compile time.

export type LegendType = 'gradient' | 'symbol';

This mismatch contributed to a bug like vega/vega-lite#9399

Proposal

  • We update LegendType to support the third type of legend, discrete (implicitly discrete gradient vs continuous gradient). Note this may also impact 1 or more docstrings .

export const Discrete = 'discrete';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For bugs or other software errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant