Skip to content

Commit 24fb9a7

Browse files
Token: Omit onResize and onResizeCapture methods from the interface as they cause type issues in React 18 (#2760)
* Token: Omit generated methods that causes type issues * add changeset
1 parent dd1e5ce commit 24fb9a7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/olive-parents-search.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': patch
3+
---
4+
5+
Token: Omit `onResize` and `onResizeCapture` methods that are included in the method expansion and causes type issues in React 18

src/Token/Token.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import TokenBase, {defaultTokenSize, isTokenInteractive, TokenBaseProps} from '.
66
import RemoveTokenButton from './_RemoveTokenButton'
77
import TokenTextContainer from './_TokenTextContainer'
88

9-
export interface TokenProps extends TokenBaseProps {
9+
// Omitting onResize and onResizeCapture because seems like React 18 types includes these menthod in the expansion but React 17 doesn't.
10+
// TODO: This is a temporary solution until we figure out why these methods are causing type errors.
11+
export interface TokenProps extends Omit<TokenBaseProps, 'onResize' | 'onResizeCapture'> {
1012
/**
1113
* A function that renders a component before the token text
1214
*/

0 commit comments

Comments
 (0)