See #17798
hook: DevToolsHook,
  rendererID: number,
  renderer: LegacyRenderer,
  global: Object,
): RendererInterface {
  const idToInternalInstanceMap: Map<number, InternalInstance> = new Map();
  const internalInstanceToIDMap: WeakMap<
    InternalInstance,
    number,
  > = new WeakMap();
  const internalInstanceToRootIDMap: WeakMap<
    InternalInstance,
    number,
  > = new WeakMap();
  let getInternalIDForNative: GetFiberIDForNative = ((null: any): GetFiberIDForNative);
  let findNativeNodeForInternalID: (id: number) => ?NativeType;
  if (renderer.ComponentTree) {
    getInternalIDForNative = (node, findNearestUnfilteredAncestor) => {
      const internalInstance = renderer.ComponentTree.getClosestInstanceFromNode(