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

Token: Omit onResize and onResizeCapture methods from the interface as they cause type issues in React 18 #2760

Merged
merged 2 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/olive-parents-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Token: Omit `onResize` and `onResizeCapture` methods that are included in the method expansion and causes type issues in React 18
4 changes: 3 additions & 1 deletion src/Token/Token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import TokenBase, {defaultTokenSize, isTokenInteractive, TokenBaseProps} from '.
import RemoveTokenButton from './_RemoveTokenButton'
import TokenTextContainer from './_TokenTextContainer'

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