MCPcopy Create free account
hub / github.com/TanStack/query / propertiesPage

Function propertiesPage

scripts/generate-docs.ts:670–689  ·  view source on GitHub ↗
(outputDir: string, from: string)

Source from the content-addressed store, hash-verified

668// The page whose `## Properties` table describes the type: the type itself, or the interface every
669// member of a union extends.
670async function propertiesPage(outputDir: string, from: string) {
671 const pages = await resolveInterfacePages(outputDir, from)
672 if (!pages?.length) {
673 return undefined
674 }
675 if (pages.length === 1) {
676 return pages[0]
677 }
678 const bases = new Set<string>()
679 for (const page of pages) {
680 const base = (await readPage(outputDir, page))?.match(
681 /\n## Extends\n\n- \[`\w+`\]\((\w+)\.md\)[^\n]*\n\n##/,
682 )?.[1]
683 if (!base) {
684 return undefined
685 }
686 bases.add(`${dirname(page)}/${base}`)
687 }
688 return bases.size === 1 ? [...bases][0] : undefined
689}
690
691async function readPropertiesTable(outputDir: string, from: string) {
692 const source = await readPage(outputDir, from)

Callers 2

findPropertiesTableFunction · 0.85
basePagesFunction · 0.85

Calls 3

resolveInterfacePagesFunction · 0.85
readPageFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected