Skip to content

Improve unknown types for PieLabelRenderProps #6380

Description

@scottalguire

When providing a rendering function to the Pie component label prop, the function accepts props of type PieLabelRenderProps.

For example:

const RenderLabel = ({ x, y }: PieLabelRenderProps) => (
  <text x={x} y={y} className="customized-label">
    test
  </text>
);

The problem is with some of the keys available, their types are resolved as unknown, making type guards or casting a requirement if you want to perform any business logic using the props.

Image

It's also not very intuitive to access them, since autocomplete doesn't suggest them automatically.

Image

If PieLabelRenderProps were to more accurately identify the types of values returned it would be a helpful improvement.

Metadata

Metadata

Assignees

Labels

bugGeneral bug labeltypescriptPRs or Issues surrounding Types or TS refactoring

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions