-
Notifications
You must be signed in to change notification settings - Fork 677
/
member.declaration.tsx
40 lines (35 loc) · 1.39 KB
/
member.declaration.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { DeclarationReflection, ReflectionType } from "../../../../models";
import { JSX } from "../../../../utils";
import { hasTypeParameters, renderTypeParametersSignature, wbr } from "../../lib";
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
export const memberDeclaration = (context: DefaultThemeRenderContext, props: DeclarationReflection) => (
<>
<div class="tsd-signature">
{wbr(props.name)}
{renderTypeParametersSignature(props.typeParameters)}
{props.type && (
<>
<span class="tsd-signature-symbol">{!!props.flags.isOptional && "?"}:</span>{" "}
{context.type(props.type)}
</>
)}
{!!props.defaultValue && (
<>
<span class="tsd-signature-symbol">
{" = "}
{props.defaultValue}
</span>
</>
)}
</div>
{context.comment(props)}
{hasTypeParameters(props) && context.typeParameters(props.typeParameters)}
{props.type instanceof ReflectionType && (
<div class="tsd-type-declaration">
<h4>Type declaration</h4>
{context.parameter(props.type.declaration)}
</div>
)}
{context.memberSources(props)}
</>
);