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

Function linkedTypePage

scripts/generate-docs.ts:285–304  ·  view source on GitHub ↗
(outputDir: string, typeLine: string)

Source from the content-addressed store, hash-verified

283// (with an optional default value), looking through wrappers that only change how the value is
284// passed, i.e. aliases like `Accessor<T> = () => T` and inline `() => T`.
285async function linkedTypePage(outputDir: string, typeLine: string) {
286 let line = typeLine
287 for (;;) {
288 line = line.replace(/^\(\) => /, '')
289 const link = line.match(
290 /^\[`\w+`\]\(\.\.\/((?:interfaces|type-aliases)\/\w+)\.md\)/,
291 )
292 if (!link) {
293 return undefined
294 }
295 const { typeArguments, after } = splitTypeArguments(
296 line.slice(link[0].length),
297 )
298 if (typeArguments && (await isWrapperAlias(outputDir, link[1]!))) {
299 line = typeArguments
300 continue
301 }
302 return after === '' || after.startsWith(' = ') ? link[1] : undefined
303 }
304}
305
306// The name of the type a signature's code starts with, looking through the same wrappers.
307async function typeNameInCode(outputDir: string, code: string) {

Callers 1

findPropertiesTableFunction · 0.85

Calls 2

splitTypeArgumentsFunction · 0.85
isWrapperAliasFunction · 0.85

Tested by

no test coverage detected