components: Expose TS types of props for public components#72831
components: Expose TS types of props for public components#72831manzoorwanijk wants to merge 2 commits intotrunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: 0 B Total Size: 2.38 MB ℹ️ View Unchanged
|
aduth
left a comment
There was a problem hiding this comment.
This is documented as an intentional decision to not export these types, and instead encourage React.ComponentProps for accessing the types.
gutenberg/packages/components/README.md
Lines 60 to 62 in 3be8bb2
|
Proposing an alternative fix in #72979 |
|
Closing in favour of the proposed alternative - #72979 |
What?
As a part of #72032, we have added the
exportsfield to many packages includingcomponents. This prevents what was previously possible, i.e. to import component types from/build-typessub-path. But, once you defineexportsfor a package, you can't import from the sub-paths that are not defined inexportsfield, thus making it impossible to import type, should you need them.So, to ensure that any consumer component is able to import and use the types for component props, we are exposing them from the root.
Why?
To allow importing of TS types for component props.
How?
export * from '...')types.tsfilesBadge,DateCalendar, etc,Testing Instructions
Just verify that only the public components are exposed.
Testing Instructions for Keyboard
Screenshots or screencast