Comments (7)
Hi @majelbstoat,
I'd expect 2 solutions to be currently available.
First, in case label
function is inlined (as a jsx
prop) the provided function should already receive a full type check.
In case you wanted to declare a standalone function then you might extract components' prop types like:
import React from 'react';
import { PieChart } from 'react-minimal-pie-chart';
type LabelProp = React.ComponentProps<typeof PieChart>['label']
const label: LabelProp = //...
More info about accessing React components' props here.
from react-minimal-pie-chart.
Hi @majelbstoat,
what's the current status of this?
from react-minimal-pie-chart.
any update on this ?
from react-minimal-pie-chart.
I went and tried that approach, and it didn't immediately work for me, though I don't exactly recall why right now. It really would be very nice if you could just add an export
or two ;)
from react-minimal-pie-chart.
I'll consider it as soon as I have time to do so 👍 In the meanwhile I confirm the mentioned approach works in a CodeSandbox repro.
from react-minimal-pie-chart.
Might be a bit harder than originally thought:
https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/default_props/#consuming-props-of-a-component-with-defaultprops
If we can't find a proper TS workaround, we might consider removing component's defaultProps
.
from react-minimal-pie-chart.
Implemented in v8.4.0. Prop types exposed as:
import type { PieChartProps } from 'react-minimal-pie-chart';
from react-minimal-pie-chart.
Related Issues (20)
- Not possible to render content inside chart on 8.0 HOT 1
- Dependency Dashboard
- Custom SVG label is rendered on same position HOT 3
- Side parts of Dognut chart are squashed HOT 1
- Not able to add multiline text with different format in central of pie/donut HOT 1
- Edges are getting cut on hover, when we render Doughnut chart HOT 1
- Hide tooltip HOT 3
- Feature OnMouseOver or specific classname when it is selected HOT 2
- Svg is filling all the space and truncate when becomes larger HOT 1
- How to style labels ? HOT 2
- Update React dev dependencies to v18 HOT 1
- Label font color not changing HOT 1
- Segment Border HOT 1
- Segment custom attributes for event handling HOT 1
- Are there any ways to set the same distance/padding between slices HOT 1
- Make labelPosition support segmentIndex callback function HOT 1
- PieChart component rendering error ExceptionsManager Error: Text strings must be rendered within a <Text> component. HOT 1
- Console warnings when using SSR HOT 5
- Implementation Question HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-minimal-pie-chart.