Reactime
Reactime copied to clipboard
Deal gracefully with missing hook.init
It seems that in some cases, declarations inside VariableDeclaration elements in the AST are missing the init property, e.g.:

So add a check to handle this gracefully.
I think I tracked down the origin of this to this declaration:

which is transpiled code from https://github.com/ant-design/ant-design/blob/678cf4948beec6fb2fadec7f930035c78ade51e2/components/steps/index.tsx#L46
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.