diff --git a/modern/src/utils.ts b/modern/src/utils.ts index 0cfb4792..308954e8 100644 --- a/modern/src/utils.ts +++ b/modern/src/utils.ts @@ -287,9 +287,7 @@ function findDirectDescendantById< ); } -function* iterateLexicalScope< - T extends { children: T[]; parent: T | undefined } ->(node: T): IterableIterator { +function* iterateLexicalScope(node: MakiObject): IterableIterator { let currentNode = node; while (currentNode.parent) { const { parent } = currentNode; @@ -306,10 +304,10 @@ function* iterateLexicalScope< } // Search up the tree for a node that is in `node`'s lexical that matches `predicate`. -function findInLexicalScope( - node: T, - predicate: (node: T) => boolean -): T | null { +function findInLexicalScope( + node: MakiObject, + predicate: (node: MakiObject) => boolean +): MakiObject | null { for (const child of iterateLexicalScope(node)) { if (predicate(child)) { return child;