Skip to content

Commit 5a77b19

Browse files
Add test case for functions returning objects
1 parent f753251 commit 5a77b19

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

examples/basic/src/functions.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,16 @@ export module moduleFunction
166166

167167
}
168168
}
169+
170+
171+
/**
172+
* A function that returns an object.
173+
* Also no type information is given, the object should be correctly reflected.
174+
*/
175+
export function createSomething() {
176+
return {
177+
foo: 'bar',
178+
doSomething: (a:number) => a +1,
179+
doAnotherThing: () => {}
180+
};
181+
}

test/renderer/specs/modules/_functions_.html

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ <h3>Modules</h3>
8080
<section class="tsd-index-section ">
8181
<h3>Functions</h3>
8282
<ul class="tsd-index-list">
83+
<li class="tsd-kind-function tsd-parent-kind-external-module"><a href="_functions_.html#createsomething" class="tsd-kind-icon">create<wbr>Something</a></li>
8384
<li class="tsd-kind-function tsd-parent-kind-external-module"><a href="_functions_.html#exportedfunction" class="tsd-kind-icon">exported<wbr>Function</a></li>
8485
<li class="tsd-kind-function tsd-parent-kind-external-module"><a href="_functions_.html#functionwitharguments" class="tsd-kind-icon">function<wbr>With<wbr>Arguments</a></li>
8586
<li class="tsd-kind-function tsd-parent-kind-external-module"><a href="_functions_.html#functionwithdefaults" class="tsd-kind-icon">function<wbr>With<wbr>Defaults</a></li>
@@ -96,6 +97,70 @@ <h3>Functions</h3>
9697
</section>
9798
<section class="tsd-panel-group tsd-member-group ">
9899
<h2>Functions</h2>
100+
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-external-module">
101+
<a name="createsomething" class="tsd-anchor"></a>
102+
<h3>create<wbr>Something</h3>
103+
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-external-module">
104+
<li class="tsd-signature tsd-kind-icon">create<wbr>Something<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span></li>
105+
</ul>
106+
<ul class="tsd-descriptions">
107+
<li class="tsd-description">
108+
<aside class="tsd-sources">
109+
<ul>
110+
<li>Defined in <a href="https://github.com/sebastian-lenz/typedoc/blob/master/examples/basic/src/functions.ts#L175">functions.ts:175</a></li>
111+
</ul>
112+
</aside>
113+
<div class="tsd-comment tsd-typography">
114+
<div class="lead">
115+
<p>A function that returns an object.
116+
Also no type information is given, the object should be correctly reflected.</p>
117+
</div>
118+
</div>
119+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">object</span></h4>
120+
<ul class="tsd-parameters">
121+
<li class="tsd-parameter">
122+
<h5>foo<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5>
123+
</li>
124+
<li class="tsd-parameter">
125+
<h5>do<wbr>Another<wbr>Thing<span class="tsd-signature-symbol">: </span>function</h5>
126+
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-type-literal tsd-is-not-exported">
127+
<li class="tsd-signature tsd-kind-icon">do<wbr>Another<wbr>Thing<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
128+
</ul>
129+
<ul class="tsd-descriptions">
130+
<li class="tsd-description">
131+
<aside class="tsd-sources">
132+
<ul>
133+
<li>Defined in <a href="https://github.com/sebastian-lenz/typedoc/blob/master/examples/basic/src/functions.ts#L179">functions.ts:179</a></li>
134+
</ul>
135+
</aside>
136+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
137+
</li>
138+
</ul> </li>
139+
<li class="tsd-parameter">
140+
<h5>do<wbr>Something<span class="tsd-signature-symbol">: </span>function</h5>
141+
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-type-literal tsd-is-not-exported">
142+
<li class="tsd-signature tsd-kind-icon">do<wbr>Something<span class="tsd-signature-symbol">(</span>a<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li>
143+
</ul>
144+
<ul class="tsd-descriptions">
145+
<li class="tsd-description">
146+
<aside class="tsd-sources">
147+
<ul>
148+
<li>Defined in <a href="https://github.com/sebastian-lenz/typedoc/blob/master/examples/basic/src/functions.ts#L178">functions.ts:178</a></li>
149+
</ul>
150+
</aside>
151+
<h4 class="tsd-parameters-title">Parameters</h4>
152+
<ul class="tsd-parameters">
153+
<li>
154+
<h5>a: <span class="tsd-signature-type">number</span></h5>
155+
</li>
156+
</ul>
157+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
158+
</li>
159+
</ul> </li>
160+
</ul>
161+
</li>
162+
</ul>
163+
</section>
99164
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-external-module">
100165
<a name="exportedfunction" class="tsd-anchor"></a>
101166
<h3>exported<wbr>Function</h3>
@@ -500,6 +565,9 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</s
500565
</nav>
501566
<nav class="tsd-navigation secondary menu-sticky">
502567
<ul class="before-current">
568+
<li class=" tsd-kind-function tsd-parent-kind-external-module">
569+
<a href="_functions_.html#createsomething" class="tsd-kind-icon">create<wbr>Something</a>
570+
</li>
503571
<li class=" tsd-kind-function tsd-parent-kind-external-module">
504572
<a href="_functions_.html#exportedfunction" class="tsd-kind-icon">exported<wbr>Function</a>
505573
</li>

0 commit comments

Comments
 (0)