Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
fix: fixed type errors (#849)
Browse files Browse the repository at this point in the history
  • Loading branch information
grzpab authored Jan 2, 2024
1 parent f8debb9 commit d03e9ff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion intuita-webview/src/codemodList/TreeView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CodemodNode,
CodemodNodeHashDigest,
CodemodTree,
NodeDatum,
} from '../../../../src/selectors/selectCodemodTree';

import { IntuitaTreeView } from '../../intuitaTreeView';
Expand Down Expand Up @@ -43,7 +44,7 @@ const TreeView = ({
const progress = useProgressBar();

return (
<IntuitaTreeView<CodemodNodeHashDigest, CodemodNode>
<IntuitaTreeView<CodemodNodeHashDigest, CodemodNode, NodeDatum>
{...tree}
nodeRenderer={getCodemodNodeRenderer({
progress,
Expand Down
13 changes: 9 additions & 4 deletions intuita-webview/src/intuitaTreeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ export type NodeDatum<HD extends string, TN extends TreeNode<HD>> = Readonly<{
export type TreeViewProps<
HD extends string,
TN extends TreeNode<HD>,
ND extends NodeDatum<HD, TN>,
> = Readonly<{
focusedNodeHashDigest: HD | null;
collapsedNodeHashDigests: ReadonlyArray<HD>;
nodeData: ReadonlyArray<NodeDatum<HD, TN>>;
nodeData: ReadonlyArray<ND>;
nodeRenderer: (
props: Readonly<{
nodeDatum: NodeDatum<HD, TN>;
nodeDatum: ND;
onFlip: (hashDigest: HD) => void;
onFocus: (hashDigest: HD) => void;
}>,
Expand All @@ -43,8 +44,12 @@ export type TreeViewProps<
onFocus: (hashDigest: HD) => void;
}>;

export const IntuitaTreeView = <HD extends string, TN extends TreeNode<HD>>(
props: TreeViewProps<HD, TN>,
export const IntuitaTreeView = <
HD extends string,
TN extends TreeNode<HD> = TreeNode<HD>,
ND extends NodeDatum<HD, TN> = NodeDatum<HD, TN>,
>(
props: TreeViewProps<HD, TN, ND>,
) => {
const ref = useRef<HTMLDivElement>(null);

Expand Down
3 changes: 2 additions & 1 deletion src/selectors/selectCodemodRunsTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export const selectCodemodRunsTree = (state: RootState, rootPath: string) => {
kase.codemodHashDigest !== undefined
? state.privateCodemods.entities[kase.codemodHashDigest]
?.name ??
state.codemod.entities[kase.codemodHashDigest]?.name
state.codemod.entities[kase.codemodHashDigest]?.name ??
kase.codemodName
: kase.codemodName;

return {
Expand Down

0 comments on commit d03e9ff

Please sign in to comment.