Skip to content

Commit 2fc86af

Browse files
authored
Merge pull request #105 from webdoc-labs/fix/@stepancar
Fix @stepanacar's bug
2 parents 5e45283 + 819217c commit 2fc86af

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const {parse} = require("../lib/parse");
2+
3+
const expect = require("chai").expect;
4+
5+
describe("@webdoc/parser.parse (tag variations)", function() {
6+
it("should not fail when @returns doesn't have a type annotation", function() {
7+
const program = () => parse([{
8+
content: `
9+
/** @returns - The sum of a, b */
10+
function add(a, b) {}
11+
12+
class Op {
13+
/** @returns - The operator applied on a, b */
14+
run(a, b): number {}
15+
}
16+
`,
17+
path: "*.ts",
18+
}]);
19+
20+
expect(program).to.not.throw();
21+
});
22+
});

packages/webdoc-template-library/src/template-plugins/LinkerPlugin.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@ function LinkerPluginShell() {
201201
* @param {boolean}[options.htmlSafe=true]
202202
* @return {string} the HTML link, or the link text if the link is not available.
203203
*/
204-
linkTo(docPath: any, linkText: string = docPath, options: LinkOptions = {}) {
204+
linkTo(docPath: any, linkText: string = docPath, options: LinkOptions | null = {}) {
205+
if (!options) {
206+
options = {};
207+
}
205208
if (!docPath) {
206209
return "";
207210
}

0 commit comments

Comments
 (0)