From f88ed6033b029af678790c313068866d695a0680 Mon Sep 17 00:00:00 2001 From: Nick Saunders Date: Fri, 5 Jul 2024 19:38:12 -0700 Subject: [PATCH] Fix for `is` prop collisions. (#60) * Fix for `is` prop collisions. * add changeset * Update docs. --- .changeset/seven-books-taste.md | 5 +++++ docs/api/react.componentprops.md | 8 ++++---- packages/react/src/component.d.ts | 8 ++++---- 3 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 .changeset/seven-books-taste.md diff --git a/.changeset/seven-books-taste.md b/.changeset/seven-books-taste.md new file mode 100644 index 0000000..e20f66c --- /dev/null +++ b/.changeset/seven-books-taste.md @@ -0,0 +1,5 @@ +--- +"@embellish/react": patch +--- + +Fixed a potential \`is\` prop collision issue. diff --git a/docs/api/react.componentprops.md b/docs/api/react.componentprops.md index 68d4880..93129ff 100644 --- a/docs/api/react.componentprops.md +++ b/docs/api/react.componentprops.md @@ -14,7 +14,9 @@ P, C extends string, Is extends keyof JSX.IntrinsicElements | React.JSXElementConstructor, InlineConditionName extends string, -OwnProps = (string extends C +OwnProps = { + is?: Is; +} & (string extends C ? unknown : { conditions?: { @@ -35,9 +37,7 @@ Partial<{ ? P[PropName] : never; }>, -> = { - is?: Is; -} & Omit< +> = Omit< JSX.LibraryManagedAttributes>, keyof OwnProps > & diff --git a/packages/react/src/component.d.ts b/packages/react/src/component.d.ts index cbc115a..e20411d 100644 --- a/packages/react/src/component.d.ts +++ b/packages/react/src/component.d.ts @@ -61,7 +61,9 @@ export type ComponentProps< C extends string, Is extends keyof JSX.IntrinsicElements | React.JSXElementConstructor, InlineConditionName extends string, - OwnProps = (string extends C + OwnProps = { + is?: Is; + } & (string extends C ? unknown : { conditions?: { @@ -82,9 +84,7 @@ export type ComponentProps< ? P[PropName] : never; }>, -> = { - is?: Is; -} & Omit< +> = Omit< JSX.LibraryManagedAttributes>, keyof OwnProps > &