-
Notifications
You must be signed in to change notification settings - Fork 339
feat: export type #298
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
base: trunk
Are you sure you want to change the base?
feat: export type #298
Conversation
|
Can you explain what goal you'd like to achieve with this? |
|
Currently, using internal types is cumbersome and requires complex type calculations, so we want to export them directly from the library. |
|
Are you writing a component that wraps and forwards props? That's fair but not clear if that's your intent. I'm not opposed to exporting types but want to be intentional about additional API surface area. |
Hi there, I was in this scenario it would be nice to have access to types? |
|
There are several variations of what people might need and there are utility types which get there, so I'm inclined to just say no here. Also, as would be written, these types are not the whole truth. They don't include the For example, to get the full type of props: import {QRCodeSVG} from 'qrcode.react';
import type {ComponentProps} from 'react';
type QRCodeSVGProps = ComponentProps<typeof QRCodeSVG>Admittedly, this may not be precisely what you but it will be accurate. You can go a step further if you need just the explicit props, which I did in the tests. As you can see from the comment though, that's really just the make TypeScript happy when creating a bunch of props objects outside normal usage: qrcode.react/src/__test__/index.test.tsx Lines 7 to 23 in 1c88a68
|
No description provided.