Code Monkey home page Code Monkey logo

Comments (7)

toomuchdesign avatar toomuchdesign commented on August 25, 2024

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.

toomuchdesign avatar toomuchdesign commented on August 25, 2024

Hi @majelbstoat,
what's the current status of this?

from react-minimal-pie-chart.

bryanltobing avatar bryanltobing commented on August 25, 2024

any update on this ?

from react-minimal-pie-chart.

majelbstoat avatar majelbstoat commented on August 25, 2024

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.

toomuchdesign avatar toomuchdesign commented on August 25, 2024

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.

toomuchdesign avatar toomuchdesign commented on August 25, 2024

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.

toomuchdesign avatar toomuchdesign commented on August 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.