docs-util: mark type parameters as optional (#8320)

Mark all type parameters in references as optional.

Closes DOCS-802
This commit is contained in:
Shahed Nasser
2024-08-01 18:45:41 +03:00
committed by GitHub
parent 560b6c74a4
commit 4a95a48e94
2 changed files with 6 additions and 5 deletions

View File

@@ -18,13 +18,10 @@ export default function (theme: MarkdownTheme) {
reflection: parameter,
level: 1,
maxLevel,
isTypeParams: true,
})
)
// if (typeof options.hash.sectionTitle !== "string") {
// console.log("here3")
// }
return formatParameterComponent({
parameterComponent,
componentItems: parameters,

View File

@@ -37,6 +37,7 @@ type ReflectionFormatterOptions = {
maxLevel?: number | undefined
project?: ProjectReflection
type?: ParameterStyle
isTypeParams?: boolean
}
export default function reflectionFormatter({
@@ -123,10 +124,13 @@ export function reflectionComponentFormatter({
level = 1,
maxLevel,
project,
isTypeParams,
}: ReflectionFormatterOptions): Parameter {
const defaultValue = getDefaultValue(reflection) || ""
const optional =
reflection.flags.isOptional || reflection.kind === ReflectionKind.EnumMember
isTypeParams ||
reflection.flags.isOptional ||
reflection.kind === ReflectionKind.EnumMember
const comments = getComments(reflection)
const componentItem: Parameter = {
name: reflection.name,