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

fix: fixed type errors #849

Merged
merged 2 commits into from
Jan 2, 2024
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
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
Loading