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

Function isWrapperAlias

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

Source from the content-addressed store, hash-verified

268// passed, i.e. aliases like `Accessor<T> = () => T` and inline `() => T`.
269// Whether a type alias only changes how its single type argument is passed, e.g. `Accessor<T> = () => T`.
270async function isWrapperAlias(outputDir: string, from: string) {
271 const code = (await readPage(outputDir, from))?.match(
272 /```ts\ntype \w+<(\w+)> = ([^\n]*);\n```/,
273 )
274 return (
275 !!code &&
276 code[2]!
277 .split(' | ')
278 .every((member) => member === code[1] || member === `() => ${code[1]}`)
279 )
280}
281
282// The type page a `Parameters`/`Returns` type line refers to when the whole line is that one type
283// (with an optional default value), looking through wrappers that only change how the value is

Callers 3

linkedTypePageFunction · 0.85
typeNameInCodeFunction · 0.85
basePagesOfTypeFunction · 0.85

Calls 1

readPageFunction · 0.85

Tested by

no test coverage detected