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 authored and GitHub committed 2024-08-01 15:45:41 +00:00
1 parent 560b6c74a4
commit 4a95a48e94
2 files changed
+6 -5

No files matched your search

@@ -18,13 +18,10 @@ export default function (theme: MarkdownTheme) {
reflection: parameter, reflection: parameter,
level: 1, level: 1,
maxLevel, maxLevel,
isTypeParams: true,
}) })
) )
// if (typeof options.hash.sectionTitle !== "string") {
// console.log("here3")
// }
return formatParameterComponent({ return formatParameterComponent({
parameterComponent, parameterComponent,
componentItems: parameters, componentItems: parameters,
@@ -37,6 +37,7 @@ type ReflectionFormatterOptions = {
maxLevel?: number | undefined maxLevel?: number | undefined
project?: ProjectReflection project?: ProjectReflection
type?: ParameterStyle type?: ParameterStyle
isTypeParams?: boolean
} }
export default function reflectionFormatter({ export default function reflectionFormatter({
@@ -123,10 +124,13 @@ export function reflectionComponentFormatter({
level = 1, level = 1,
maxLevel, maxLevel,
project, project,
isTypeParams,
}: ReflectionFormatterOptions): Parameter { }: ReflectionFormatterOptions): Parameter {
const defaultValue = getDefaultValue(reflection) || "" const defaultValue = getDefaultValue(reflection) || ""
const optional = const optional =
reflection.flags.isOptional || reflection.kind === ReflectionKind.EnumMember isTypeParams ||
reflection.flags.isOptional ||
reflection.kind === ReflectionKind.EnumMember
const comments = getComments(reflection) const comments = getComments(reflection)
const componentItem: Parameter = { const componentItem: Parameter = {
name: reflection.name, name: reflection.name,