Skip to content

Commit 724b238

Browse files
authored
Add test for literal property type (#185)
1 parent 06fb082 commit 724b238

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

language/language-parser/src/transformer/symbol-to-doc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ export default function symbolToDoc(symbol: Symbol): ?Doc {
295295

296296
// Infer everything we can from the metadata
297297
function infer(doc: any, meta: SymbolSignature) {
298-
doc.params = mergeParams(doc.params ?? [], meta.params);
299-
doc.returns = mergeReturns(doc.returns ?? [], meta.returns);
298+
doc.params = mergeParams(doc.params, meta.params) ?? [];
299+
doc.returns = mergeReturns(doc.returns, meta.returns) ?? [];
300300
doc.extends = doc.extends || meta.extends || [];
301301
doc.implements = doc.implements || meta.implements || [];
302302
doc.typeParameters = doc.typeParameters || meta.typeParameters || [];

language/language-parser/test/parse-ts.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ describe("@webdoc/parser.parse (Typescript)", function() {
314314
expect(childClass.members.filter(div)[0].overrides).to.not.equal(undefined);
315315
});
316316

317-
it.only("should cast property to @method properly", async () => {
317+
it("should cast property to @method properly", async function() {
318318
await parse([{
319319
content: `
320320
/** DO */
@@ -336,4 +336,22 @@ describe("@webdoc/parser.parse (Typescript)", function() {
336336
path: "*.ts",
337337
}]);
338338
});
339+
340+
it("can model literal data types", async function() {
341+
await parse([
342+
{
343+
content: `
344+
class Graph {}
345+
346+
class Tree extends Graph {
347+
/** True */
348+
public empty: true;
349+
}
350+
351+
class TestTree extends Tree {}
352+
`,
353+
path: "*.ts",
354+
},
355+
]);
356+
});
339357
});

0 commit comments

Comments
 (0)