Skip to content

fix 'undefined is not iterable' when printing json output#40

Open
beerose wants to merge 1 commit into
microsoft:mainfrom
beerose:fix-non-iterable-object
Open

fix 'undefined is not iterable' when printing json output#40
beerose wants to merge 1 commit into
microsoft:mainfrom
beerose:fix-non-iterable-object

Conversation

@beerose
Copy link
Copy Markdown

@beerose beerose commented Oct 20, 2023

currently running analyze-trace with --json flag results in:

Internal Error: undefined is not iterable (cannot read property Symbol(Symbol.iterator))\nTypeError: undefined is not iterable

(getHotSpotsWorker can return undefined in some cases)

const sortedChildren = curr.children.sort((a, b) => (b.end - b.start) - (a.end - a.start));
for (const child of sortedChildren) {
children.push(...await getHotSpotsWorker(child, currentFile, positionMap, relatedTypes, importExpressionThreshold));
children.push(...(await getHotSpotsWorker(child, currentFile, positionMap, relatedTypes, importExpressionThreshold) || []));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be possible; the return type is declared as Promise<HotFrame[]>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants