Reactime icon indicating copy to clipboard operation
Reactime copied to clipboard

Deal gracefully with missing hook.init

Open aspiers opened this issue 4 years ago • 2 comments

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.

aspiers avatar Dec 11 '21 20:12 aspiers

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 avatar Dec 12 '21 16:12 aspiers

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.

aspiers avatar Dec 12 '21 16:12 aspiers