Export types for formatter callback params
- Dominant language
- TypeScript
- Stars
- 67.3k
- Forks
- 19.8k
- Avg merge
- 11d 14h
- Merged PRs (30d)
- 8
Description
### 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;
};
Contributor guide
Assessment
This issue has not been assessed yet.