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

Bug - ClipboardCopy - TS type does not allow string[] children #11186

Open
Venefilyn opened this issue Nov 14, 2024 · 0 comments · May be fixed by #11177
Open

Bug - ClipboardCopy - TS type does not allow string[] children #11186

Venefilyn opened this issue Nov 14, 2024 · 0 comments · May be fixed by #11177

Comments

@Venefilyn
Copy link

Venefilyn commented Nov 14, 2024

Describe the problem
Code itself allows for children of string[] but did not have the types setup correctly.

Expected behavior
tsc does not complain that something like this is incorrect

<ClipboardCopy
  hoverTip="Copy"
  clickTip="Copied"
  variant="inline-compact"
  isCode
>
  sudo dnf copr enable {data.copr_owner}/
  {data.copr_project} {data.chroot}
</ClipboardCopy>
Type '{ children: string[]; hoverTip: string; clickTip: string; variant: "inline-compact"; isCode: true; }' is not assignable to type 'Pick<Readonly<ClipboardCopyProps>, "children">'.
  Types of property 'children' are incompatible.
    Type 'string[]' is not assignable to type 'string'.ts(2322)

Is this issue blocking you?
No. Workaround is to ignore the warning
No. Workaround is to wrap the children in a statement, e.g.

<ClipboardCopy
  hoverTip="Copy"
  clickTip="Copied"
  variant="inline-compact"
  isCode
>
  {`sudo dnf copr enable ${data.copr_owner}/${data.copr_project} ${data.chroot}`}
</ClipboardCopy>
@Venefilyn Venefilyn linked a pull request Nov 14, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this to Needs triage in PatternFly Issues Nov 14, 2024
@tlabaj tlabaj moved this from Needs triage to PR Review in PatternFly Issues Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: PR Review
Development

Successfully merging a pull request may close this issue.

1 participant