function collectTypes (path: NodePath): void {
    path.traverse({
      InterfaceDeclaration (path: NodePath) {
        path.scope.setData(`typechecker:${path.node.id.name}`, path);
      },
      TypeAlias (path: NodePath) {
        path.scope.setData(`typechecker:${path.node.id.name}`, path);
      },
      ImportDeclaration (path: NodePath) {
        if (path.node.importKind !== 'type') {
          return;
        }
        path.get('specifiers')
        .forEach(specifier => {
          const local = specifier.get('local');
          if (local.isIdentifier()) {
            path.scope.setData(`typechecker:${local.node.name}`, specifier);
          }
          else {
            path.scope.setData(`typechecker:${local.node.id.name}`, specifier);
          }
        });
      },
      "Function|Class" (path: NodePath) {
        const node = path.node;
        if (node.typeParameters && node.typeParameters.params) {
          path.get('typeParameters').get('params').forEach(typeParam => {
            path.get('body').scope.setData(`typeparam:${typeParam.node.name}`, typeParam);
          });
        }
      }
    });
  }
Collect all the type declarations in the given path and add references to them for retreival later.