Skip to content

Conversation

@aspiers
Copy link

@aspiers aspiers commented Dec 11, 2021

It seems that in some cases, declarations inside VariableDeclaration elements in the AST are missing the init property, e.g.:

image

So add a check to handle this gracefully.

It seems that in some cases, VariableDeclaration elements in the AST
are missing the init property.  So add a check to handle this
gracefully.
@aspiers
Copy link
Author

aspiers commented Dec 12, 2021

I think I tracked down the origin of this to this declaration:

image

which is transpiled code from https://github.com/ant-design/ant-design/blob/678cf4948beec6fb2fadec7f930035c78ade51e2/components/steps/index.tsx#L46

@aspiers
Copy link
Author

aspiers commented Dec 12, 2021

IOW, any uninitialised variable declaration would cause it. The reactime code seems to assume that the variable declaration must be a hook, but clearly that doesn't have to be the case.

Copy link
Contributor

@llam722 llam722 left a comment

Choose a reason for hiding this comment

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

Hi aspiers,
Great catch regarding the uninitialised variable declaration and implementation of the optional chaining. Thanks for the contribution on this issue!

@SamuelTr13 SamuelTr13 merged commit 6569971 into open-source-labs:master Nov 26, 2022
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.

3 participants