Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export CalendarProps interface to allow for props typing in extending components #856

Closed
1 task done
majdnaji opened this issue May 18, 2023 · 3 comments
Closed
1 task done
Labels
enhancement New feature or request

Comments

@majdnaji
Copy link

Before you start - checklist

  • I have checked if this feature request is not already reported

Description

i want to be able to import CalendarProps types to help with typing wrapper compontns

Proposed solution

No response

Alternatives

No response

Additional information

No response

@majdnaji majdnaji added the enhancement New feature or request label May 18, 2023
@wojtekmaj
Copy link
Owner

You don't need that :)

type CalendarProps = React.ComponentProps<Calendar>;

@maciejregula
Copy link

maciejregula commented May 18, 2023

@wojtekmaj when I do this I receive: "Type 'Calendar' does not satisfy the constraint 'keyof IntrinsicElements | JSXElementConstructor '."

import React from "react";
import { Calendar } from "react-calendar";
import "./Calendar.css";

//export interface CalendarProps extends ReactCalendarProps {}
type CalendarProps = React.ComponentProps<Calendar>;

react v18
react-calendar v4.2.1

@wojtekmaj
Copy link
Owner

I'd need to see full example to help out. What I proposed is what I exactly do in React-Date-Picker for example and it works great.

Nonetheless, exporting it makes sense. This is in the works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants