I noticed some of the checking was just string rather than the actual node types.
This ensures that every node type is actually implemented in the visitor by checking that the set of "visited" types matches the set of declared types.
It looks like we could also just look at ReturnType<typeof visit> which will be any if we missed any node types in the visitor, and void otherwise. But it would be hard (I think) to generate a meaningful error beyond "not all the node types were handled".
I noticed some of the checking was just
string
rather than the actual node types.This ensures that every node type is actually implemented in the visitor by checking that the set of "visited" types matches the set of declared types.
It looks like we could also just look at
ReturnType<typeof visit>
which will beany
if we missed any node types in the visitor, andvoid
otherwise. But it would be hard (I think) to generate a meaningful error beyond "not all the node types were handled".