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 component props separately in TypeScript #79

Closed
nicholaschiang opened this issue Jun 7, 2021 · 2 comments
Closed

Export component props separately in TypeScript #79

nicholaschiang opened this issue Jun 7, 2021 · 2 comments

Comments

@nicholaschiang
Copy link

Currently, you're only exporting the component types from dist/index.d.ts. Could you also export the component prop types?

For example, I'm trying to use Next.js dynamic feature to dynamically import the Fade component from this library. But I can't do it in TypeScript without access to the FadeProps type:

import { FadeProps } from 'react-awesome-reveal';
import dynamic from 'next/dynamic';

const Fade = dynamic<FadeProps>(
  () => import('react-awesome-reveal').then((m) => m.Fade),
  () => { loading: '...' }
);
@morellodev
Copy link
Collaborator

morellodev commented Jun 7, 2021

+1 for this, I will release a new version with prop types export.

For simpler use cases, this built-in utility type coming from React can be used today:

type FadeProps = React.ComponentProps<typeof Fade>;

@morellodev
Copy link
Collaborator

morellodev commented Jun 9, 2021

The feature has been merged into develop and will be released in the next minor release.

github-actions bot pushed a commit that referenced this issue Jun 10, 2021
# [3.8.0](v3.7.2...v3.8.0) (2021-06-10)

### Bug Fixes

* **baseurl:** removed baseUrl ([44d2095](44d2095))
* **vercel:** removed vercel.json config ([547df21](547df21))

### Features

* **types:** component prop types are now exported ([be1e2c1](be1e2c1)), closes [#79](#79)
* **website:** added a Docusaurus-based doc website ([3f24101](3f24101))
* **website:** removed sample md file ([0439a4c](0439a4c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants