Skip to content

Export types for formatter callback params #14277

Description

@sthenault

What problem does this feature solve?

would allow to define callback formatter with properly typed arguments: for now I have to type params to any, loosing typing within the formatter function. For instance:

    tooltip.formatter = (params: any) => {
        // access to whatever in params is allowed
        ...
        return content;
    };

What does the proposed API look like?

As I get it, params is expected to be of FormatterParams type, so exporting in within echarts.d.ts would allow something along the line of :

import {FormatterParams} from "echarts";

...
tooltip.formatter = (params: FormatterParams) => {
        // compilation error on access to something to defined in FormatterParams
        return content;
    };

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions