Open oliver-wymer opened 1 week ago
@oliver-wymer You can reference the type of the action
prop like so:
React.ComponentProps<typeof NotificationsEmptyState>['action']
This is always more robust and future-proof than relying on one-off type exports. I personally would inline your action
altogether, eliminating the need for explicit typing in the first place.
Regarding the type itself being incorrect, your description doesn't clearly point out what exactly is wrong with it (is it the missing iconDescription
?)—I recommend making this clear for when a Carbon maintainer picks up the issue. 🙂
Package
Carbon for IBM Products
Description
Firstly, thanks so much for TS support! Makes a big difference!
I have 2 issues which can kind of be wrapped into 1.
I'm trying to use the NotificationsEmptyState component as per the storybooks and docs in the story books but I'm seeing type errors. It looks like the types aren't correct and it'd also be nice if they were exported.
The type is incorrect (or iconDescription isn't a field and storybook is wrong)
As per the storybook we should be able to do this (example NotificationsEmptyState - With Action Icon Button):
But the type for action is defined as:
Exporting the type would be helpful
So for example what I want to be able to do:
But what I have to do:
Component(s) impacted
NotificationsEmptyState
Browser
Chrome
@carbon/ibm-products (previously @carbon/ibm-cloud-cognitive) version
2.49.0
Suggested Severity
Severity 3 = The problem is visible or noticeable to users but does not impede the usability or functionality. Affects minor functionality, has a workaround.
Product/offering
API Connect
CodeSandbox or Stackblitz example
https://codesandbox.io/p/sandbox/github/carbon-design-system/ibm-products/tree/main/examples/carbon-for-ibm-products/NotificationsEmptyState?file=%2Fsrc%2FExample%2FExample.jsx
Steps to reproduce the issue (if applicable)
No response
Release date (if applicable)
No response
Code of Conduct