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

Commit

Permalink
spread is too slow (when compiled to es5)
Browse files Browse the repository at this point in the history
  • Loading branch information
melnikov-s committed Apr 1, 2021
1 parent 8453341 commit 56b6bf3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/react-testing/src/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,14 @@ function equalSubset(subset: object, full: object) {
);
}

function getDescendants(element) {
function getDescendants(element: any) {
const descendants: Element<unknown>[] = [];
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < element.elementChildren.length; i++) {
const child = element.elementChildren[i];
descendants.push(child, ...getDescendants(child));
descendants.push(child);
// eslint-disable-next-line prefer-spread
descendants.push.apply(descendants, child.elementDescendants);
}

return descendants;
Expand Down

0 comments on commit 56b6bf3

Please sign in to comment.