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

Tearsheet: portalTarget declaration wrong #5700

Closed
2 tasks done
wkeese opened this issue Jul 21, 2024 · 2 comments · Fixed by #5899
Closed
2 tasks done

Tearsheet: portalTarget declaration wrong #5700

wkeese opened this issue Jul 21, 2024 · 2 comments · Fixed by #5899

Comments

@wkeese
Copy link
Contributor

wkeese commented Jul 21, 2024

Package

Carbon for IBM Products

Description

The first problem is that TearsheetShell.tsx defines portalTarget as a ReactNode whereas presumably it’s supposed to be Element;

/**
 * The DOM element that the tearsheet should be rendered within. Defaults to document.body.
 */
portalTarget?: ReactNode;

At the least, the description and the typescript declaration don’t seem to match.

But my main issue is that I get Typescript errors because (like most code) my <Tearsheet> declaration doesn’t specify portalTarget. Somehow the distribution (from NPM) has a Tearsheet.d.ts file that claims that portalTarget is mandatory:

/**
 * The DOM element that the tearsheet should be rendered within. Defaults to document.body.
 */
portalTarget: portalType,

It should be marked as optional.

Component(s) impacted

Tearsheet, TearsheetShell, TearsheetNarrow

Browser

Chrome

@carbon/ibm-products (previously @carbon/ibm-cloud-cognitive) version

2.45.0

Suggested Severity

None

Product/offering

IKC

CodeSandbox or Stackblitz example

https://carbon-for-ibm-products.netlify.app/?path=/story/ibm-products-components-tearsheet--tearsheet&globals=viewport:basic

Steps to reproduce the issue (if applicable)

No response

Release date (if applicable)

No response

Code of Conduct

@wkeese
Copy link
Contributor Author

wkeese commented Oct 25, 2024

@matthewgallo - Please reopen this, as I said above it should be typed as Element, not as ReactNode.

@wkeese
Copy link
Contributor Author

wkeese commented Nov 1, 2024

OK, I'll just open a new ticket. #6345.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants