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

Cannot override default theme? #1626

Closed
4 tasks done
slhck opened this issue Jun 26, 2020 · 2 comments · Fixed by #1739
Closed
4 tasks done

Cannot override default theme? #1626

slhck opened this issue Jun 26, 2020 · 2 comments · Fixed by #1739
Labels
Type: Bug 🐛 Oh no! A bug or unintentional behavior

Comments

@slhck
Copy link

slhck commented Jun 26, 2020

Bugs and Questions

Checklist

  • This is not a victory-native specific issue. (Issues that only appear in victory-native should be opened here)

  • I have read through the FAQ and Guides before asking a question

  • I am using the latest version of Victory

  • I've searched open issues to make sure I'm not opening a duplicate issue

The Problem

I want to provide my own theme, but I get the following error in TypeScript:

No overload matches this call.
  Overload 1 of 2, '(props: Readonly<VictoryChartProps>): VictoryChart', gave the following error.
    Type '{ area: { style: { data: { fill: string; }; labels: { fontFamily: string; fontSize: number; letterSpacing: string; padding: number; fill: string; stroke: string; }; }; } & { width: number; height: number; padding: number; colorScale: string[]; }; ... 14 more ...; voronoi: { ...; } & { ...; }; }' is not assignable to type 'VictoryThemeDefinition'.
      Types of property 'axis' are incompatible.
        Type '{ style: { axis: { fill: string; stroke: string; strokeWidth: number; strokeLinecap: string; strokeLinejoin: string; }; axisLabel: { textAnchor: string; } & { fontFamily: string; fontSize: number; letterSpacing: string; padding: number; fill: string; stroke: string; } & { ...; }; grid: { ...; }; ticks: { ...; }; tic...' is not assignable to type '({ style?: { axis?: CSSProperties | undefined; axisLabel?: CSSProperties | undefined; grid?: CSSProperties | undefined; ticks?: TickProps | undefined; tickLabels?: CSSProperties | undefined; } | undefined; } & ThemeBaseProps) | undefined'.
          Type '{ style: { axis: { fill: string; stroke: string; strokeWidth: number; strokeLinecap: string; strokeLinejoin: string; }; axisLabel: { textAnchor: string; } & { fontFamily: string; fontSize: number; letterSpacing: string; padding: number; fill: string; stroke: string; } & { ...; }; grid: { ...; }; ticks: { ...; }; tic...' is not assignable to type '{ style?: { axis?: CSSProperties | undefined; axisLabel?: CSSProperties | undefined; grid?: CSSProperties | undefined; ticks?: TickProps | undefined; tickLabels?: CSSProperties | undefined; } | undefined; } & ThemeBaseProps'.
            Type '{ style: { axis: { fill: string; stroke: string; strokeWidth: number; strokeLinecap: string; strokeLinejoin: string; }; axisLabel: { textAnchor: string; } & { fontFamily: string; fontSize: number; letterSpacing: string; padding: number; fill: string; stroke: string; } & { ...; }; grid: { ...; }; ticks: { ...; }; tic...' is not assignable to type '{ style?: { axis?: CSSProperties | undefined; axisLabel?: CSSProperties | undefined; grid?: CSSProperties | undefined; ticks?: TickProps | undefined; tickLabels?: CSSProperties | undefined; } | undefined; }'.
              The types of 'style.axis.strokeLinecap' are incompatible between these types.
                Type 'string' is not assignable to type '\"-moz-initial\" | \"inherit\" | \"initial\" | \"revert\" | \"unset\" | \"round\" | \"butt\" | \"square\" | undefined'.
  Overload 2 of 2, '(props: VictoryChartProps, context?: any): VictoryChart', gave the following error.
    Type '{ area: { style: { data: { fill: string; }; labels: { fontFamily: string; fontSize: number; letterSpacing: string; padding: number; fill: string; stroke: string; }; }; } & { width: number; height: number; padding: number; colorScale: string[]; }; ... 14 more ...; voronoi: { ...; } & { ...; }; }' is not assignable to type 'VictoryThemeDefinition'.

Reproduction

I have simply created a component with:

import victoryTheme from '/victoryTheme';
<VictoryChart theme={victoryTheme}></VictoryChart>

And the content of victoryTheme.ts is exactly the same content as https://github.com/FormidableLabs/victory/blob/v34.3.12/packages/victory-core/src/victory-theme/grayscale.js

I am using Victory 34.3.12.

@boygirl boygirl added the Type: Bug 🐛 Oh no! A bug or unintentional behavior label Aug 27, 2020
@ianmh
Copy link

ianmh commented Nov 2, 2020

@slhck Did you figure a way around this? I'm having the same issue.

@slhck
Copy link
Author

slhck commented Nov 2, 2020

Sorry, I moved to another library since I couldn't figure this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 Oh no! A bug or unintentional behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants