Skip to content

XAxisProps.labels.style and YAxisProps.labels.style incorrectly typed #567

@Lissandre

Description

@Lissandre

The style property on XAxisProps.labels and YAxisProps.labels is typed as a { fontSize?: number | string; } and prevents us from stylizing the labels correctly

Current type in @highcharts/react:

// node_modules/@highcharts/react/options/XAxis.d.ts
labels?: {
    ...
    style?: {
        fontSize?: number | string;
    };
    ...
}

Correct type from highcharts:

// node_modules/highcharts/highcharts.d.ts - XAxisLabelsOptions
style?: (CSSObject|XAxisLabelsStyleOptions);

The Highcharts API documentation indicates it could be a CSSObject (and uses it in the example)

The error:

When following the incorrect types and passing for example a color attribute in the styles:

Object literal may only specify known properties, and 'color' does not exist in type '{ fontSize?: string | number | undefined; }'.ts(2353)

Expected type:

style?: (CSSObject|XAxisLabelsStyleOptions);

Versions:

@highcharts/react: 4.2.1
highcharts: 12.5.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions