Files
medusa-store/docs-util/packages/utils/src/get-project-child.ts
Shahed Nasser 91615f9c45 chore: improve JS Client TSDoc comments (#5582)
* add oas schema to tsdoc parser

* add tsdoc (part 1)

* Finished tsdoc in js client

* general fixes

* added tsdoc in core medusa package

* parse schema tags in model files

* added maxlevel option

* added more tsdoc

* added tsdoc in core

* added TSDoc in core package

* generated client types

* support featureFlag and expandable tags

* added support for resource feature flag note

* fix api ignore plugin

* added eslint plugin

* support feature flag and expandable badges

* adjusted overview page + generated reference

* revert generated files

* added changeset

* add details about new typedoc options

* fix broken link
2023-11-09 12:51:17 +02:00

44 lines
989 B
TypeScript

import {
DeclarationReflection,
ProjectReflection,
ReflectionKind,
} from "typedoc"
export function getProjectChild(
project: ProjectReflection,
childName: string
): DeclarationReflection | undefined {
let reflection: DeclarationReflection | undefined = project.getChildByName(
childName
) as DeclarationReflection
const splitChildName = childName.split(".")
if (!reflection && splitChildName.length > 1) {
reflection = getProjectChild(
project,
splitChildName[splitChildName.length - 1]
)
}
if (
!reflection &&
project.parent &&
project.parent instanceof ProjectReflection
) {
reflection = getProjectChild(project.parent, childName)
}
if (!reflection) {
const modules = project.getChildrenByKind(ReflectionKind.Module)
for (const module of modules) {
reflection = module.getChildByName(childName) as DeclarationReflection
if (reflection) {
break
}
}
}
return reflection
}