Skip to content

Commit

Permalink
Fix EuiTreeView JSX typescript error
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Jan 9, 2024
1 parent e67ef5d commit 2bc31cb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/tree_view/tree_view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import React, {
Component,
ComponentType,
HTMLAttributes,
createContext,
ContextType,
Expand Down Expand Up @@ -113,7 +114,10 @@ export type EuiTreeViewProps = Omit<
> &
({ 'aria-label': string } | { 'aria-labelledby': string });

export class EuiTreeView extends Component<EuiTreeViewProps, EuiTreeViewState> {
export class _EuiTreeView extends Component<
EuiTreeViewProps,
EuiTreeViewState
> {
treeIdGenerator = htmlIdGenerator('euiTreeView');

static contextType = EuiTreeViewContext;
Expand Down Expand Up @@ -432,3 +436,7 @@ export class EuiTreeView extends Component<EuiTreeViewProps, EuiTreeViewState> {
);
}
}

// This is a Typescript workaround for https://github.com/facebook/react/issues/13944#issuecomment-1183693239
// The longer term fix should likely be to convert this component to a function component instead
export const EuiTreeView = _EuiTreeView as ComponentType<EuiTreeViewProps>;

0 comments on commit 2bc31cb

Please sign in to comment.