function getMethodParamsDoc()

in src/utils/getMethodDocumentation.ts [29:64]


function getMethodParamsDoc(
  methodPath: NodePath,
  importer: Importer,
): MethodParameter[] {
  const params: MethodParameter[] = [];
  const functionExpression = getMethodFunctionExpression(methodPath, importer);

  // Extract param flow types.
  functionExpression.get('params').each((paramPath: NodePath) => {
    let type: TypeDescriptor | null = null;
    const typePath = getTypeAnnotation(paramPath);
    if (typePath && t.Flow.check(typePath.node)) {
      type = getFlowType(typePath, null, importer);
      if (t.GenericTypeAnnotation.check(typePath.node)) {
        // @ts-ignore
        type.alias = typePath.node.id.name;
      }
    } else if (typePath) {
      type = getTSType(typePath, null, importer);
      if (t.TSTypeReference.check(typePath.node)) {
        // @ts-ignore
        type.alias = typePath.node.typeName.name;
      }
    }

    const param = {
      name: getParameterName(paramPath),
      optional: paramPath.node.optional,
      type,
    };

    params.push(param);
  });

  return params;
}