Skip to content

Commit 03d5690

Browse files
authored
findInReactTree type update (#762)
chore: add react element to react tree type
1 parent 3788e64 commit 03d5690

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/renderer/util.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,9 @@ export function findInTree(
419419
return tempReturn;
420420
}
421421

422+
export type ReactTree = (Tree & React.ReactElement) | Tree;
423+
type ReactTreeFilter = string | ((reactTree: ReactTree) => boolean);
424+
422425
/**
423426
* Find the component you are looking for in a tree, recursively.
424427
*
@@ -428,10 +431,10 @@ export function findInTree(
428431
* @returns The component you are looking for
429432
*/
430433
export function findInReactTree(
431-
tree: Tree,
432-
searchFilter: TreeFilter,
434+
tree: ReactTree,
435+
searchFilter: ReactTreeFilter,
433436
maxRecursion = 100,
434-
): Tree | null | undefined {
437+
): ReactTree | null | undefined {
435438
return findInTree(tree, searchFilter, {
436439
walkable: ["props", "children", "child", "sibling"],
437440
maxRecursion,

0 commit comments

Comments
 (0)