Skip to content
This repository was archived by the owner on Aug 14, 2021. It is now read-only.

Commit 947e85a

Browse files
committed
fix: Improve getter/setter support
1 parent 6f678f4 commit 947e85a

File tree

2 files changed

+91
-15
lines changed

2 files changed

+91
-15
lines changed

src/default/partials/parameter.hbs

+43-6
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,49 @@
5858
<span class="tsd-flag ts-flag{{this}}">{{this}}</span>&nbsp;
5959
{{/each}}
6060
{{#if flags.isRest}}<span class="tsd-signature-symbol">...</span>{{/if}}
61-
{{{wbr name}}}
62-
<span class="tsd-signature-symbol">
63-
{{#if flags.isOptional}}?{{/if}}
64-
:&nbsp;
65-
</span>
66-
{{#with type}}{{>type}}{{/with}}
61+
{{#with type}}
62+
{{{wbr ../name}}}
63+
<span class="tsd-signature-symbol">
64+
{{#if ../flags.isOptional}}?{{/if}}
65+
:&nbsp;
66+
</span>
67+
{{>type}}
68+
{{else}}
69+
{{#if getSignature}}
70+
{{#if setSignature}}
71+
{{{wbr name}}}
72+
<span class="tsd-signature-symbol">:&nbsp;</span>
73+
{{#with getSignature.type}}
74+
{{> type}}
75+
{{/with}}
76+
{{else}}
77+
<span class="tsd-signature-symbol">get&nbsp;</span>
78+
{{{wbr name}}}
79+
<span class="tsd-signature-symbol">():&nbsp;</span>
80+
{{#with getSignature.type}}
81+
{{> type}}
82+
{{/with}}
83+
{{/if}}
84+
{{else}}
85+
{{#if setSignature}}
86+
<span class="tsd-signature-symbol">set&nbsp;</span>
87+
{{{wbr name}}}
88+
<span class="tsd-signature-symbol">(</span>
89+
{{#each setSignature.parameters}}
90+
{{name}}
91+
<span class="tsd-signature-symbol">: </span>
92+
{{#with type}}
93+
{{> type}}
94+
{{else}}
95+
<span class="tsd-signature-type">any</span>
96+
{{/with}}
97+
{{/each}}
98+
<span class="tsd-signature-symbol">)</span>
99+
{{else}}
100+
<span class="tsd-signature-type">any</span>
101+
{{/if}}
102+
{{/if}}
103+
{{/with}}
67104
{{/compact}}</h5>
68105

69106
{{> comment}}

src/default/partials/type.hbs

+48-9
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,56 @@ if an inner type may result in invalid output without them. For example:
172172
{{#unless @first}}
173173
<span class="tsd-signature-symbol">; </span>
174174
{{/unless}}
175-
{{name}}
176-
{{#if flags.isOptional }}
177-
<span class="tsd-signature-symbol">?: </span>
175+
176+
{{#if getSignature}}
177+
{{#if setSignature}}
178+
{{name}}
179+
<span class="tsd-signature-symbol">: </span>
180+
{{#with getSignature.type}}
181+
{{> type}}
182+
{{else}}
183+
<span class="tsd-signature-type">any</span>
184+
{{/with}}
185+
{{else}}
186+
<span class="tsd-signature-symbol">get </span>
187+
{{name}}
188+
<span class="tsd-signature-symbol">(): </span>
189+
{{#with getSignature.type}}
190+
{{> type}}
191+
{{else}}
192+
<span class="tsd-signature-type">any</span>
193+
{{/with}}
194+
{{/if}}
178195
{{else}}
179-
<span class="tsd-signature-symbol">: </span>
196+
{{#if setSignature}}
197+
<span class="tsd-signature-symbol">set </span>
198+
{{name}}
199+
<span class="tsd-signature-symbol">(</span>
200+
{{! Rather hacky to use each here... but we know there is exactly one. }}
201+
{{#each setSignature.parameters}}
202+
{{name}}
203+
<span class="tsd-signature-symbol">: </span>
204+
{{#with type}}
205+
{{> type}}
206+
{{else}}
207+
<span class="tsd-signature-type">any</span>
208+
{{/with}}
209+
{{/each}}
210+
<span class="tsd-signature-symbol">)</span>
211+
{{else}}
212+
{{name}}
213+
{{#if flags.isOptional }}
214+
<span class="tsd-signature-symbol">?: </span>
215+
{{else}}
216+
<span class="tsd-signature-symbol">: </span>
217+
{{/if}}
218+
{{#with type}}
219+
{{> type}}
220+
{{else}}
221+
<span class="tsd-signature-type">any</span>
222+
{{/with}}
223+
{{/if}}
180224
{{/if}}
181-
{{#with type}}
182-
{{> type}}
183-
{{else}}
184-
<span class="tsd-signature-type">any</span>
185-
{{/with}}
186225
{{/each}}
187226
<span class="tsd-signature-symbol"> }</span>
188227
{{else if declaration.signatures}}

0 commit comments

Comments
 (0)