@microsoft/type2docfx 1.3.2-dev.1210049.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.version/PipelineAssemblyInfo.cs +3 -3
  2. package/.version/PipelineAssemblyInfo.h +3 -3
  3. package/.version/build.number.info +1 -1
  4. package/.version/commit.version.info +1 -1
  5. package/.version/numeric.fileversion.info +1 -1
  6. package/.version/numeric.fileversion.info.noleadingzeros +1 -1
  7. package/.version/numeric.packageversion.info +1 -1
  8. package/.version/revision.number.info +1 -1
  9. package/.version/semantic.fileversion.info +1 -1
  10. package/.version/semantic.packageversion.info +1 -1
  11. package/.version/versions.xml +1 -1
  12. package/dist/cli.js +6 -6
  13. package/dist/cli.js.map +1 -1
  14. package/dist/common/constants.js +1 -1
  15. package/dist/common/constants.js.map +1 -1
  16. package/dist/common/error.js +38 -24
  17. package/dist/common/error.js.map +1 -1
  18. package/dist/converters/accessor.js +18 -31
  19. package/dist/converters/accessor.js.map +1 -1
  20. package/dist/converters/base.js +323 -198
  21. package/dist/converters/base.js.map +1 -1
  22. package/dist/converters/context.js +21 -38
  23. package/dist/converters/context.js.map +1 -1
  24. package/dist/converters/converter.js +19 -19
  25. package/dist/converters/converter.js.map +1 -1
  26. package/dist/converters/empty.js +5 -23
  27. package/dist/converters/empty.js.map +1 -1
  28. package/dist/converters/enum.js +14 -29
  29. package/dist/converters/enum.js.map +1 -1
  30. package/dist/converters/method.js +16 -32
  31. package/dist/converters/method.js.map +1 -1
  32. package/dist/converters/module.js +10 -28
  33. package/dist/converters/module.js.map +1 -1
  34. package/dist/converters/property.js +41 -36
  35. package/dist/converters/property.js.map +1 -1
  36. package/dist/converters/reference.js +20 -0
  37. package/dist/converters/reference.js.map +1 -0
  38. package/dist/converters/type.js +24 -36
  39. package/dist/converters/type.js.map +1 -1
  40. package/dist/helpers/linkConvertHelper.js +5 -6
  41. package/dist/helpers/linkConvertHelper.js.map +1 -1
  42. package/dist/helpers/toSdpConvertHelper.js +112 -81
  43. package/dist/helpers/toSdpConvertHelper.js.map +1 -1
  44. package/dist/idResolver.js +101 -27
  45. package/dist/idResolver.js.map +1 -1
  46. package/dist/main.js +162 -100
  47. package/dist/main.js.map +1 -1
  48. package/dist/parser.js +25 -32
  49. package/dist/parser.js.map +1 -1
  50. package/dist/postTransformer.js +34 -39
  51. package/dist/postTransformer.js.map +1 -1
  52. package/dist/tocGenerator.js +14 -15
  53. package/dist/tocGenerator.js.map +1 -1
  54. package/package.json +11 -12
  55. package/tsconfig.json +5 -2
  56. package/dist/moduleGenerator.js +0 -34
  57. package/dist/moduleGenerator.js.map +0 -1
  58. package/dist/packageGenerator.js +0 -35
  59. package/dist/packageGenerator.js.map +0 -1
@@ -1,149 +1,181 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  exports.AbstractConverter = void 0;
15
- var idResolver_1 = require("../idResolver");
16
- var linkConvertHelper_1 = require("../helpers/linkConvertHelper");
17
- var AbstractConverter = /** @class */ (function () {
18
- function AbstractConverter(references) {
4
+ const idResolver_1 = require("../idResolver");
5
+ const linkConvertHelper_1 = require("../helpers/linkConvertHelper");
6
+ const error_1 = require("../common/error");
7
+ class AbstractConverter {
8
+ constructor(references) {
19
9
  this.references = references;
20
10
  }
21
- AbstractConverter.prototype.convert = function (node, context) {
22
- var _this = this;
11
+ convert(node, context) {
23
12
  var models = this.generate(node, context) || [];
24
- models.forEach(function (model, i) {
25
- model.summary = linkConvertHelper_1.convertLinkToGfm(model.summary);
13
+ models.forEach((model, i) => {
26
14
  model.package = context.PackageName;
27
- if (node.comment || (node.signatures && node.signatures.length && node.signatures[i].comment)) {
28
- _this.setCustomModuleName(model, node.comment);
29
- var comment = node.comment ? node.comment : node.signatures[i].comment;
30
- _this.setDeprecated(model, comment);
31
- _this.setPreviewState(model, comment);
32
- _this.setRemarks(model, comment);
33
- _this.setInherits(model, comment);
15
+ let signatureComment = undefined;
16
+ if (node.signatures && node.signatures.length) {
17
+ signatureComment = node.signatures[i].comment;
18
+ }
19
+ const anonymousComment = this.extractCommentForAnonymousFunction(node.type);
20
+ if (node.comment || signatureComment || anonymousComment) {
21
+ this.setCustomModuleName(model, node.comment);
22
+ const comment = node.comment || signatureComment || anonymousComment;
23
+ this.setDeprecated(model, comment);
24
+ this.setPreviewState(model, comment);
25
+ this.setRemarks(model, comment);
26
+ this.setInherits(model, comment);
34
27
  }
35
28
  });
36
29
  return models;
37
- };
38
- AbstractConverter.prototype.setDeprecated = function (model, comment) {
39
- var deprecated = this.extractTextFromComment('deprecated', comment);
30
+ }
31
+ setDeprecated(model, comment) {
32
+ const deprecated = this.extractTextFromComment('@deprecated', comment);
40
33
  if (deprecated != null) {
41
34
  model.deprecated = {
42
- content: linkConvertHelper_1.convertLinkToGfm(deprecated)
35
+ content: deprecated
43
36
  };
44
37
  }
45
- };
46
- AbstractConverter.prototype.setPreviewState = function (model, comment) {
47
- if (comment && comment.tags) {
48
- for (var _i = 0, _a = comment.tags; _i < _a.length; _i++) {
49
- var tag = _a[_i];
50
- if (tag.tag === 'alpha') {
51
- model.previewState = 'alpha';
52
- break; // select 'alpha' if both 'alpha' and 'beta' tags are present.
53
- }
54
- else if (tag.tag === 'beta') {
55
- model.previewState = 'beta';
56
- }
57
- }
38
+ }
39
+ setPreviewState(model, comment) {
40
+ const existBetaTag = this.extractModifierFromComment('@beta', comment);
41
+ const existAlphaTag = this.extractModifierFromComment('@alpha', comment);
42
+ if (existBetaTag) {
43
+ model.previewState = 'beta';
58
44
  }
59
- };
60
- AbstractConverter.prototype.setRemarks = function (model, comment) {
61
- var remarks = this.extractTextFromComment('remarks', comment);
45
+ if (existAlphaTag) {
46
+ model.previewState = 'alpha';
47
+ }
48
+ }
49
+ setRemarks(model, comment) {
50
+ const remarks = this.extractTextFromComment('@remarks', comment);
62
51
  if (remarks != null) {
63
- model.remarks = linkConvertHelper_1.convertLinkToGfm(remarks);
52
+ model.remarks = remarks;
64
53
  }
65
- };
66
- AbstractConverter.prototype.setCustomModuleName = function (model, comment) {
67
- var customModuleName = this.extractTextFromComment('module', comment);
54
+ }
55
+ setCustomModuleName(model, comment) {
56
+ const customModuleName = this.extractTextFromComment('@module', comment);
68
57
  if (customModuleName) {
69
58
  model.module = customModuleName;
70
59
  }
71
- };
72
- AbstractConverter.prototype.setInherits = function (model, comment) {
73
- var inherits = this.extractTextFromComment('inherits', comment);
60
+ }
61
+ setInherits(model, comment) {
62
+ const inherits = this.extractTextFromComment('@inherits', comment);
74
63
  if (inherits != null) {
75
- var tokens = linkConvertHelper_1.getTextAndLink(inherits);
64
+ const tokens = (0, linkConvertHelper_1.getTextAndLink)(inherits);
76
65
  if (tokens.length === 2) {
77
- model.extends = {
78
- name: tokens[0],
79
- href: tokens[1]
80
- };
66
+ model.extends = [{
67
+ name: tokens[0],
68
+ href: tokens[1]
69
+ }];
81
70
  }
82
71
  }
83
- };
84
- AbstractConverter.prototype.extractTextFromComment = function (infoName, comment) {
85
- if (comment && comment.tags) {
86
- for (var _i = 0, _a = comment.tags; _i < _a.length; _i++) {
87
- var tag = _a[_i];
88
- if (tag.tag === infoName) {
89
- return tag.text.trim();
90
- }
72
+ }
73
+ extractModifierFromComment(infoName, comment) {
74
+ if (comment && comment.modifierTags) {
75
+ if (comment.modifierTags.includes(infoName)) {
76
+ return true;
91
77
  }
92
78
  }
93
- return null;
94
- };
95
- AbstractConverter.prototype.getGenericType = function (typeParameters) {
79
+ return false;
80
+ }
81
+ extractTextFromComment(infoName, comment) {
82
+ if (!comment) {
83
+ return null;
84
+ }
85
+ if (!comment.blockTags) {
86
+ return null;
87
+ }
88
+ const tag = comment.blockTags.find(item => {
89
+ return item.tag === infoName;
90
+ });
91
+ if (!tag) {
92
+ return null;
93
+ }
94
+ return this.combineDisplayParts(tag.content);
95
+ }
96
+ getGenericType(typeParameters) {
96
97
  if (typeParameters && typeParameters.length) {
97
- var typeArgumentsList = typeParameters.map(function (item) {
98
+ let typeArgumentsList = typeParameters.map(item => {
98
99
  return item.name;
99
100
  }).join(', ');
100
101
  return '<' + typeArgumentsList + '>';
101
102
  }
102
103
  return '';
103
- };
104
- AbstractConverter.prototype.findDescriptionInComment = function (comment) {
104
+ }
105
+ extractCommentForAnonymousFunction(type) {
106
+ // when is a anonymous function, commont should be extract from this method
107
+ if (type && type.type === 'reflection' && type.declaration) {
108
+ const signatures = type.declaration.signatures;
109
+ if (signatures && signatures.length) {
110
+ return signatures[0].comment;
111
+ }
112
+ }
113
+ return undefined;
114
+ }
115
+ findDescriptionInAnonymousFunction(type) {
116
+ /**
117
+ * comment for below anonymous function
118
+ * () => void
119
+ */
120
+ const comment = this.extractCommentForAnonymousFunction(type);
121
+ if (comment) {
122
+ return this.findDescriptionInComment(comment);
123
+ }
124
+ return '';
125
+ }
126
+ findDescriptionInComment(comment) {
105
127
  if (!comment) {
106
128
  return '';
107
129
  }
108
- var descText = this.parseDescTextFromComment(comment);
109
- var tagText = this.extractTagsTextFromComment(comment);
110
- return "" + descText + tagText;
111
- };
112
- AbstractConverter.prototype.parseDescTextFromComment = function (comment) {
113
- if (comment.tags) {
114
- var text_1 = null;
115
- comment.tags.forEach(function (tag) {
116
- if (tag.tag === 'classdesc'
117
- || tag.tag === 'description'
118
- || tag.tag === 'exemptedapi'
119
- || tag.tag === 'property') {
120
- text_1 = tag.text.trim();
130
+ const descText = this.parseDescTextFromComment(comment);
131
+ const tagText = this.extractTagsTextFromComment(comment);
132
+ return `${descText}${tagText}`;
133
+ }
134
+ parseDescTextFromComment(comment) {
135
+ if (comment.blockTags) {
136
+ let text = null;
137
+ comment.blockTags.forEach(tag => {
138
+ if (tag.tag === '@classdesc'
139
+ || tag.tag === '@description'
140
+ || tag.tag === '@exemptedapi'
141
+ || tag.tag === '@property') {
142
+ text = this.combineDisplayParts(tag.content);
121
143
  return;
122
144
  }
123
145
  });
124
- if (text_1) {
125
- return text_1.trim();
146
+ if (text) {
147
+ return text.trim();
126
148
  }
127
149
  }
128
- if (comment.shortText && comment.text) {
129
- return comment.shortText + "\n" + comment.text;
130
- }
131
- if (comment.text) {
132
- return comment.text.trim();
133
- }
134
- if (comment.shortText) {
135
- return comment.shortText.trim();
136
- }
137
- return '';
138
- };
139
- AbstractConverter.prototype.extractTagsTextFromComment = function (comment) {
140
- if (comment && comment.tags) {
141
- return comment.tags.map(function (tag) {
142
- if (tag.tag === 'see') {
143
- return "\n\nSee " + tag.text.trim();
150
+ return this.combineDisplayParts(comment.summary);
151
+ }
152
+ extractTagsTextFromComment(comment) {
153
+ if (comment && comment.blockTags) {
154
+ return comment.blockTags.map(tag => {
155
+ if (tag.tag === '@see') {
156
+ const content = this.combineDisplayParts(tag.content);
157
+ if (content === '') {
158
+ return '';
159
+ }
160
+ if (content.startsWith("- ")) {
161
+ // becuase combineDisplayParts will trim content, if there exist typedoc added hyphen, the prefix space will be removed, so added back
162
+ const preBlankContent = ` ${content}`;
163
+ // typedoc will merge all @see tag, so just replace the " - " to See to make it looks like old typedoc
164
+ return `\n\n${preBlankContent.replace(/ - /g, "See ")}`;
165
+ }
166
+ return `\n\nSee ${content}`;
167
+ }
168
+ else if (tag.tag === '@example') {
169
+ return `\n\n**Example**\n\n${this.combineDisplayParts(tag.content)}\n\n`;
144
170
  }
145
- else if (tag.tag === 'example') {
146
- return "\n\n**Example**\n\n" + tag.text.trim() + "\n\n";
171
+ else if (tag.tag === '@member') {
172
+ const content = this.combineDisplayParts(tag.content);
173
+ const match = content.match(/\[.*?\] (.*)/);
174
+ let result = '';
175
+ if (match) {
176
+ result += `${match[1].trim()}`;
177
+ }
178
+ return result;
147
179
  }
148
180
  else {
149
181
  return '';
@@ -151,10 +183,9 @@ var AbstractConverter = /** @class */ (function () {
151
183
  }).join('');
152
184
  }
153
185
  return '';
154
- };
155
- AbstractConverter.prototype.extractType = function (type) {
156
- var _this = this;
157
- var result = [];
186
+ }
187
+ extractType(type) {
188
+ let result = [];
158
189
  if (type === undefined) {
159
190
  return result;
160
191
  }
@@ -167,8 +198,8 @@ var AbstractConverter = /** @class */ (function () {
167
198
  else {
168
199
  result.push({
169
200
  unionType: {
170
- types: type.types.map(function (t) {
171
- var childType = _this.extractType(t)[0];
201
+ types: type.types.map(t => {
202
+ let childType = this.extractType(t)[0];
172
203
  childType.parentType = type.type;
173
204
  return childType;
174
205
  })
@@ -177,43 +208,89 @@ var AbstractConverter = /** @class */ (function () {
177
208
  }
178
209
  }
179
210
  else if (type.type === 'array') {
180
- var newType = this.extractType(type.elementType);
211
+ let newType = this.extractType(type.elementType);
181
212
  result.push({
182
- arrayType: __assign(__assign({}, newType[0]), { parentType: type.type })
213
+ arrayType: {
214
+ ...newType[0],
215
+ parentType: type.type
216
+ }
217
+ });
218
+ }
219
+ else if (type.type === 'conditional') {
220
+ result.push({
221
+ conditionalType: {
222
+ checkType: this.extractType(type.checkType)[0],
223
+ extendsType: this.extractType(type.extendsType)[0],
224
+ trueType: this.extractType(type.trueType)[0],
225
+ falseType: this.extractType(type.falseType)[0]
226
+ }
183
227
  });
184
228
  }
185
229
  else if (type.type === 'intersection' && type.types.length) {
186
230
  result.push({
187
231
  intersectionType: {
188
- types: type.types.map(function (t) {
189
- var childType = _this.extractType(t)[0];
232
+ types: type.types.map(t => {
233
+ let childType = this.extractType(t)[0];
190
234
  childType.parentType = type.type;
191
235
  return childType;
192
236
  })
193
237
  }
194
238
  });
195
239
  }
240
+ else if (type.type === 'typeOperator') {
241
+ result.push({
242
+ operatorType: {
243
+ operator: type.operator,
244
+ target: this.extractType(type.target)[0]
245
+ }
246
+ });
247
+ }
248
+ else if (type.type === 'query') {
249
+ /**
250
+ * Represents a type that is constructed by querying the type of a reflection.
251
+ * ```ts
252
+ * const x = 1
253
+ * type Z = typeof x // query on reflection for x
254
+ * ```
255
+ */
256
+ result.push({
257
+ queryType: this.extractType(type.queryType)[0]
258
+ });
259
+ }
260
+ else if (type.type === 'indexedAccess') {
261
+ /**
262
+ * Represents an indexed access type.
263
+ * ```ts
264
+ * type X = A[keyof A]
265
+ * ```
266
+ */
267
+ result.push({
268
+ indexedAccessType: {
269
+ indexType: this.extractType(type.indexType)[0],
270
+ objectType: this.extractType(type.objectType)[0],
271
+ }
272
+ });
273
+ }
196
274
  else if (type.type === 'reflection' && type.declaration) {
197
275
  if (type.declaration.indexSignature) {
198
- var signatures = type.declaration.indexSignature;
199
- signatures.forEach(function (signature) {
200
- result.push({
201
- reflectedType: {
202
- key: {
203
- typeName: signature.parameters[0].type.name,
204
- typeId: signature.parameters[0].type.id
205
- },
206
- value: {
207
- typeName: signature.type.name,
208
- typeId: signature.type.id
209
- }
276
+ const signature = type.declaration.indexSignature;
277
+ result.push({
278
+ reflectedType: {
279
+ name: signature.parameters[0].name ?? 'key',
280
+ key: {
281
+ typeName: signature.parameters[0].type.name,
282
+ typeId: signature.parameters[0].type.id
283
+ },
284
+ value: {
285
+ typeName: signature.type.name,
286
+ typeId: signature.type.id
210
287
  }
211
- });
288
+ }
212
289
  });
213
290
  }
214
291
  else if (type.declaration.signatures && type.declaration.signatures.length) {
215
292
  result.push({
216
- typeName: this.generateCallFunction('', this.fillParameters(type.declaration.signatures[0].parameters)) + " => " + idResolver_1.typeToString(this.extractType(type.declaration.signatures[0].type)[0])
293
+ typeName: `${this.generateCallFunction('', this.fillParameters(type.declaration.signatures[0].parameters))} => ${(0, idResolver_1.typeToString)(this.extractType(type.declaration.signatures[0].type)[0])}`
217
294
  });
218
295
  }
219
296
  else if (type.declaration.children && type.declaration.children.length) {
@@ -223,7 +300,7 @@ var AbstractConverter = /** @class */ (function () {
223
300
  }
224
301
  else {
225
302
  result.push({
226
- typeName: 'Object'
303
+ typeName: '{}'
227
304
  });
228
305
  }
229
306
  }
@@ -234,26 +311,30 @@ var AbstractConverter = /** @class */ (function () {
234
311
  typeName: type.name,
235
312
  typeId: type.id
236
313
  },
237
- inner: type.typeArguments.map(function (t) { return _this.extractType(t)[0]; })
314
+ inner: type.typeArguments.map(t => this.extractType(t)[0])
238
315
  }
239
316
  });
240
317
  }
241
318
  else if (type.type === 'tuple' && type.elements && type.elements.length) {
242
319
  result.push({
243
320
  tupleType: {
244
- types: type.elements.map(function (t) { return _this.extractType(t)[0]; })
321
+ types: type.elements.map(t => this.extractType(t)[0])
245
322
  }
246
323
  });
247
324
  }
248
- else if (type.name) {
325
+ else if (type.type === 'literal') {
326
+ let typeName = `${type.value}`;
327
+ if (typeof type.value === "string") {
328
+ typeName = `"${type.value}"`;
329
+ }
249
330
  result.push({
250
- typeName: type.name,
251
- typeId: type.id
331
+ typeName: typeName
252
332
  });
253
333
  }
254
- else if (type.value) {
334
+ else if (type.name) {
255
335
  result.push({
256
- typeName: "\"" + type.value + "\""
336
+ typeName: type.name,
337
+ typeId: type.id
257
338
  });
258
339
  }
259
340
  else {
@@ -262,48 +343,93 @@ var AbstractConverter = /** @class */ (function () {
262
343
  });
263
344
  }
264
345
  return result;
265
- };
266
- AbstractConverter.prototype.hasCommonPrefix = function (types) {
346
+ }
347
+ hasCommonPrefix(types) {
267
348
  if (types && types.length > 1 && types[0].name) {
268
349
  if (types[0].name.indexOf('.') < 0) {
269
350
  return false;
270
351
  }
271
- var prefix_1 = types[0].name.split('.')[0];
272
- return types.find(function (t) { return !t.name || t.name.split('.')[0] !== prefix_1; }) === undefined;
352
+ const prefix = types[0].name.split('.')[0];
353
+ return types.find(t => !t.name || t.name.split('.')[0] !== prefix) === undefined;
273
354
  }
274
355
  return false;
275
- };
276
- AbstractConverter.prototype.generateCallFunction = function (prefix, parameters, typeParameters) {
356
+ }
357
+ generateCallFunction(prefix, parameters, typeParameters) {
277
358
  if (parameters) {
278
- return "" + prefix + this.getGenericType(typeParameters) + "(" + parameters.map(function (p) { return "" + p.id + (p.optional ? '?' : '') + ": " + (idResolver_1.typeToString(p.type[0])); }).join(', ') + ")";
359
+ return `${prefix}${this.getGenericType(typeParameters)}(${parameters.map(p => `${p.id}${p.optional ? '?' : ''}: ${((0, idResolver_1.typeToString)(p.type[0]))}`).join(', ')})`;
279
360
  }
280
361
  return '';
281
- };
282
- AbstractConverter.prototype.fillParameters = function (parameters) {
283
- var _this = this;
362
+ }
363
+ fillParameters(parameters) {
284
364
  if (parameters) {
285
- return parameters.map(function (p) {
286
- var description = '';
365
+ return parameters.map(p => {
366
+ let description = '';
287
367
  if (p.comment) {
288
- description = (p.comment.shortText && p.comment.shortText !== '') ? p.comment.shortText : p.comment.text;
368
+ description = this.combineDisplayParts(p.comment.summary);
289
369
  }
290
370
  return {
291
371
  id: p.name,
292
- type: _this.extractType(p.type),
293
- description: linkConvertHelper_1.convertLinkToGfm(description),
372
+ type: this.extractType(p.type),
373
+ description: description,
294
374
  optional: Boolean(p.flags && p.flags.isOptional)
295
375
  };
296
376
  });
297
377
  }
298
378
  return [];
299
- };
300
- AbstractConverter.prototype.extractReturnComment = function (comment) {
301
- if (comment == null || comment.returns == null) {
379
+ }
380
+ extractReturnComment(comment) {
381
+ const returnComment = this.extractTextFromComment('@returns', comment);
382
+ if (!returnComment) {
302
383
  return '';
303
384
  }
304
- return linkConvertHelper_1.convertLinkToGfm(comment.returns.trim());
305
- };
306
- AbstractConverter.prototype.extractInformationFromSignature = function (method, node, signatureIndex) {
385
+ return returnComment;
386
+ }
387
+ combineDisplayParts(parts) {
388
+ let result = "";
389
+ for (const item of parts || []) {
390
+ switch (item.kind) {
391
+ case "text":
392
+ case "code":
393
+ result += item.text;
394
+ break;
395
+ case "inline-tag":
396
+ switch (item.tag) {
397
+ case "@label":
398
+ case "@inheritdoc": // Shouldn't happen
399
+ // ignore these content
400
+ break;
401
+ case "@linkcode":
402
+ result += `{${item.tag}`;
403
+ if (item.target && typeof item.target !== 'string') {
404
+ result += ` ${item.target}`;
405
+ }
406
+ else {
407
+ result += ` ${item.text}`;
408
+ }
409
+ result += '}';
410
+ break;
411
+ case "@link":
412
+ case "@linkplain":
413
+ result += `{${item.tag}`;
414
+ if (item.target && item.target !== item.text) {
415
+ result += ` ${item.target}`;
416
+ }
417
+ result += ` ${item.text}}`;
418
+ break;
419
+ default:
420
+ // Hmm... probably want to be able to render these somehow, so custom inline tags can be given
421
+ // special rendering rules. Future capability. For now, just render their text.
422
+ result += `{${item.tag} ${item.text}}`;
423
+ break;
424
+ }
425
+ break;
426
+ default:
427
+ (0, error_1.assertNever)(item);
428
+ }
429
+ }
430
+ return result.trim().replace(/\r/g, "");
431
+ }
432
+ extractInformationFromSignature(method, node, signatureIndex) {
307
433
  if (node.signatures[signatureIndex].comment) {
308
434
  method.summary = this.findDescriptionInComment(node.signatures[signatureIndex].comment);
309
435
  }
@@ -320,16 +446,16 @@ var AbstractConverter = /** @class */ (function () {
320
446
  if (node.signatures[signatureIndex].comment && node.signatures[signatureIndex].comment.tags) {
321
447
  exceptions = node.signatures[signatureIndex].comment.tags.filter(tag => tag.tag === 'throws');
322
448
  }
323
-
449
+
324
450
  if (exceptions && exceptions.length) {
325
451
  method.exceptions = exceptions.map(e => extractException(e));
326
452
  }
327
453
  */
328
454
  if (node.kindString === 'Method' || node.kindString === 'Function') {
329
- var typeParameter = node.signatures[signatureIndex].typeParameter;
330
- var functionBody = this.generateCallFunction(method.name, method.syntax.parameters, typeParameter);
331
- var returnBody = (method.syntax.return && method.syntax.return.type.length > 0) ? ": " + idResolver_1.typeToString(method.syntax.return.type[0]) : '';
332
- method.syntax.content = (node.flags && node.flags.isStatic ? 'static ' : '') + "function " + functionBody + returnBody;
455
+ const typeParameter = node.signatures[signatureIndex].typeParameter;
456
+ const functionBody = this.generateCallFunction(method.name, method.syntax.parameters, typeParameter);
457
+ const returnBody = (method.syntax.return && method.syntax.return.type.length > 0) ? `: ${(0, idResolver_1.typeToString)(method.syntax.return.type[0])}` : '';
458
+ method.syntax.content = `${node.flags && node.flags.isStatic ? 'static ' : ''}function ${functionBody}${returnBody}`;
333
459
  method.type = node.kindString.toLowerCase();
334
460
  if (node.inheritedFrom) {
335
461
  method.inherited = true;
@@ -338,69 +464,68 @@ var AbstractConverter = /** @class */ (function () {
338
464
  }
339
465
  else {
340
466
  method.name = method.uid.split('.').reverse()[1];
341
- var functionBody = this.generateCallFunction(method.name, method.syntax.parameters);
342
- method.syntax.content = "new " + functionBody;
467
+ const functionBody = this.generateCallFunction(method.name, method.syntax.parameters);
468
+ method.syntax.content = `new ${functionBody}`;
343
469
  method.type = 'constructor';
344
470
  }
345
- };
346
- AbstractConverter.prototype.composeMethodNameFromSignature = function (method, typeParameters) {
347
- var parameterType = method.syntax.parameters.map(function (p) {
348
- return idResolver_1.typeToString(p.type[0]);
471
+ }
472
+ composeMethodNameFromSignature(method, typeParameters) {
473
+ const parameterType = method.syntax.parameters.map(p => {
474
+ return (0, idResolver_1.typeToString)(p.type[0]);
349
475
  }).join(', ');
350
476
  return method.name + this.getGenericType(typeParameters) + '(' + parameterType + ')';
351
- };
352
- AbstractConverter.prototype.parseTypeArgumentsForTypeAlias = function (node) {
353
- var typeParameter;
354
- if (node.typeParameter) {
355
- typeParameter = node.typeParameter;
477
+ }
478
+ parseTypeArgumentsForTypeAlias(node) {
479
+ let typeParameter;
480
+ if (node.typeParameters) {
481
+ typeParameter = node.typeParameters;
356
482
  }
357
483
  else if (node.typeArguments) {
358
484
  typeParameter = node.typeArguments;
359
485
  }
360
486
  return this.getGenericType(typeParameter);
361
- };
362
- AbstractConverter.prototype.parseTypeDeclarationForTypeAlias = function (typeInfo) {
363
- return idResolver_1.typeToString(this.extractType(typeInfo)[0]);
364
- };
365
- AbstractConverter.prototype.parseFunctionType = function (typeInfo) {
366
- var typeResult = this.extractType(typeInfo);
367
- var content = '';
487
+ }
488
+ parseTypeDeclarationForTypeAlias(typeInfo) {
489
+ return (0, idResolver_1.typeToString)(this.extractType(typeInfo)[0]);
490
+ }
491
+ parseFunctionType(typeInfo) {
492
+ let typeResult = this.extractType(typeInfo);
493
+ let content = '';
368
494
  if (typeResult.length) {
369
495
  content = typeResult[0].typeName;
370
496
  }
371
497
  return content;
372
- };
373
- AbstractConverter.prototype.parseUserDefinedType = function (typeInfo) {
374
- var _this = this;
498
+ }
499
+ parseUserDefinedType(typeInfo) {
375
500
  if (!typeInfo.declaration || !typeInfo.declaration.children) {
376
501
  return '';
377
502
  }
378
- var content = typeInfo.declaration.children.map(function (child) {
379
- var type = '';
380
- var isOptional = child.flags && child.flags.isOptional ? '?' : '';
381
- if (child.kindString === 'Variable') {
382
- type = "" + child.name + isOptional + ": " + idResolver_1.typeToString(_this.extractType(child.type)[0]);
503
+ let content = typeInfo.declaration.children.map(child => {
504
+ let type = '';
505
+ let isOptional = child.flags && child.flags.isOptional;
506
+ let typePostFix = isOptional ? '?' : '';
507
+ if (child.kindString === 'Variable' || child.kindString === 'Property') {
508
+ type = `${child.name}${typePostFix}: ` + (0, idResolver_1.typeToString)(this.extractType(child.type)[0]);
383
509
  }
384
- else if (child.kindString === 'Function') {
385
- type = _this.generateCallFunction("" + child.name + isOptional, _this.fillParameters(child.signatures[0].parameters)) + " => " + idResolver_1.typeToString(_this.extractType(child.signatures[0].type)[0]);
510
+ else if (child.kindString === 'Function' || child.kindString === 'Method') {
511
+ type = `${this.generateCallFunction(`${child.name}${typePostFix}`, this.fillParameters(child.signatures[0].parameters))} => ${(0, idResolver_1.typeToString)(this.extractType(child.signatures[0].type)[0])}`;
386
512
  }
387
513
  return type;
388
514
  }).join(', ');
389
515
  content = '{ ' + content + ' }';
390
516
  return content;
391
- };
392
- AbstractConverter.prototype.generateInheritanceDescription = function (inheritedFrom) {
517
+ }
518
+ generateInheritanceDescription(inheritedFrom) {
393
519
  if (inheritedFrom) {
394
520
  if (inheritedFrom.id) {
395
- return "<b>Inherited From</b> [" + inheritedFrom.name + "](xref:" + inheritedFrom.name + ")";
521
+ return `<b>Inherited From</b> [${inheritedFrom.name}](xref:${inheritedFrom.name})`;
396
522
  }
397
523
  else {
398
- return "<b>Inherited From</b> " + inheritedFrom.name;
524
+ return `<b>Inherited From</b> ${inheritedFrom.name}`;
399
525
  }
400
526
  }
401
527
  return null;
402
- };
403
- return AbstractConverter;
404
- }());
528
+ }
529
+ }
405
530
  exports.AbstractConverter = AbstractConverter;
406
531
  //# sourceMappingURL=base.js.map