How to use the typedoc.ReflectionKind.Function function in typedoc

To help you get started, we’ve selected a few typedoc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mlaursen / react-md / packages / generator / typedoc / typedoc.ts View on Github external
export default async function typedoc(config: ITypeDocConfig) {
  const packages = await getDocumentablePackages();
  const srcPaths = packages.map(name => path.join(PACKAGES_FOLDER, name, "src"));
  const project = compileProject(srcPaths);

  const interfaces = project.getReflectionsByKind(
    ReflectionKind.Interface
  ) as DeclarationReflection[];

  const props = interfaces.filter(intf => /^I.*(?!Default)Props/.test(intf.name));
  const classComponents = project.getReflectionsByKind(ReflectionKind.Class);
  const functionalComponents = project
    .getReflectionsByKind(ReflectionKind.Function)
    .filter(({ name }) => /^[A-Z]/.test(name) && !/Wrapper$/.test(name));

  const components = classComponents.concat(functionalComponents) as DeclarationReflection[];

  console.log("Creating component documentation...");
  const tempDir = path.join(process.cwd(), "docs");
  await fs.ensureDir(tempDir);
  await fs.emptyDir(tempDir);
  await Promise.all(
    components.map(component => {
      // workaround for the ResizeObserrver
      const name = component.name.replace(/Comp$/, "");
      const defaultProps = component.getChildByName("defaultProps") as DeclarationReflection | null;
      const documented: DocumentedComponent = {
        name,
        description: parseAndFormatComment(component.comment || {}),
github strongloop / loopback-next / packages / tsdocs / src / ts-parser.ts View on Github external
let children = node.children;
        if (children && children.length > 0) {
          children.forEach(function(child) {
            findConstructs(child, files, node);
          });
        }
      } else {
        if (
          (node.kind === ReflectionKind.Class ||
            node.kind === ReflectionKind.Interface ||
            node.kind === ReflectionKind.TypeAlias ||
            node.kind === ReflectionKind.ObjectLiteral ||
            node.kind === ReflectionKind.Module ||
            node.kind === ReflectionKind.Variable ||
            node.kind === ReflectionKind.Enum ||
            node.kind === ReflectionKind.Function) &&
          node.flags.isExported &&
          files.find(
            filePath =>
              node.sources[0].fileName.split('/').pop() ===
              filePath.split('/').pop(),
          )
        ) {
          if (parent && parent.kind === ReflectionKind.Module) {
            // Set the node name with its parent namespace
            node.name = parent ? parent.name + '.' + node.name : node.name;
          }
          exportedConstructs.push(node);
        }
      }
    }
    findConstructs(construct, filePaths);
github strongloop / strong-docs / src / ts-parser.ts View on Github external
let children = node.children;
        if (children && children.length > 0) {
          children.forEach(function(child) {
            findConstructs(child, files, node);
          });
        }
      } else {
        if (
          (node.kind === ReflectionKind.Class ||
            node.kind === ReflectionKind.Interface ||
            node.kind === ReflectionKind.TypeAlias ||
            node.kind === ReflectionKind.ObjectLiteral ||
            node.kind === ReflectionKind.Module ||
            node.kind === ReflectionKind.Variable ||
            node.kind === ReflectionKind.Enum ||
            node.kind === ReflectionKind.Function) &&
          node.flags.isExported &&
          files.find(
            filePath =>
              node.sources != null &&
              node.sources[0].fileName.split('/').pop() ===
                filePath.split('/').pop()
          )
        ) {
          if (parent && parent.kind === ReflectionKind.Module) {
            // Set the node name with its parent namespace
            node.name = parent ? parent.name + '.' + node.name : node.name;
          }
          exportedConstructs.push(node);
        }
      }
    }
github mlaursen / react-md / packages / generator / src / typedoc.ts View on Github external
function getExportedFunctionalComponents(project: ProjectReflection, classes: boolean = false) {
  return project
    .getReflectionsByKind(classes ? ReflectionKind.Class : ReflectionKind.Function)
    .filter(
      ({ name, flags }) => /^[A-Z]/.test(name) && (!flags || !flags.isPrivate)
    ) as DeclarationReflection[];
}
github fjc0k / vtils / packages / react / scripts / buildDocs.ts View on Github external
forOwn(listByKind, (list, kind) => {
    switch (Number(kind)) {
      case ReflectionKind.Function:
        list.forEach(item => {
          (briefListByKind[kind] || (briefListByKind[kind] = [])).push({
            name: item.name,
            body: (item.signatures || []).map(signature => {
              const desc = getDesc(signature)
              const example = getExample(signature)
              return dedent`
                ${desc}

                ${example}
              `
            }).join('\n\n'),
            source: item.sources![0],
          })
        })
        break
github fjc0k / vtils / packages / taro / scripts / buildDocs.ts View on Github external
forOwn(listByKind, (list, kind) => {
    switch (Number(kind)) {
      case ReflectionKind.Function:
        list.forEach(item => {
          (briefListByKind[kind] || (briefListByKind[kind] = [])).push({
            name: item.name,
            body: (item.signatures || []).map(signature => {
              const desc = getDesc(signature)
              const example = getExample(signature)
              return dedent`
                ${desc}

                ${example}
              `
            }).join('\n\n'),
            source: item.sources![0],
          })
        })
        break
github fjc0k / vtils / packages / vtils / scripts / buildDocs.ts View on Github external
forOwn(listByKind, (list, kind) => {
    switch (Number(kind)) {
      case ReflectionKind.Function:
        list.forEach(item => {
          (briefListByKind[kind] || (briefListByKind[kind] = [])).push({
            name: item.name,
            body: (item.signatures || []).map(signature => {
              const desc = getDesc(signature)
              const example = getExample(signature)
              return dedent`
                ${desc}

                ${example}
              `
            }).join('\n\n'),
            source: item.sources![0],
          })
        })
        break