Skip to content

fixed declarations that reference their own identifiers#910

Merged
tomblind merged 4 commits intoTypeScriptToLua:masterfrom
tomblind:decl-self-ref-fix
Aug 1, 2020
Merged

fixed declarations that reference their own identifiers#910
tomblind merged 4 commits intoTypeScriptToLua:masterfrom
tomblind:decl-self-ref-fix

Conversation

@tomblind
Copy link
Copy Markdown
Collaborator

fixes #894

Co-authored-by: ark120202 <ark120202@gmail.com>

const referenceLists = castArray(identifiers).map(i => i.symbolId && scopeSymbols.get(i.symbolId));

return referenceLists.some(symbolRefs => symbolRefs && symbolRefs.length > 1);
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.

Maybe

Suggested change
return referenceLists.some(symbolRefs => symbolRefs && symbolRefs.length > 1);
return referenceLists.some(symbolRefs => symbolRefs?.length > 1);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This change won't work as symbolRefs?.length resolves to number | undefined which can't be compared to a number like that. I could change it to something like (symbolRefs?.length || 0) > 1, but I feel like it looses clarity that way.

@tomblind tomblind merged commit 8dd12a9 into TypeScriptToLua:master Aug 1, 2020
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.

Referencing return value in callback passed as argument

3 participants