@microsoft/api-extractor-model 7.14.0 → 7.15.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 (57) hide show
  1. package/CHANGELOG.json +12 -0
  2. package/CHANGELOG.md +8 -1
  3. package/dist/rollup.d.ts +2 -2
  4. package/dist/tsdoc-metadata.json +1 -1
  5. package/lib/index.js +3 -1
  6. package/lib/index.js.map +1 -1
  7. package/lib/items/ApiItem.d.ts +1 -1
  8. package/lib/items/ApiItem.d.ts.map +1 -1
  9. package/lib/items/ApiItem.js +43 -14
  10. package/lib/items/ApiItem.js.map +1 -1
  11. package/lib/mixins/Excerpt.d.ts +1 -1
  12. package/lib/mixins/Excerpt.d.ts.map +1 -1
  13. package/lib/mixins/Excerpt.js +13 -1
  14. package/lib/mixins/Excerpt.js.map +1 -1
  15. package/lib/model/ApiCallSignature.js +3 -2
  16. package/lib/model/ApiCallSignature.js.map +1 -1
  17. package/lib/model/ApiClass.js +3 -2
  18. package/lib/model/ApiClass.js.map +1 -1
  19. package/lib/model/ApiConstructSignature.js +3 -2
  20. package/lib/model/ApiConstructSignature.js.map +1 -1
  21. package/lib/model/ApiConstructor.js +3 -2
  22. package/lib/model/ApiConstructor.js.map +1 -1
  23. package/lib/model/ApiEntryPoint.js +1 -1
  24. package/lib/model/ApiEntryPoint.js.map +1 -1
  25. package/lib/model/ApiEnum.js +4 -3
  26. package/lib/model/ApiEnum.js.map +1 -1
  27. package/lib/model/ApiEnumMember.js +2 -1
  28. package/lib/model/ApiEnumMember.js.map +1 -1
  29. package/lib/model/ApiFunction.js +3 -2
  30. package/lib/model/ApiFunction.js.map +1 -1
  31. package/lib/model/ApiIndexSignature.js +3 -2
  32. package/lib/model/ApiIndexSignature.js.map +1 -1
  33. package/lib/model/ApiInterface.js +3 -2
  34. package/lib/model/ApiInterface.js.map +1 -1
  35. package/lib/model/ApiMethod.js +4 -3
  36. package/lib/model/ApiMethod.js.map +1 -1
  37. package/lib/model/ApiMethodSignature.js +3 -2
  38. package/lib/model/ApiMethodSignature.js.map +1 -1
  39. package/lib/model/ApiModel.js +2 -2
  40. package/lib/model/ApiModel.js.map +1 -1
  41. package/lib/model/ApiNamespace.js +3 -2
  42. package/lib/model/ApiNamespace.js.map +1 -1
  43. package/lib/model/ApiPackage.js +2 -2
  44. package/lib/model/ApiPackage.js.map +1 -1
  45. package/lib/model/ApiProperty.js +4 -3
  46. package/lib/model/ApiProperty.js.map +1 -1
  47. package/lib/model/ApiPropertySignature.js +3 -2
  48. package/lib/model/ApiPropertySignature.js.map +1 -1
  49. package/lib/model/ApiTypeAlias.js +3 -2
  50. package/lib/model/ApiTypeAlias.js.map +1 -1
  51. package/lib/model/ApiVariable.js +3 -2
  52. package/lib/model/ApiVariable.js.map +1 -1
  53. package/lib/model/Deserializer.js +20 -19
  54. package/lib/model/Deserializer.js.map +1 -1
  55. package/lib/model/ModelReferenceResolver.js +8 -7
  56. package/lib/model/ModelReferenceResolver.js.map +1 -1
  57. package/package.json +4 -5
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.ApiProperty = void 0;
6
6
  const DeclarationReference_1 = require("@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference");
7
+ const ApiItem_1 = require("../items/ApiItem");
7
8
  const ApiStaticMixin_1 = require("../mixins/ApiStaticMixin");
8
9
  const ApiPropertyItem_1 = require("../items/ApiPropertyItem");
9
10
  /**
@@ -46,15 +47,15 @@ class ApiProperty extends (0, ApiStaticMixin_1.ApiStaticMixin)(ApiPropertyItem_1
46
47
  }
47
48
  static getContainerKey(name, isStatic) {
48
49
  if (isStatic) {
49
- return `${name}|${"Property" /* Property */}|static`;
50
+ return `${name}|${ApiItem_1.ApiItemKind.Property}|static`;
50
51
  }
51
52
  else {
52
- return `${name}|${"Property" /* Property */}|instance`;
53
+ return `${name}|${ApiItem_1.ApiItemKind.Property}|instance`;
53
54
  }
54
55
  }
55
56
  /** @override */
56
57
  get kind() {
57
- return "Property" /* Property */;
58
+ return ApiItem_1.ApiItemKind.Property;
58
59
  }
59
60
  /** @override */
60
61
  get containerKey() {
@@ -1 +1 @@
1
- {"version":3,"file":"ApiProperty.js","sourceRoot":"","sources":["../../src/model/ApiProperty.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,kGAKiE;AAEjE,6DAAkF;AAClF,8DAAoF;AAQpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAa,WAAY,SAAQ,IAAA,+BAAc,EAAC,iCAAe,CAAC;IAC9D,YAAmB,OAA4B;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,IAAY,EAAE,QAAiB;QAC3D,IAAI,QAAQ,EAAE;YACZ,OAAO,GAAG,IAAI,IAAI,yBAAoB,SAAS,CAAC;SACjD;aAAM;YACL,OAAO,GAAG,IAAI,IAAI,yBAAoB,WAAW,CAAC;SACnD;IACH,CAAC;IAED,gBAAgB;IAChB,IAAW,IAAI;QACb,iCAA4B;IAC9B,CAAC;IAED,gBAAgB;IAChB,IAAW,YAAY;QACrB,OAAO,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/D,CAAC;IAED,sBAAsB;IACf,uBAAuB;QAC5B,MAAM,aAAa,GAAc,2CAAoB,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,2CAAoB,CAAC,KAAK,EAAE,CAAC;aACjF,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,mBAAoB,CAAC,kBAAmB,EAAE,aAAa,CAAC;aACzF,WAAW,uBAAgB,CAAC;IACjC,CAAC;CACF;AA9BD,kCA8BC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport {\r\n DeclarationReference,\r\n Meaning,\r\n Navigation,\r\n Component\r\n} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\r\nimport { ApiItemKind } from '../items/ApiItem';\r\nimport { ApiStaticMixin, IApiStaticMixinOptions } from '../mixins/ApiStaticMixin';\r\nimport { ApiPropertyItem, IApiPropertyItemOptions } from '../items/ApiPropertyItem';\r\n\r\n/**\r\n * Constructor options for {@link ApiProperty}.\r\n * @public\r\n */\r\nexport interface IApiPropertyOptions extends IApiPropertyItemOptions, IApiStaticMixinOptions {}\r\n\r\n/**\r\n * Represents a TypeScript property declaration that belongs to an `ApiClass`.\r\n *\r\n * @remarks\r\n *\r\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\r\n * API declarations.\r\n *\r\n * `ApiProperty` represents a TypeScript declaration such as the `width` and `height` members in this example:\r\n *\r\n * ```ts\r\n * export class Widget {\r\n * public width: number = 100;\r\n *\r\n * public get height(): number {\r\n * if (this.isSquashed()) {\r\n * return 0;\r\n * } else {\r\n * return this.clientArea.height;\r\n * }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * Note that member variables are also considered to be properties.\r\n *\r\n * If the property has both a getter function and setter function, they will be represented by a single `ApiProperty`\r\n * and must have a single documentation comment.\r\n *\r\n * Compare with {@link ApiPropertySignature}, which represents a property belonging to an interface.\r\n * For example, a class property can be `static` but an interface property cannot.\r\n *\r\n * @public\r\n */\r\nexport class ApiProperty extends ApiStaticMixin(ApiPropertyItem) {\r\n public constructor(options: IApiPropertyOptions) {\r\n super(options);\r\n }\r\n\r\n public static getContainerKey(name: string, isStatic: boolean): string {\r\n if (isStatic) {\r\n return `${name}|${ApiItemKind.Property}|static`;\r\n } else {\r\n return `${name}|${ApiItemKind.Property}|instance`;\r\n }\r\n }\r\n\r\n /** @override */\r\n public get kind(): ApiItemKind {\r\n return ApiItemKind.Property;\r\n }\r\n\r\n /** @override */\r\n public get containerKey(): string {\r\n return ApiProperty.getContainerKey(this.name, this.isStatic);\r\n }\r\n\r\n /** @beta @override */\r\n public buildCanonicalReference(): DeclarationReference {\r\n const nameComponent: Component = DeclarationReference.parseComponent(this.name);\r\n return (this.parent ? this.parent.canonicalReference : DeclarationReference.empty())\r\n .addNavigationStep(this.isStatic ? Navigation.Exports : Navigation.Members, nameComponent)\r\n .withMeaning(Meaning.Member);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ApiProperty.js","sourceRoot":"","sources":["../../src/model/ApiProperty.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,kGAKiE;AACjE,8CAA+C;AAC/C,6DAAkF;AAClF,8DAAoF;AAQpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAa,WAAY,SAAQ,IAAA,+BAAc,EAAC,iCAAe,CAAC;IAC9D,YAAmB,OAA4B;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,IAAY,EAAE,QAAiB;QAC3D,IAAI,QAAQ,EAAE;YACZ,OAAO,GAAG,IAAI,IAAI,qBAAW,CAAC,QAAQ,SAAS,CAAC;SACjD;aAAM;YACL,OAAO,GAAG,IAAI,IAAI,qBAAW,CAAC,QAAQ,WAAW,CAAC;SACnD;IACH,CAAC;IAED,gBAAgB;IAChB,IAAW,IAAI;QACb,OAAO,qBAAW,CAAC,QAAQ,CAAC;IAC9B,CAAC;IAED,gBAAgB;IAChB,IAAW,YAAY;QACrB,OAAO,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/D,CAAC;IAED,sBAAsB;IACf,uBAAuB;QAC5B,MAAM,aAAa,GAAc,2CAAoB,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,2CAAoB,CAAC,KAAK,EAAE,CAAC;aACjF,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,mBAAoB,CAAC,kBAAmB,EAAE,aAAa,CAAC;aACzF,WAAW,uBAAgB,CAAC;IACjC,CAAC;CACF;AA9BD,kCA8BC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport {\r\n DeclarationReference,\r\n Meaning,\r\n Navigation,\r\n Component\r\n} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\r\nimport { ApiItemKind } from '../items/ApiItem';\r\nimport { ApiStaticMixin, IApiStaticMixinOptions } from '../mixins/ApiStaticMixin';\r\nimport { ApiPropertyItem, IApiPropertyItemOptions } from '../items/ApiPropertyItem';\r\n\r\n/**\r\n * Constructor options for {@link ApiProperty}.\r\n * @public\r\n */\r\nexport interface IApiPropertyOptions extends IApiPropertyItemOptions, IApiStaticMixinOptions {}\r\n\r\n/**\r\n * Represents a TypeScript property declaration that belongs to an `ApiClass`.\r\n *\r\n * @remarks\r\n *\r\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\r\n * API declarations.\r\n *\r\n * `ApiProperty` represents a TypeScript declaration such as the `width` and `height` members in this example:\r\n *\r\n * ```ts\r\n * export class Widget {\r\n * public width: number = 100;\r\n *\r\n * public get height(): number {\r\n * if (this.isSquashed()) {\r\n * return 0;\r\n * } else {\r\n * return this.clientArea.height;\r\n * }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * Note that member variables are also considered to be properties.\r\n *\r\n * If the property has both a getter function and setter function, they will be represented by a single `ApiProperty`\r\n * and must have a single documentation comment.\r\n *\r\n * Compare with {@link ApiPropertySignature}, which represents a property belonging to an interface.\r\n * For example, a class property can be `static` but an interface property cannot.\r\n *\r\n * @public\r\n */\r\nexport class ApiProperty extends ApiStaticMixin(ApiPropertyItem) {\r\n public constructor(options: IApiPropertyOptions) {\r\n super(options);\r\n }\r\n\r\n public static getContainerKey(name: string, isStatic: boolean): string {\r\n if (isStatic) {\r\n return `${name}|${ApiItemKind.Property}|static`;\r\n } else {\r\n return `${name}|${ApiItemKind.Property}|instance`;\r\n }\r\n }\r\n\r\n /** @override */\r\n public get kind(): ApiItemKind {\r\n return ApiItemKind.Property;\r\n }\r\n\r\n /** @override */\r\n public get containerKey(): string {\r\n return ApiProperty.getContainerKey(this.name, this.isStatic);\r\n }\r\n\r\n /** @beta @override */\r\n public buildCanonicalReference(): DeclarationReference {\r\n const nameComponent: Component = DeclarationReference.parseComponent(this.name);\r\n return (this.parent ? this.parent.canonicalReference : DeclarationReference.empty())\r\n .addNavigationStep(this.isStatic ? Navigation.Exports : Navigation.Members, nameComponent)\r\n .withMeaning(Meaning.Member);\r\n }\r\n}\r\n"]}
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.ApiPropertySignature = void 0;
6
6
  const DeclarationReference_1 = require("@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference");
7
+ const ApiItem_1 = require("../items/ApiItem");
7
8
  const ApiPropertyItem_1 = require("../items/ApiPropertyItem");
8
9
  /**
9
10
  * Represents a TypeScript property declaration that belongs to an `ApiInterface`.
@@ -32,11 +33,11 @@ class ApiPropertySignature extends ApiPropertyItem_1.ApiPropertyItem {
32
33
  super(options);
33
34
  }
34
35
  static getContainerKey(name) {
35
- return `${name}|${"PropertySignature" /* PropertySignature */}`;
36
+ return `${name}|${ApiItem_1.ApiItemKind.PropertySignature}`;
36
37
  }
37
38
  /** @override */
38
39
  get kind() {
39
- return "PropertySignature" /* PropertySignature */;
40
+ return ApiItem_1.ApiItemKind.PropertySignature;
40
41
  }
41
42
  /** @override */
42
43
  get containerKey() {
@@ -1 +1 @@
1
- {"version":3,"file":"ApiPropertySignature.js","sourceRoot":"","sources":["../../src/model/ApiPropertySignature.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,kGAKiE;AAEjE,8DAAoF;AAQpF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,oBAAqB,SAAQ,iCAAe;IACvD,YAAmB,OAAqC;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,IAAY;QACxC,OAAO,GAAG,IAAI,IAAI,2CAA6B,EAAE,CAAC;IACpD,CAAC;IAED,gBAAgB;IAChB,IAAW,IAAI;QACb,mDAAqC;IACvC,CAAC;IAED,gBAAgB;IAChB,IAAW,YAAY;QACrB,OAAO,oBAAoB,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,sBAAsB;IACf,uBAAuB;QAC5B,MAAM,aAAa,GAAc,2CAAoB,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,2CAAoB,CAAC,KAAK,EAAE,CAAC;aACjF,iBAAiB,oBAAqB,aAAa,CAAC;aACpD,WAAW,uBAAgB,CAAC;IACjC,CAAC;CACF;AA1BD,oDA0BC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport {\r\n DeclarationReference,\r\n Meaning,\r\n Navigation,\r\n Component\r\n} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\r\nimport { ApiItemKind } from '../items/ApiItem';\r\nimport { ApiPropertyItem, IApiPropertyItemOptions } from '../items/ApiPropertyItem';\r\n\r\n/**\r\n * Constructor options for {@link ApiPropertySignature}.\r\n * @public\r\n */\r\nexport interface IApiPropertySignatureOptions extends IApiPropertyItemOptions {}\r\n\r\n/**\r\n * Represents a TypeScript property declaration that belongs to an `ApiInterface`.\r\n *\r\n * @remarks\r\n *\r\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\r\n * API declarations.\r\n *\r\n * `ApiPropertySignature` represents a TypeScript declaration such as the `width` and `height` members in this example:\r\n *\r\n * ```ts\r\n * export interface IWidget {\r\n * readonly width: number;\r\n * height: number;\r\n * }\r\n * ```\r\n *\r\n * Compare with {@link ApiProperty}, which represents a property belonging to a class.\r\n * For example, a class property can be `static` but an interface property cannot.\r\n *\r\n * @public\r\n */\r\nexport class ApiPropertySignature extends ApiPropertyItem {\r\n public constructor(options: IApiPropertySignatureOptions) {\r\n super(options);\r\n }\r\n\r\n public static getContainerKey(name: string): string {\r\n return `${name}|${ApiItemKind.PropertySignature}`;\r\n }\r\n\r\n /** @override */\r\n public get kind(): ApiItemKind {\r\n return ApiItemKind.PropertySignature;\r\n }\r\n\r\n /** @override */\r\n public get containerKey(): string {\r\n return ApiPropertySignature.getContainerKey(this.name);\r\n }\r\n\r\n /** @beta @override */\r\n public buildCanonicalReference(): DeclarationReference {\r\n const nameComponent: Component = DeclarationReference.parseComponent(this.name);\r\n return (this.parent ? this.parent.canonicalReference : DeclarationReference.empty())\r\n .addNavigationStep(Navigation.Members, nameComponent)\r\n .withMeaning(Meaning.Member);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ApiPropertySignature.js","sourceRoot":"","sources":["../../src/model/ApiPropertySignature.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,kGAKiE;AACjE,8CAA+C;AAC/C,8DAAoF;AAQpF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,oBAAqB,SAAQ,iCAAe;IACvD,YAAmB,OAAqC;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,IAAY;QACxC,OAAO,GAAG,IAAI,IAAI,qBAAW,CAAC,iBAAiB,EAAE,CAAC;IACpD,CAAC;IAED,gBAAgB;IAChB,IAAW,IAAI;QACb,OAAO,qBAAW,CAAC,iBAAiB,CAAC;IACvC,CAAC;IAED,gBAAgB;IAChB,IAAW,YAAY;QACrB,OAAO,oBAAoB,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,sBAAsB;IACf,uBAAuB;QAC5B,MAAM,aAAa,GAAc,2CAAoB,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,2CAAoB,CAAC,KAAK,EAAE,CAAC;aACjF,iBAAiB,oBAAqB,aAAa,CAAC;aACpD,WAAW,uBAAgB,CAAC;IACjC,CAAC;CACF;AA1BD,oDA0BC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport {\r\n DeclarationReference,\r\n Meaning,\r\n Navigation,\r\n Component\r\n} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\r\nimport { ApiItemKind } from '../items/ApiItem';\r\nimport { ApiPropertyItem, IApiPropertyItemOptions } from '../items/ApiPropertyItem';\r\n\r\n/**\r\n * Constructor options for {@link ApiPropertySignature}.\r\n * @public\r\n */\r\nexport interface IApiPropertySignatureOptions extends IApiPropertyItemOptions {}\r\n\r\n/**\r\n * Represents a TypeScript property declaration that belongs to an `ApiInterface`.\r\n *\r\n * @remarks\r\n *\r\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\r\n * API declarations.\r\n *\r\n * `ApiPropertySignature` represents a TypeScript declaration such as the `width` and `height` members in this example:\r\n *\r\n * ```ts\r\n * export interface IWidget {\r\n * readonly width: number;\r\n * height: number;\r\n * }\r\n * ```\r\n *\r\n * Compare with {@link ApiProperty}, which represents a property belonging to a class.\r\n * For example, a class property can be `static` but an interface property cannot.\r\n *\r\n * @public\r\n */\r\nexport class ApiPropertySignature extends ApiPropertyItem {\r\n public constructor(options: IApiPropertySignatureOptions) {\r\n super(options);\r\n }\r\n\r\n public static getContainerKey(name: string): string {\r\n return `${name}|${ApiItemKind.PropertySignature}`;\r\n }\r\n\r\n /** @override */\r\n public get kind(): ApiItemKind {\r\n return ApiItemKind.PropertySignature;\r\n }\r\n\r\n /** @override */\r\n public get containerKey(): string {\r\n return ApiPropertySignature.getContainerKey(this.name);\r\n }\r\n\r\n /** @beta @override */\r\n public buildCanonicalReference(): DeclarationReference {\r\n const nameComponent: Component = DeclarationReference.parseComponent(this.name);\r\n return (this.parent ? this.parent.canonicalReference : DeclarationReference.empty())\r\n .addNavigationStep(Navigation.Members, nameComponent)\r\n .withMeaning(Meaning.Member);\r\n }\r\n}\r\n"]}
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.ApiTypeAlias = void 0;
6
6
  const DeclarationReference_1 = require("@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference");
7
+ const ApiItem_1 = require("../items/ApiItem");
7
8
  const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
8
9
  const ApiReleaseTagMixin_1 = require("../mixins/ApiReleaseTagMixin");
9
10
  const ApiNameMixin_1 = require("../mixins/ApiNameMixin");
@@ -45,11 +46,11 @@ class ApiTypeAlias extends (0, ApiTypeParameterListMixin_1.ApiTypeParameterListM
45
46
  options.typeTokenRange = jsonObject.typeTokenRange;
46
47
  }
47
48
  static getContainerKey(name) {
48
- return `${name}|${"TypeAlias" /* TypeAlias */}`;
49
+ return `${name}|${ApiItem_1.ApiItemKind.TypeAlias}`;
49
50
  }
50
51
  /** @override */
51
52
  get kind() {
52
- return "TypeAlias" /* TypeAlias */;
53
+ return ApiItem_1.ApiItemKind.TypeAlias;
53
54
  }
54
55
  /** @override */
55
56
  get containerKey() {
@@ -1 +1 @@
1
- {"version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AAI,CAAC,IAAI,CAAC,CAAC;QAChF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,2CAAoB,CAAC,KAAK,EAAE,CAAC;aACjF,iBAAiB,oBAAqB,aAAa,CAAC;aACpD,WAAW,wBAAmB,CAAC;IACpC,CAAC;CACF;AA7DD,oCA6DC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport {\r\n DeclarationReference,\r\n Meaning,\r\n Navigation,\r\n Component\r\n} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\r\nimport { Excerpt, IExcerptTokenRange } from '../mixins/Excerpt';\r\nimport { ApiItemKind } from '../items/ApiItem';\r\nimport { ApiDeclaredItem, IApiDeclaredItemOptions, IApiDeclaredItemJson } from '../items/ApiDeclaredItem';\r\nimport { ApiReleaseTagMixin, IApiReleaseTagMixinOptions } from '../mixins/ApiReleaseTagMixin';\r\nimport { IApiNameMixinOptions, ApiNameMixin } from '../mixins/ApiNameMixin';\r\nimport {\r\n ApiTypeParameterListMixin,\r\n IApiTypeParameterListMixinOptions,\r\n IApiTypeParameterListMixinJson\r\n} from '../mixins/ApiTypeParameterListMixin';\r\nimport { DeserializerContext } from './DeserializerContext';\r\n\r\n/**\r\n * Constructor options for {@link ApiTypeAlias}.\r\n * @public\r\n */\r\nexport interface IApiTypeAliasOptions\r\n extends IApiNameMixinOptions,\r\n IApiReleaseTagMixinOptions,\r\n IApiDeclaredItemOptions,\r\n IApiTypeParameterListMixinOptions {\r\n typeTokenRange: IExcerptTokenRange;\r\n}\r\n\r\nexport interface IApiTypeAliasJson extends IApiDeclaredItemJson, IApiTypeParameterListMixinJson {\r\n typeTokenRange: IExcerptTokenRange;\r\n}\r\n\r\n/**\r\n * Represents a TypeScript type alias declaration.\r\n *\r\n * @remarks\r\n *\r\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\r\n * API declarations.\r\n *\r\n * `ApiTypeAlias` represents a definition such as one of these examples:\r\n *\r\n * ```ts\r\n * // A union type:\r\n * export type Shape = Square | Triangle | Circle;\r\n *\r\n * // A generic type alias:\r\n * export type BoxedValue<T> = { value: T };\r\n *\r\n * export type BoxedArray<T> = { array: T[] };\r\n *\r\n * // A conditional type alias:\r\n * export type Boxed<T> = T extends any[] ? BoxedArray<T[number]> : BoxedValue<T>;\r\n *\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport class ApiTypeAlias extends ApiTypeParameterListMixin(\r\n ApiNameMixin(ApiReleaseTagMixin(ApiDeclaredItem))\r\n) {\r\n /**\r\n * An {@link Excerpt} that describes the type of the alias.\r\n *\r\n * @remarks\r\n * In the example below, the `typeExcerpt` would correspond to the subexpression\r\n * `T extends any[] ? BoxedArray<T[number]> : BoxedValue<T>;`:\r\n *\r\n * ```ts\r\n * export type Boxed<T> = T extends any[] ? BoxedArray<T[number]> : BoxedValue<T>;\r\n * ```\r\n */\r\n public readonly typeExcerpt: Excerpt;\r\n\r\n public constructor(options: IApiTypeAliasOptions) {\r\n super(options);\r\n\r\n this.typeExcerpt = this.buildExcerpt(options.typeTokenRange);\r\n }\r\n\r\n /** @override */\r\n public static onDeserializeInto(\r\n options: Partial<IApiTypeAliasOptions>,\r\n context: DeserializerContext,\r\n jsonObject: IApiTypeAliasJson\r\n ): void {\r\n super.onDeserializeInto(options, context, jsonObject);\r\n\r\n options.typeTokenRange = jsonObject.typeTokenRange;\r\n }\r\n\r\n public static getContainerKey(name: string): string {\r\n return `${name}|${ApiItemKind.TypeAlias}`;\r\n }\r\n\r\n /** @override */\r\n public get kind(): ApiItemKind {\r\n return ApiItemKind.TypeAlias;\r\n }\r\n\r\n /** @override */\r\n public get containerKey(): string {\r\n return ApiTypeAlias.getContainerKey(this.name);\r\n }\r\n\r\n /** @override */\r\n public serializeInto(jsonObject: Partial<IApiTypeAliasJson>): void {\r\n super.serializeInto(jsonObject);\r\n\r\n jsonObject.typeTokenRange = this.typeExcerpt.tokenRange;\r\n }\r\n\r\n /** @beta @override */\r\n public buildCanonicalReference(): DeclarationReference {\r\n const nameComponent: Component = DeclarationReference.parseComponent(this.name);\r\n return (this.parent ? this.parent.canonicalReference : DeclarationReference.empty())\r\n .addNavigationStep(Navigation.Exports, nameComponent)\r\n .withMeaning(Meaning.TypeAlias);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ApiTypeAlias.js","sourceRoot":"","sources":["../../src/model/ApiTypeAlias.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,kGAKiE;AAEjE,8CAA+C;AAC/C,8DAA0G;AAC1G,qEAA8F;AAC9F,yDAA4E;AAC5E,mFAI6C;AAmB7C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,YAAa,SAAQ,IAAA,qDAAyB,EACzD,IAAA,2BAAY,EAAC,IAAA,uCAAkB,EAAC,iCAAe,CAAC,CAAC,CAClD;IAcC,YAAmB,OAA6B;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/D,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,iBAAiB,CAC7B,OAAsC,EACtC,OAA4B,EAC5B,UAA6B;QAE7B,KAAK,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAEtD,OAAO,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;IACrD,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,IAAY;QACxC,OAAO,GAAG,IAAI,IAAI,qBAAW,CAAC,SAAS,EAAE,CAAC;IAC5C,CAAC;IAED,gBAAgB;IAChB,IAAW,IAAI;QACb,OAAO,qBAAW,CAAC,SAAS,CAAC;IAC/B,CAAC;IAED,gBAAgB;IAChB,IAAW,YAAY;QACrB,OAAO,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,gBAAgB;IACT,aAAa,CAAC,UAAsC;QACzD,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAEhC,UAAU,CAAC,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;IAC1D,CAAC;IAED,sBAAsB;IACf,uBAAuB;QAC5B,MAAM,aAAa,GAAc,2CAAoB,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,2CAAoB,CAAC,KAAK,EAAE,CAAC;aACjF,iBAAiB,oBAAqB,aAAa,CAAC;aACpD,WAAW,wBAAmB,CAAC;IACpC,CAAC;CACF;AA7DD,oCA6DC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport {\r\n DeclarationReference,\r\n Meaning,\r\n Navigation,\r\n Component\r\n} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\r\nimport { Excerpt, IExcerptTokenRange } from '../mixins/Excerpt';\r\nimport { ApiItemKind } from '../items/ApiItem';\r\nimport { ApiDeclaredItem, IApiDeclaredItemOptions, IApiDeclaredItemJson } from '../items/ApiDeclaredItem';\r\nimport { ApiReleaseTagMixin, IApiReleaseTagMixinOptions } from '../mixins/ApiReleaseTagMixin';\r\nimport { IApiNameMixinOptions, ApiNameMixin } from '../mixins/ApiNameMixin';\r\nimport {\r\n ApiTypeParameterListMixin,\r\n IApiTypeParameterListMixinOptions,\r\n IApiTypeParameterListMixinJson\r\n} from '../mixins/ApiTypeParameterListMixin';\r\nimport { DeserializerContext } from './DeserializerContext';\r\n\r\n/**\r\n * Constructor options for {@link ApiTypeAlias}.\r\n * @public\r\n */\r\nexport interface IApiTypeAliasOptions\r\n extends IApiNameMixinOptions,\r\n IApiReleaseTagMixinOptions,\r\n IApiDeclaredItemOptions,\r\n IApiTypeParameterListMixinOptions {\r\n typeTokenRange: IExcerptTokenRange;\r\n}\r\n\r\nexport interface IApiTypeAliasJson extends IApiDeclaredItemJson, IApiTypeParameterListMixinJson {\r\n typeTokenRange: IExcerptTokenRange;\r\n}\r\n\r\n/**\r\n * Represents a TypeScript type alias declaration.\r\n *\r\n * @remarks\r\n *\r\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\r\n * API declarations.\r\n *\r\n * `ApiTypeAlias` represents a definition such as one of these examples:\r\n *\r\n * ```ts\r\n * // A union type:\r\n * export type Shape = Square | Triangle | Circle;\r\n *\r\n * // A generic type alias:\r\n * export type BoxedValue<T> = { value: T };\r\n *\r\n * export type BoxedArray<T> = { array: T[] };\r\n *\r\n * // A conditional type alias:\r\n * export type Boxed<T> = T extends any[] ? BoxedArray<T[number]> : BoxedValue<T>;\r\n *\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport class ApiTypeAlias extends ApiTypeParameterListMixin(\r\n ApiNameMixin(ApiReleaseTagMixin(ApiDeclaredItem))\r\n) {\r\n /**\r\n * An {@link Excerpt} that describes the type of the alias.\r\n *\r\n * @remarks\r\n * In the example below, the `typeExcerpt` would correspond to the subexpression\r\n * `T extends any[] ? BoxedArray<T[number]> : BoxedValue<T>;`:\r\n *\r\n * ```ts\r\n * export type Boxed<T> = T extends any[] ? BoxedArray<T[number]> : BoxedValue<T>;\r\n * ```\r\n */\r\n public readonly typeExcerpt: Excerpt;\r\n\r\n public constructor(options: IApiTypeAliasOptions) {\r\n super(options);\r\n\r\n this.typeExcerpt = this.buildExcerpt(options.typeTokenRange);\r\n }\r\n\r\n /** @override */\r\n public static onDeserializeInto(\r\n options: Partial<IApiTypeAliasOptions>,\r\n context: DeserializerContext,\r\n jsonObject: IApiTypeAliasJson\r\n ): void {\r\n super.onDeserializeInto(options, context, jsonObject);\r\n\r\n options.typeTokenRange = jsonObject.typeTokenRange;\r\n }\r\n\r\n public static getContainerKey(name: string): string {\r\n return `${name}|${ApiItemKind.TypeAlias}`;\r\n }\r\n\r\n /** @override */\r\n public get kind(): ApiItemKind {\r\n return ApiItemKind.TypeAlias;\r\n }\r\n\r\n /** @override */\r\n public get containerKey(): string {\r\n return ApiTypeAlias.getContainerKey(this.name);\r\n }\r\n\r\n /** @override */\r\n public serializeInto(jsonObject: Partial<IApiTypeAliasJson>): void {\r\n super.serializeInto(jsonObject);\r\n\r\n jsonObject.typeTokenRange = this.typeExcerpt.tokenRange;\r\n }\r\n\r\n /** @beta @override */\r\n public buildCanonicalReference(): DeclarationReference {\r\n const nameComponent: Component = DeclarationReference.parseComponent(this.name);\r\n return (this.parent ? this.parent.canonicalReference : DeclarationReference.empty())\r\n .addNavigationStep(Navigation.Exports, nameComponent)\r\n .withMeaning(Meaning.TypeAlias);\r\n }\r\n}\r\n"]}
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.ApiVariable = void 0;
6
6
  const DeclarationReference_1 = require("@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference");
7
+ const ApiItem_1 = require("../items/ApiItem");
7
8
  const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
8
9
  const ApiReleaseTagMixin_1 = require("../mixins/ApiReleaseTagMixin");
9
10
  const ApiNameMixin_1 = require("../mixins/ApiNameMixin");
@@ -38,11 +39,11 @@ class ApiVariable extends (0, ApiNameMixin_1.ApiNameMixin)((0, ApiReleaseTagMixi
38
39
  options.variableTypeTokenRange = jsonObject.variableTypeTokenRange;
39
40
  }
40
41
  static getContainerKey(name) {
41
- return `${name}|${"Variable" /* Variable */}`;
42
+ return `${name}|${ApiItem_1.ApiItemKind.Variable}`;
42
43
  }
43
44
  /** @override */
44
45
  get kind() {
45
- return "Variable" /* Variable */;
46
+ return ApiItem_1.ApiItemKind.Variable;
46
47
  }
47
48
  /** @override */
48
49
  get containerKey() {
@@ -1 +1 @@
1
- {"version":3,"file":"ApiVariable.js","sourceRoot":"","sources":["../../src/model/ApiVariable.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,kGAKiE;AAEjE,8DAA0G;AAC1G,qEAA8F;AAC9F,yDAA4E;AAmB5E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,WAAY,SAAQ,IAAA,2BAAY,EAAC,IAAA,uCAAkB,EAAC,iCAAe,CAAC,CAAC;IAMhF,YAAmB,OAA4B;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC/E,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,iBAAiB,CAC7B,OAAqC,EACrC,OAA4B,EAC5B,UAA4B;QAE5B,KAAK,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAEtD,OAAO,CAAC,sBAAsB,GAAG,UAAU,CAAC,sBAAsB,CAAC;IACrE,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,IAAY;QACxC,OAAO,GAAG,IAAI,IAAI,yBAAoB,EAAE,CAAC;IAC3C,CAAC;IAED,gBAAgB;IAChB,IAAW,IAAI;QACb,iCAA4B;IAC9B,CAAC;IAED,gBAAgB;IAChB,IAAW,YAAY;QACrB,OAAO,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,gBAAgB;IACT,aAAa,CAAC,UAAqC;QACxD,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAEhC,UAAU,CAAC,sBAAsB,GAAG,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC;IAC1E,CAAC;IAED,sBAAsB;IACf,uBAAuB;QAC5B,MAAM,aAAa,GAAc,2CAAoB,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,2CAAoB,CAAC,KAAK,EAAE,CAAC;aACjF,iBAAiB,oBAAqB,aAAa,CAAC;aACpD,WAAW,sBAAkB,CAAC;IACnC,CAAC;CACF;AAnDD,kCAmDC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport {\r\n DeclarationReference,\r\n Meaning,\r\n Navigation,\r\n Component\r\n} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\r\nimport { ApiItemKind } from '../items/ApiItem';\r\nimport { ApiDeclaredItem, IApiDeclaredItemOptions, IApiDeclaredItemJson } from '../items/ApiDeclaredItem';\r\nimport { ApiReleaseTagMixin, IApiReleaseTagMixinOptions } from '../mixins/ApiReleaseTagMixin';\r\nimport { IApiNameMixinOptions, ApiNameMixin } from '../mixins/ApiNameMixin';\r\nimport { IExcerptTokenRange, Excerpt } from '../mixins/Excerpt';\r\nimport { DeserializerContext } from './DeserializerContext';\r\n\r\n/**\r\n * Constructor options for {@link ApiVariable}.\r\n * @public\r\n */\r\nexport interface IApiVariableOptions\r\n extends IApiNameMixinOptions,\r\n IApiReleaseTagMixinOptions,\r\n IApiDeclaredItemOptions {\r\n variableTypeTokenRange: IExcerptTokenRange;\r\n}\r\n\r\nexport interface IApiVariableJson extends IApiDeclaredItemJson {\r\n variableTypeTokenRange: IExcerptTokenRange;\r\n}\r\n\r\n/**\r\n * Represents a TypeScript variable declaration.\r\n *\r\n * @remarks\r\n *\r\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\r\n * API declarations.\r\n *\r\n * `ApiVariable` represents an exported `const` or `let` object such as these examples:\r\n *\r\n * ```ts\r\n * // A variable declaration\r\n * export let verboseLogging: boolean;\r\n *\r\n * // A constant variable declaration with an initializer\r\n * export const canvas: IWidget = createCanvas();\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport class ApiVariable extends ApiNameMixin(ApiReleaseTagMixin(ApiDeclaredItem)) {\r\n /**\r\n * An {@link Excerpt} that describes the type of the variable.\r\n */\r\n public readonly variableTypeExcerpt: Excerpt;\r\n\r\n public constructor(options: IApiVariableOptions) {\r\n super(options);\r\n\r\n this.variableTypeExcerpt = this.buildExcerpt(options.variableTypeTokenRange);\r\n }\r\n\r\n /** @override */\r\n public static onDeserializeInto(\r\n options: Partial<IApiVariableOptions>,\r\n context: DeserializerContext,\r\n jsonObject: IApiVariableJson\r\n ): void {\r\n super.onDeserializeInto(options, context, jsonObject);\r\n\r\n options.variableTypeTokenRange = jsonObject.variableTypeTokenRange;\r\n }\r\n\r\n public static getContainerKey(name: string): string {\r\n return `${name}|${ApiItemKind.Variable}`;\r\n }\r\n\r\n /** @override */\r\n public get kind(): ApiItemKind {\r\n return ApiItemKind.Variable;\r\n }\r\n\r\n /** @override */\r\n public get containerKey(): string {\r\n return ApiVariable.getContainerKey(this.name);\r\n }\r\n\r\n /** @override */\r\n public serializeInto(jsonObject: Partial<IApiVariableJson>): void {\r\n super.serializeInto(jsonObject);\r\n\r\n jsonObject.variableTypeTokenRange = this.variableTypeExcerpt.tokenRange;\r\n }\r\n\r\n /** @beta @override */\r\n public buildCanonicalReference(): DeclarationReference {\r\n const nameComponent: Component = DeclarationReference.parseComponent(this.name);\r\n return (this.parent ? this.parent.canonicalReference : DeclarationReference.empty())\r\n .addNavigationStep(Navigation.Exports, nameComponent)\r\n .withMeaning(Meaning.Variable);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ApiVariable.js","sourceRoot":"","sources":["../../src/model/ApiVariable.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,kGAKiE;AACjE,8CAA+C;AAC/C,8DAA0G;AAC1G,qEAA8F;AAC9F,yDAA4E;AAmB5E;;;;;;;;;;;;;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Aa,CAAC;aACpD,WAAW,sBAAkB,CAAC;IACnC,CAAC;CACF;AAnDD,kCAmDC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport {\r\n DeclarationReference,\r\n Meaning,\r\n Navigation,\r\n Component\r\n} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\r\nimport { ApiItemKind } from '../items/ApiItem';\r\nimport { ApiDeclaredItem, IApiDeclaredItemOptions, IApiDeclaredItemJson } from '../items/ApiDeclaredItem';\r\nimport { ApiReleaseTagMixin, IApiReleaseTagMixinOptions } from '../mixins/ApiReleaseTagMixin';\r\nimport { IApiNameMixinOptions, ApiNameMixin } from '../mixins/ApiNameMixin';\r\nimport { IExcerptTokenRange, Excerpt } from '../mixins/Excerpt';\r\nimport { DeserializerContext } from './DeserializerContext';\r\n\r\n/**\r\n * Constructor options for {@link ApiVariable}.\r\n * @public\r\n */\r\nexport interface IApiVariableOptions\r\n extends IApiNameMixinOptions,\r\n IApiReleaseTagMixinOptions,\r\n IApiDeclaredItemOptions {\r\n variableTypeTokenRange: IExcerptTokenRange;\r\n}\r\n\r\nexport interface IApiVariableJson extends IApiDeclaredItemJson {\r\n variableTypeTokenRange: IExcerptTokenRange;\r\n}\r\n\r\n/**\r\n * Represents a TypeScript variable declaration.\r\n *\r\n * @remarks\r\n *\r\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\r\n * API declarations.\r\n *\r\n * `ApiVariable` represents an exported `const` or `let` object such as these examples:\r\n *\r\n * ```ts\r\n * // A variable declaration\r\n * export let verboseLogging: boolean;\r\n *\r\n * // A constant variable declaration with an initializer\r\n * export const canvas: IWidget = createCanvas();\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport class ApiVariable extends ApiNameMixin(ApiReleaseTagMixin(ApiDeclaredItem)) {\r\n /**\r\n * An {@link Excerpt} that describes the type of the variable.\r\n */\r\n public readonly variableTypeExcerpt: Excerpt;\r\n\r\n public constructor(options: IApiVariableOptions) {\r\n super(options);\r\n\r\n this.variableTypeExcerpt = this.buildExcerpt(options.variableTypeTokenRange);\r\n }\r\n\r\n /** @override */\r\n public static onDeserializeInto(\r\n options: Partial<IApiVariableOptions>,\r\n context: DeserializerContext,\r\n jsonObject: IApiVariableJson\r\n ): void {\r\n super.onDeserializeInto(options, context, jsonObject);\r\n\r\n options.variableTypeTokenRange = jsonObject.variableTypeTokenRange;\r\n }\r\n\r\n public static getContainerKey(name: string): string {\r\n return `${name}|${ApiItemKind.Variable}`;\r\n }\r\n\r\n /** @override */\r\n public get kind(): ApiItemKind {\r\n return ApiItemKind.Variable;\r\n }\r\n\r\n /** @override */\r\n public get containerKey(): string {\r\n return ApiVariable.getContainerKey(this.name);\r\n }\r\n\r\n /** @override */\r\n public serializeInto(jsonObject: Partial<IApiVariableJson>): void {\r\n super.serializeInto(jsonObject);\r\n\r\n jsonObject.variableTypeTokenRange = this.variableTypeExcerpt.tokenRange;\r\n }\r\n\r\n /** @beta @override */\r\n public buildCanonicalReference(): DeclarationReference {\r\n const nameComponent: Component = DeclarationReference.parseComponent(this.name);\r\n return (this.parent ? this.parent.canonicalReference : DeclarationReference.empty())\r\n .addNavigationStep(Navigation.Exports, nameComponent)\r\n .withMeaning(Meaning.Variable);\r\n }\r\n}\r\n"]}
@@ -3,6 +3,7 @@
3
3
  // See LICENSE in the project root for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.Deserializer = void 0;
6
+ const ApiItem_1 = require("../items/ApiItem");
6
7
  const ApiClass_1 = require("./ApiClass");
7
8
  const ApiEntryPoint_1 = require("./ApiEntryPoint");
8
9
  const ApiMethod_1 = require("./ApiMethod");
@@ -26,60 +27,60 @@ class Deserializer {
26
27
  static deserialize(context, jsonObject) {
27
28
  const options = {};
28
29
  switch (jsonObject.kind) {
29
- case "Class" /* Class */:
30
+ case ApiItem_1.ApiItemKind.Class:
30
31
  ApiClass_1.ApiClass.onDeserializeInto(options, context, jsonObject);
31
32
  return new ApiClass_1.ApiClass(options);
32
- case "CallSignature" /* CallSignature */:
33
+ case ApiItem_1.ApiItemKind.CallSignature:
33
34
  ApiCallSignature_1.ApiCallSignature.onDeserializeInto(options, context, jsonObject);
34
35
  return new ApiCallSignature_1.ApiCallSignature(options);
35
- case "Constructor" /* Constructor */:
36
+ case ApiItem_1.ApiItemKind.Constructor:
36
37
  ApiConstructor_1.ApiConstructor.onDeserializeInto(options, context, jsonObject);
37
38
  return new ApiConstructor_1.ApiConstructor(options);
38
- case "ConstructSignature" /* ConstructSignature */:
39
+ case ApiItem_1.ApiItemKind.ConstructSignature:
39
40
  ApiConstructSignature_1.ApiConstructSignature.onDeserializeInto(options, context, jsonObject);
40
41
  return new ApiConstructSignature_1.ApiConstructSignature(options);
41
- case "EntryPoint" /* EntryPoint */:
42
+ case ApiItem_1.ApiItemKind.EntryPoint:
42
43
  ApiEntryPoint_1.ApiEntryPoint.onDeserializeInto(options, context, jsonObject);
43
44
  return new ApiEntryPoint_1.ApiEntryPoint(options);
44
- case "Enum" /* Enum */:
45
+ case ApiItem_1.ApiItemKind.Enum:
45
46
  ApiEnum_1.ApiEnum.onDeserializeInto(options, context, jsonObject);
46
47
  return new ApiEnum_1.ApiEnum(options);
47
- case "EnumMember" /* EnumMember */:
48
+ case ApiItem_1.ApiItemKind.EnumMember:
48
49
  ApiEnumMember_1.ApiEnumMember.onDeserializeInto(options, context, jsonObject);
49
50
  return new ApiEnumMember_1.ApiEnumMember(options);
50
- case "Function" /* Function */:
51
+ case ApiItem_1.ApiItemKind.Function:
51
52
  ApiFunction_1.ApiFunction.onDeserializeInto(options, context, jsonObject);
52
53
  return new ApiFunction_1.ApiFunction(options);
53
- case "IndexSignature" /* IndexSignature */:
54
+ case ApiItem_1.ApiItemKind.IndexSignature:
54
55
  ApiIndexSignature_1.ApiIndexSignature.onDeserializeInto(options, context, jsonObject);
55
56
  return new ApiIndexSignature_1.ApiIndexSignature(options);
56
- case "Interface" /* Interface */:
57
+ case ApiItem_1.ApiItemKind.Interface:
57
58
  ApiInterface_1.ApiInterface.onDeserializeInto(options, context, jsonObject);
58
59
  return new ApiInterface_1.ApiInterface(options);
59
- case "Method" /* Method */:
60
+ case ApiItem_1.ApiItemKind.Method:
60
61
  ApiMethod_1.ApiMethod.onDeserializeInto(options, context, jsonObject);
61
62
  return new ApiMethod_1.ApiMethod(options);
62
- case "MethodSignature" /* MethodSignature */:
63
+ case ApiItem_1.ApiItemKind.MethodSignature:
63
64
  ApiMethodSignature_1.ApiMethodSignature.onDeserializeInto(options, context, jsonObject);
64
65
  return new ApiMethodSignature_1.ApiMethodSignature(options);
65
- case "Model" /* Model */:
66
+ case ApiItem_1.ApiItemKind.Model:
66
67
  return new ApiModel_1.ApiModel();
67
- case "Namespace" /* Namespace */:
68
+ case ApiItem_1.ApiItemKind.Namespace:
68
69
  ApiNamespace_1.ApiNamespace.onDeserializeInto(options, context, jsonObject);
69
70
  return new ApiNamespace_1.ApiNamespace(options);
70
- case "Package" /* Package */:
71
+ case ApiItem_1.ApiItemKind.Package:
71
72
  ApiPackage_1.ApiPackage.onDeserializeInto(options, context, jsonObject);
72
73
  return new ApiPackage_1.ApiPackage(options);
73
- case "Property" /* Property */:
74
+ case ApiItem_1.ApiItemKind.Property:
74
75
  ApiProperty_1.ApiProperty.onDeserializeInto(options, context, jsonObject);
75
76
  return new ApiProperty_1.ApiProperty(options);
76
- case "PropertySignature" /* PropertySignature */:
77
+ case ApiItem_1.ApiItemKind.PropertySignature:
77
78
  ApiPropertySignature_1.ApiPropertySignature.onDeserializeInto(options, context, jsonObject);
78
79
  return new ApiPropertySignature_1.ApiPropertySignature(options);
79
- case "TypeAlias" /* TypeAlias */:
80
+ case ApiItem_1.ApiItemKind.TypeAlias:
80
81
  ApiTypeAlias_1.ApiTypeAlias.onDeserializeInto(options, context, jsonObject);
81
82
  return new ApiTypeAlias_1.ApiTypeAlias(options);
82
- case "Variable" /* Variable */:
83
+ case ApiItem_1.ApiItemKind.Variable:
83
84
  ApiVariable_1.ApiVariable.onDeserializeInto(options, context, jsonObject);
84
85
  return new ApiVariable_1.ApiVariable(options);
85
86
  default:
@@ -1 +1 @@
1
- {"version":3,"file":"Deserializer.js","sourceRoot":"","sources":["../../src/model/Deserializer.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,yCAAuE;AACvE,mDAAuE;AACvE,2CAA2D;AAC3D,yCAAsC;AACtC,iDAAoE;AACpE,6CAA8D;AAC9D,iDAAuF;AACvF,iEAA4F;AAC5F,6DAAsF;AACtF,+CAAiE;AACjE,mDAA2F;AAC3F,uCAAqD;AAErD,qDAA0E;AAC1E,mEAA+F;AAC/F,+CAAiE;AACjE,yDAAgF;AAChF,2DAAmF;AACnF,iDAAuF;AACvF,+CAAmF;AAInF,MAAa,YAAY;IAChB,MAAM,CAAC,WAAW,CAAC,OAA4B,EAAE,UAAwB;QAC9E,MAAM,OAAO,GAA6B,EAAE,CAAC;QAE7C,QAAQ,UAAU,CAAC,IAAI,EAAE;YACvB;gBACE,mBAAQ,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAA2B,CAAC,CAAC;gBAC1E,OAAO,IAAI,mBAAQ,CAAC,OAA2B,CAAC,CAAC;YACnD;gBACE,mCAAgB,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAkC,CAAC,CAAC;gBACzF,OAAO,IAAI,mCAAgB,CAAC,OAAmC,CAAC,CAAC;YACnE;gBACE,+BAAc,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAkC,CAAC,CAAC;gBACvF,OAAO,IAAI,+BAAc,CAAC,OAAiC,CAAC,CAAC;YAC/D;gBACE,6CAAqB,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAkC,CAAC,CAAC;gBAC9F,OAAO,IAAI,6CAAqB,CAAC,OAAwC,CAAC,CAAC;YAC7E;gBACE,6BAAa,CAAC,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AAC,CAAC;YAC3D;gBACE,uBAAU,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;gBAC3D,OAAO,IAAI,uBAAU,CAAC,OAA6B,CAAC,CAAC;YACvD;gBACE,yBAAW,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAkC,CAAC,CAAC;gBACpF,OAAO,IAAI,yBAAW,CAAC,OAA8B,CAAC,CAAC;YACzD;gBACE,2CAAoB,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAkC,CAAC,CAAC;gBAC7F,OAAO,IAAI,2CAAoB,CAAC,OAAuC,CAAC,CAAC;YAC3E;gBACE,2BAAY,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAA+B,CAAC,CAAC;gBAClF,OAAO,IAAI,2BAAY,CAAC,OAA+B,CAAC,CAAC;YAC3D;gBACE,yBAAW,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAA8B,CAAC,CAAC;gBAChF,OAAO,IAAI,yBAAW,CAAC,OAA8B,CAAC,CAAC;YACzD;gBACE,MAAM,IAAI,KAAK,CAAC,mDAAmD,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACzG;IACH,CAAC;CACF;AAjED,oCAiEC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { IApiItemJson, IApiItemOptions, ApiItem, ApiItemKind } from '../items/ApiItem';\r\nimport { ApiClass, IApiClassOptions, IApiClassJson } from './ApiClass';\r\nimport { ApiEntryPoint, IApiEntryPointOptions } from './ApiEntryPoint';\r\nimport { ApiMethod, IApiMethodOptions } from './ApiMethod';\r\nimport { ApiModel } from './ApiModel';\r\nimport { ApiNamespace, IApiNamespaceOptions } from './ApiNamespace';\r\nimport { ApiPackage, IApiPackageOptions } from './ApiPackage';\r\nimport { ApiInterface, IApiInterfaceOptions, IApiInterfaceJson } from './ApiInterface';\r\nimport { ApiPropertySignature, IApiPropertySignatureOptions } from './ApiPropertySignature';\r\nimport { ApiMethodSignature, IApiMethodSignatureOptions } from './ApiMethodSignature';\r\nimport { ApiProperty, IApiPropertyOptions } from './ApiProperty';\r\nimport { ApiEnumMember, IApiEnumMemberOptions, IApiEnumMemberJson } from './ApiEnumMember';\r\nimport { ApiEnum, IApiEnumOptions } from './ApiEnum';\r\nimport { IApiPropertyItemJson } from '../items/ApiPropertyItem';\r\nimport { ApiConstructor, IApiConstructorOptions } from './ApiConstructor';\r\nimport { ApiConstructSignature, IApiConstructSignatureOptions } from './ApiConstructSignature';\r\nimport { ApiFunction, IApiFunctionOptions } from './ApiFunction';\r\nimport { ApiCallSignature, IApiCallSignatureOptions } from './ApiCallSignature';\r\nimport { ApiIndexSignature, IApiIndexSignatureOptions } from './ApiIndexSignature';\r\nimport { ApiTypeAlias, IApiTypeAliasOptions, IApiTypeAliasJson } from './ApiTypeAlias';\r\nimport { ApiVariable, IApiVariableOptions, IApiVariableJson } from './ApiVariable';\r\nimport { IApiDeclaredItemJson } from '../items/ApiDeclaredItem';\r\nimport { DeserializerContext } from './DeserializerContext';\r\n\r\nexport class Deserializer {\r\n public static deserialize(context: DeserializerContext, jsonObject: IApiItemJson): ApiItem {\r\n const options: Partial<IApiItemOptions> = {};\r\n\r\n switch (jsonObject.kind) {\r\n case ApiItemKind.Class:\r\n ApiClass.onDeserializeInto(options, context, jsonObject as IApiClassJson);\r\n return new ApiClass(options as IApiClassOptions);\r\n case ApiItemKind.CallSignature:\r\n ApiCallSignature.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiCallSignature(options as IApiCallSignatureOptions);\r\n case ApiItemKind.Constructor:\r\n ApiConstructor.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiConstructor(options as IApiConstructorOptions);\r\n case ApiItemKind.ConstructSignature:\r\n ApiConstructSignature.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiConstructSignature(options as IApiConstructSignatureOptions);\r\n case ApiItemKind.EntryPoint:\r\n ApiEntryPoint.onDeserializeInto(options, context, jsonObject);\r\n return new ApiEntryPoint(options as IApiEntryPointOptions);\r\n case ApiItemKind.Enum:\r\n ApiEnum.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiEnum(options as IApiEnumOptions);\r\n case ApiItemKind.EnumMember:\r\n ApiEnumMember.onDeserializeInto(options, context, jsonObject as IApiEnumMemberJson);\r\n return new ApiEnumMember(options as IApiEnumMemberOptions);\r\n case ApiItemKind.Function:\r\n ApiFunction.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiFunction(options as IApiFunctionOptions);\r\n case ApiItemKind.IndexSignature:\r\n ApiIndexSignature.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiIndexSignature(options as IApiIndexSignatureOptions);\r\n case ApiItemKind.Interface:\r\n ApiInterface.onDeserializeInto(options, context, jsonObject as IApiInterfaceJson);\r\n return new ApiInterface(options as IApiInterfaceOptions);\r\n case ApiItemKind.Method:\r\n ApiMethod.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiMethod(options as IApiMethodOptions);\r\n case ApiItemKind.MethodSignature:\r\n ApiMethodSignature.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiMethodSignature(options as IApiMethodSignatureOptions);\r\n case ApiItemKind.Model:\r\n return new ApiModel();\r\n case ApiItemKind.Namespace:\r\n ApiNamespace.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiNamespace(options as IApiNamespaceOptions);\r\n case ApiItemKind.Package:\r\n ApiPackage.onDeserializeInto(options, context, jsonObject);\r\n return new ApiPackage(options as IApiPackageOptions);\r\n case ApiItemKind.Property:\r\n ApiProperty.onDeserializeInto(options, context, jsonObject as IApiPropertyItemJson);\r\n return new ApiProperty(options as IApiPropertyOptions);\r\n case ApiItemKind.PropertySignature:\r\n ApiPropertySignature.onDeserializeInto(options, context, jsonObject as IApiPropertyItemJson);\r\n return new ApiPropertySignature(options as IApiPropertySignatureOptions);\r\n case ApiItemKind.TypeAlias:\r\n ApiTypeAlias.onDeserializeInto(options, context, jsonObject as IApiTypeAliasJson);\r\n return new ApiTypeAlias(options as IApiTypeAliasOptions);\r\n case ApiItemKind.Variable:\r\n ApiVariable.onDeserializeInto(options, context, jsonObject as IApiVariableJson);\r\n return new ApiVariable(options as IApiVariableOptions);\r\n default:\r\n throw new Error(`Failed to deserialize unsupported API item type ${JSON.stringify(jsonObject.kind)}`);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Deserializer.js","sourceRoot":"","sources":["../../src/model/Deserializer.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,8CAAuF;AACvF,yCAAuE;AACvE,mDAAuE;AACvE,2CAA2D;AAC3D,yCAAsC;AACtC,iDAAoE;AACpE,6CAA8D;AAC9D,iDAAuF;AACvF,iEAA4F;AAC5F,6DAAsF;AACtF,+CAAiE;AACjE,mDAA2F;AAC3F,uCAAqD;AAErD,qDAA0E;AAC1E,mEAA+F;AAC/F,+CAAiE;AACjE,yDAAgF;AAChF,2DAAmF;AACnF,iDAAuF;AACvF,+CAAmF;AAInF,MAAa,YAAY;IAChB,MAAM,CAAC,WAAW,CAAC,OAA4B,EAAE,UAAwB;QAC9E,MAAM,OAAO,GAA6B,EAAE,CAAC;QAE7C,QAAQ,UAAU,CAAC,IAAI,EAAE;YACvB,KAAK,qBAAW,CAAC,KAAK;gBACpB,mBAAQ,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAA2B,CAAC,CAAC;gBAC1E,OAAO,IAAI,mBAAQ,CAAC,OAA2B,CAAC,CAAC;YACnD,KAAK,qBAAW,CAAC,aAAa;gBAC5B,mCAAgB,CAAC,iBAAiB,C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C3E,KAAK,qBAAW,CAAC,SAAS;gBACxB,2BAAY,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAA+B,CAAC,CAAC;gBAClF,OAAO,IAAI,2BAAY,CAAC,OAA+B,CAAC,CAAC;YAC3D,KAAK,qBAAW,CAAC,QAAQ;gBACvB,yBAAW,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAA8B,CAAC,CAAC;gBAChF,OAAO,IAAI,yBAAW,CAAC,OAA8B,CAAC,CAAC;YACzD;gBACE,MAAM,IAAI,KAAK,CAAC,mDAAmD,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACzG;IACH,CAAC;CACF;AAjED,oCAiEC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { IApiItemJson, IApiItemOptions, ApiItem, ApiItemKind } from '../items/ApiItem';\r\nimport { ApiClass, IApiClassOptions, IApiClassJson } from './ApiClass';\r\nimport { ApiEntryPoint, IApiEntryPointOptions } from './ApiEntryPoint';\r\nimport { ApiMethod, IApiMethodOptions } from './ApiMethod';\r\nimport { ApiModel } from './ApiModel';\r\nimport { ApiNamespace, IApiNamespaceOptions } from './ApiNamespace';\r\nimport { ApiPackage, IApiPackageOptions } from './ApiPackage';\r\nimport { ApiInterface, IApiInterfaceOptions, IApiInterfaceJson } from './ApiInterface';\r\nimport { ApiPropertySignature, IApiPropertySignatureOptions } from './ApiPropertySignature';\r\nimport { ApiMethodSignature, IApiMethodSignatureOptions } from './ApiMethodSignature';\r\nimport { ApiProperty, IApiPropertyOptions } from './ApiProperty';\r\nimport { ApiEnumMember, IApiEnumMemberOptions, IApiEnumMemberJson } from './ApiEnumMember';\r\nimport { ApiEnum, IApiEnumOptions } from './ApiEnum';\r\nimport { IApiPropertyItemJson } from '../items/ApiPropertyItem';\r\nimport { ApiConstructor, IApiConstructorOptions } from './ApiConstructor';\r\nimport { ApiConstructSignature, IApiConstructSignatureOptions } from './ApiConstructSignature';\r\nimport { ApiFunction, IApiFunctionOptions } from './ApiFunction';\r\nimport { ApiCallSignature, IApiCallSignatureOptions } from './ApiCallSignature';\r\nimport { ApiIndexSignature, IApiIndexSignatureOptions } from './ApiIndexSignature';\r\nimport { ApiTypeAlias, IApiTypeAliasOptions, IApiTypeAliasJson } from './ApiTypeAlias';\r\nimport { ApiVariable, IApiVariableOptions, IApiVariableJson } from './ApiVariable';\r\nimport { IApiDeclaredItemJson } from '../items/ApiDeclaredItem';\r\nimport { DeserializerContext } from './DeserializerContext';\r\n\r\nexport class Deserializer {\r\n public static deserialize(context: DeserializerContext, jsonObject: IApiItemJson): ApiItem {\r\n const options: Partial<IApiItemOptions> = {};\r\n\r\n switch (jsonObject.kind) {\r\n case ApiItemKind.Class:\r\n ApiClass.onDeserializeInto(options, context, jsonObject as IApiClassJson);\r\n return new ApiClass(options as IApiClassOptions);\r\n case ApiItemKind.CallSignature:\r\n ApiCallSignature.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiCallSignature(options as IApiCallSignatureOptions);\r\n case ApiItemKind.Constructor:\r\n ApiConstructor.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiConstructor(options as IApiConstructorOptions);\r\n case ApiItemKind.ConstructSignature:\r\n ApiConstructSignature.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiConstructSignature(options as IApiConstructSignatureOptions);\r\n case ApiItemKind.EntryPoint:\r\n ApiEntryPoint.onDeserializeInto(options, context, jsonObject);\r\n return new ApiEntryPoint(options as IApiEntryPointOptions);\r\n case ApiItemKind.Enum:\r\n ApiEnum.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiEnum(options as IApiEnumOptions);\r\n case ApiItemKind.EnumMember:\r\n ApiEnumMember.onDeserializeInto(options, context, jsonObject as IApiEnumMemberJson);\r\n return new ApiEnumMember(options as IApiEnumMemberOptions);\r\n case ApiItemKind.Function:\r\n ApiFunction.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiFunction(options as IApiFunctionOptions);\r\n case ApiItemKind.IndexSignature:\r\n ApiIndexSignature.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiIndexSignature(options as IApiIndexSignatureOptions);\r\n case ApiItemKind.Interface:\r\n ApiInterface.onDeserializeInto(options, context, jsonObject as IApiInterfaceJson);\r\n return new ApiInterface(options as IApiInterfaceOptions);\r\n case ApiItemKind.Method:\r\n ApiMethod.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiMethod(options as IApiMethodOptions);\r\n case ApiItemKind.MethodSignature:\r\n ApiMethodSignature.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiMethodSignature(options as IApiMethodSignatureOptions);\r\n case ApiItemKind.Model:\r\n return new ApiModel();\r\n case ApiItemKind.Namespace:\r\n ApiNamespace.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\r\n return new ApiNamespace(options as IApiNamespaceOptions);\r\n case ApiItemKind.Package:\r\n ApiPackage.onDeserializeInto(options, context, jsonObject);\r\n return new ApiPackage(options as IApiPackageOptions);\r\n case ApiItemKind.Property:\r\n ApiProperty.onDeserializeInto(options, context, jsonObject as IApiPropertyItemJson);\r\n return new ApiProperty(options as IApiPropertyOptions);\r\n case ApiItemKind.PropertySignature:\r\n ApiPropertySignature.onDeserializeInto(options, context, jsonObject as IApiPropertyItemJson);\r\n return new ApiPropertySignature(options as IApiPropertySignatureOptions);\r\n case ApiItemKind.TypeAlias:\r\n ApiTypeAlias.onDeserializeInto(options, context, jsonObject as IApiTypeAliasJson);\r\n return new ApiTypeAlias(options as IApiTypeAliasOptions);\r\n case ApiItemKind.Variable:\r\n ApiVariable.onDeserializeInto(options, context, jsonObject as IApiVariableJson);\r\n return new ApiVariable(options as IApiVariableOptions);\r\n default:\r\n throw new Error(`Failed to deserialize unsupported API item type ${JSON.stringify(jsonObject.kind)}`);\r\n }\r\n }\r\n}\r\n"]}
@@ -3,6 +3,7 @@
3
3
  // See LICENSE in the project root for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.ModelReferenceResolver = void 0;
6
+ const ApiItem_1 = require("../items/ApiItem");
6
7
  const ApiItemContainerMixin_1 = require("../mixins/ApiItemContainerMixin");
7
8
  const ApiParameterListMixin_1 = require("../mixins/ApiParameterListMixin");
8
9
  /**
@@ -110,25 +111,25 @@ class ModelReferenceResolver {
110
111
  let selectorItemKind;
111
112
  switch (selectorName) {
112
113
  case 'class':
113
- selectorItemKind = "Class" /* Class */;
114
+ selectorItemKind = ApiItem_1.ApiItemKind.Class;
114
115
  break;
115
116
  case 'enum':
116
- selectorItemKind = "Enum" /* Enum */;
117
+ selectorItemKind = ApiItem_1.ApiItemKind.Enum;
117
118
  break;
118
119
  case 'function':
119
- selectorItemKind = "Function" /* Function */;
120
+ selectorItemKind = ApiItem_1.ApiItemKind.Function;
120
121
  break;
121
122
  case 'interface':
122
- selectorItemKind = "Interface" /* Interface */;
123
+ selectorItemKind = ApiItem_1.ApiItemKind.Interface;
123
124
  break;
124
125
  case 'namespace':
125
- selectorItemKind = "Namespace" /* Namespace */;
126
+ selectorItemKind = ApiItem_1.ApiItemKind.Namespace;
126
127
  break;
127
128
  case 'type':
128
- selectorItemKind = "TypeAlias" /* TypeAlias */;
129
+ selectorItemKind = ApiItem_1.ApiItemKind.TypeAlias;
129
130
  break;
130
131
  case 'variable':
131
- selectorItemKind = "Variable" /* Variable */;
132
+ selectorItemKind = ApiItem_1.ApiItemKind.Variable;
132
133
  break;
133
134
  default:
134
135
  result.errorMessage = `Unsupported system selector "${selectorName}"`;
@@ -1 +1 @@
1
- {"version":3,"file":"ModelReferenceResolver.js","sourceRoot":"","sources":["../../src/model/ModelReferenceResolver.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2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AC,MAAM,KAAK,CAAC,EAAE;YAChC,MAAM,CAAC,eAAe,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;YAC5C,OAAO,MAAM,CAAC;SACf;QAED,MAAM,CAAC,YAAY,GAAG,wBAAwB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,gBAAgB,CAAC;QACzF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AArMD,wDAqMC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { DocDeclarationReference, DocMemberSelector, SelectorKind } from '@microsoft/tsdoc';\r\nimport { ApiItem, ApiItemKind } from '../items/ApiItem';\r\nimport { ApiModel } from './ApiModel';\r\nimport { ApiPackage } from './ApiPackage';\r\nimport { ApiEntryPoint } from './ApiEntryPoint';\r\nimport { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin';\r\nimport { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';\r\n\r\n/**\r\n * Result object for {@link ApiModel.resolveDeclarationReference}.\r\n *\r\n * @public\r\n */\r\nexport interface IResolveDeclarationReferenceResult {\r\n /**\r\n * The referenced ApiItem, if the declaration reference could be resolved.\r\n */\r\n resolvedApiItem: ApiItem | undefined;\r\n\r\n /**\r\n * If resolvedApiItem is undefined, then this will always contain an error message explaining why the\r\n * resolution failed.\r\n */\r\n errorMessage: string | undefined;\r\n}\r\n\r\n/**\r\n * This resolves a TSDoc declaration reference by walking the `ApiModel` hierarchy.\r\n *\r\n * @remarks\r\n *\r\n * This class is analogous to `AstReferenceResolver` from the `@microsoft/api-extractor` project,\r\n * which resolves declaration references by walking the compiler state.\r\n */\r\nexport class ModelReferenceResolver {\r\n private readonly _apiModel: ApiModel;\r\n\r\n public constructor(apiModel: ApiModel) {\r\n this._apiModel = apiModel;\r\n }\r\n\r\n public resolve(\r\n declarationReference: DocDeclarationReference,\r\n contextApiItem: ApiItem | undefined\r\n ): IResolveDeclarationReferenceResult {\r\n const result: IResolveDeclarationReferenceResult = {\r\n resolvedApiItem: undefined,\r\n errorMessage: undefined\r\n };\r\n\r\n let apiPackage: ApiPackage | undefined = undefined;\r\n\r\n // Is this an absolute reference?\r\n if (declarationReference.packageName !== undefined) {\r\n apiPackage = this._apiModel.tryGetPackageByName(declarationReference.packageName);\r\n if (apiPackage === undefined) {\r\n result.errorMessage = `The package \"${declarationReference.packageName}\" could not be located`;\r\n return result;\r\n }\r\n } else {\r\n // If the package name is omitted, try to infer it from the context\r\n if (contextApiItem !== undefined) {\r\n apiPackage = contextApiItem.getAssociatedPackage();\r\n }\r\n\r\n if (apiPackage === undefined) {\r\n result.errorMessage =\r\n `The reference does not include a package name, and the package could not be inferred` +\r\n ` from the context`;\r\n return result;\r\n }\r\n }\r\n\r\n const importPath: string = declarationReference.importPath || '';\r\n\r\n const foundEntryPoints: ReadonlyArray<ApiEntryPoint> = apiPackage.findEntryPointsByPath(importPath);\r\n if (foundEntryPoints.length !== 1) {\r\n result.errorMessage = `The import path \"${importPath}\" could not be resolved`;\r\n return result;\r\n }\r\n\r\n let currentItem: ApiItem = foundEntryPoints[0];\r\n\r\n // Now search for the member reference\r\n for (const memberReference of declarationReference.memberReferences) {\r\n if (memberReference.memberSymbol !== undefined) {\r\n result.errorMessage = `Symbols are not yet supported in declaration references`;\r\n return result;\r\n }\r\n\r\n if (memberReference.memberIdentifier === undefined) {\r\n result.errorMessage = `Missing member identifier`;\r\n return result;\r\n }\r\n\r\n const identifier: string = memberReference.memberIdentifier.identifier;\r\n\r\n if (!ApiItemContainerMixin.isBaseClassOf(currentItem)) {\r\n // For example, {@link MyClass.myMethod.X} is invalid because methods cannot contain members\r\n result.errorMessage = `Unable to resolve ${JSON.stringify(\r\n identifier\r\n )} because ${currentItem.getScopedNameWithinPackage()} cannot act as a container`;\r\n return result;\r\n }\r\n\r\n const foundMembers: ReadonlyArray<ApiItem> = currentItem.findMembersByName(identifier);\r\n if (foundMembers.length === 0) {\r\n result.errorMessage = `The member reference ${JSON.stringify(identifier)} was not found`;\r\n return result;\r\n }\r\n\r\n const memberSelector: DocMemberSelector | undefined = memberReference.selector;\r\n if (memberSelector === undefined) {\r\n if (foundMembers.length > 1) {\r\n result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;\r\n return result;\r\n }\r\n currentItem = foundMembers[0];\r\n } else {\r\n let memberSelectorResult: IResolveDeclarationReferenceResult;\r\n switch (memberSelector.selectorKind) {\r\n case SelectorKind.System:\r\n memberSelectorResult = this._selectUsingSystemSelector(foundMembers, memberSelector, identifier);\r\n break;\r\n case SelectorKind.Index:\r\n memberSelectorResult = this._selectUsingIndexSelector(foundMembers, memberSelector, identifier);\r\n break;\r\n default:\r\n result.errorMessage = `The selector \"${memberSelector.selector}\" is not a supported selector type`;\r\n return result;\r\n }\r\n if (memberSelectorResult.resolvedApiItem === undefined) {\r\n return memberSelectorResult;\r\n }\r\n currentItem = memberSelectorResult.resolvedApiItem;\r\n }\r\n }\r\n result.resolvedApiItem = currentItem;\r\n return result;\r\n }\r\n\r\n private _selectUsingSystemSelector(\r\n foundMembers: ReadonlyArray<ApiItem>,\r\n memberSelector: DocMemberSelector,\r\n identifier: string\r\n ): IResolveDeclarationReferenceResult {\r\n const result: IResolveDeclarationReferenceResult = {\r\n resolvedApiItem: undefined,\r\n errorMessage: undefined\r\n };\r\n\r\n const selectorName: string = memberSelector.selector;\r\n\r\n let selectorItemKind: ApiItemKind;\r\n switch (selectorName) {\r\n case 'class':\r\n selectorItemKind = ApiItemKind.Class;\r\n break;\r\n case 'enum':\r\n selectorItemKind = ApiItemKind.Enum;\r\n break;\r\n case 'function':\r\n selectorItemKind = ApiItemKind.Function;\r\n break;\r\n case 'interface':\r\n selectorItemKind = ApiItemKind.Interface;\r\n break;\r\n case 'namespace':\r\n selectorItemKind = ApiItemKind.Namespace;\r\n break;\r\n case 'type':\r\n selectorItemKind = ApiItemKind.TypeAlias;\r\n break;\r\n case 'variable':\r\n selectorItemKind = ApiItemKind.Variable;\r\n break;\r\n default:\r\n result.errorMessage = `Unsupported system selector \"${selectorName}\"`;\r\n return result;\r\n }\r\n\r\n const matches: ApiItem[] = foundMembers.filter((x) => x.kind === selectorItemKind);\r\n if (matches.length === 0) {\r\n result.errorMessage =\r\n `A declaration for \"${identifier}\" was not found that matches the` +\r\n ` TSDoc selector \"${selectorName}\"`;\r\n return result;\r\n }\r\n if (matches.length > 1) {\r\n result.errorMessage = `More than one declaration \"${identifier}\" matches the TSDoc selector \"${selectorName}\"`;\r\n }\r\n result.resolvedApiItem = matches[0];\r\n return result;\r\n }\r\n\r\n private _selectUsingIndexSelector(\r\n foundMembers: ReadonlyArray<ApiItem>,\r\n memberSelector: DocMemberSelector,\r\n identifier: string\r\n ): IResolveDeclarationReferenceResult {\r\n const result: IResolveDeclarationReferenceResult = {\r\n resolvedApiItem: undefined,\r\n errorMessage: undefined\r\n };\r\n\r\n const selectedMembers: ApiItem[] = [];\r\n\r\n const selectorOverloadIndex: number = parseInt(memberSelector.selector);\r\n for (const foundMember of foundMembers) {\r\n if (ApiParameterListMixin.isBaseClassOf(foundMember)) {\r\n if (foundMember.overloadIndex === selectorOverloadIndex) {\r\n selectedMembers.push(foundMember);\r\n }\r\n }\r\n }\r\n\r\n if (selectedMembers.length === 0) {\r\n result.errorMessage =\r\n `An overload for ${JSON.stringify(identifier)} was not found that matches` +\r\n ` the TSDoc selector \":${selectorOverloadIndex}\"`;\r\n return result;\r\n }\r\n\r\n if (selectedMembers.length === 1) {\r\n result.resolvedApiItem = selectedMembers[0];\r\n return result;\r\n }\r\n\r\n result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;\r\n return result;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ModelReferenceResolver.js","sourceRoot":"","sources":["../../src/model/ModelReferenceResolver.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,8CAAwD;AAIxD,2EAAwE;AACxE,2EAAwE;AAoBxE;;;;;;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B,qBAAqB,GAAG,CAAC;YACpD,OAAO,MAAM,CAAC;SACf;QAED,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,MAAM,CAAC,eAAe,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;YAC5C,OAAO,MAAM,CAAC;SACf;QAED,MAAM,CAAC,YAAY,GAAG,wBAAwB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,gBAAgB,CAAC;QACzF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AArMD,wDAqMC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { DocDeclarationReference, DocMemberSelector, SelectorKind } from '@microsoft/tsdoc';\r\nimport { ApiItem, ApiItemKind } from '../items/ApiItem';\r\nimport { ApiModel } from './ApiModel';\r\nimport { ApiPackage } from './ApiPackage';\r\nimport { ApiEntryPoint } from './ApiEntryPoint';\r\nimport { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin';\r\nimport { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';\r\n\r\n/**\r\n * Result object for {@link ApiModel.resolveDeclarationReference}.\r\n *\r\n * @public\r\n */\r\nexport interface IResolveDeclarationReferenceResult {\r\n /**\r\n * The referenced ApiItem, if the declaration reference could be resolved.\r\n */\r\n resolvedApiItem: ApiItem | undefined;\r\n\r\n /**\r\n * If resolvedApiItem is undefined, then this will always contain an error message explaining why the\r\n * resolution failed.\r\n */\r\n errorMessage: string | undefined;\r\n}\r\n\r\n/**\r\n * This resolves a TSDoc declaration reference by walking the `ApiModel` hierarchy.\r\n *\r\n * @remarks\r\n *\r\n * This class is analogous to `AstReferenceResolver` from the `@microsoft/api-extractor` project,\r\n * which resolves declaration references by walking the compiler state.\r\n */\r\nexport class ModelReferenceResolver {\r\n private readonly _apiModel: ApiModel;\r\n\r\n public constructor(apiModel: ApiModel) {\r\n this._apiModel = apiModel;\r\n }\r\n\r\n public resolve(\r\n declarationReference: DocDeclarationReference,\r\n contextApiItem: ApiItem | undefined\r\n ): IResolveDeclarationReferenceResult {\r\n const result: IResolveDeclarationReferenceResult = {\r\n resolvedApiItem: undefined,\r\n errorMessage: undefined\r\n };\r\n\r\n let apiPackage: ApiPackage | undefined = undefined;\r\n\r\n // Is this an absolute reference?\r\n if (declarationReference.packageName !== undefined) {\r\n apiPackage = this._apiModel.tryGetPackageByName(declarationReference.packageName);\r\n if (apiPackage === undefined) {\r\n result.errorMessage = `The package \"${declarationReference.packageName}\" could not be located`;\r\n return result;\r\n }\r\n } else {\r\n // If the package name is omitted, try to infer it from the context\r\n if (contextApiItem !== undefined) {\r\n apiPackage = contextApiItem.getAssociatedPackage();\r\n }\r\n\r\n if (apiPackage === undefined) {\r\n result.errorMessage =\r\n `The reference does not include a package name, and the package could not be inferred` +\r\n ` from the context`;\r\n return result;\r\n }\r\n }\r\n\r\n const importPath: string = declarationReference.importPath || '';\r\n\r\n const foundEntryPoints: ReadonlyArray<ApiEntryPoint> = apiPackage.findEntryPointsByPath(importPath);\r\n if (foundEntryPoints.length !== 1) {\r\n result.errorMessage = `The import path \"${importPath}\" could not be resolved`;\r\n return result;\r\n }\r\n\r\n let currentItem: ApiItem = foundEntryPoints[0];\r\n\r\n // Now search for the member reference\r\n for (const memberReference of declarationReference.memberReferences) {\r\n if (memberReference.memberSymbol !== undefined) {\r\n result.errorMessage = `Symbols are not yet supported in declaration references`;\r\n return result;\r\n }\r\n\r\n if (memberReference.memberIdentifier === undefined) {\r\n result.errorMessage = `Missing member identifier`;\r\n return result;\r\n }\r\n\r\n const identifier: string = memberReference.memberIdentifier.identifier;\r\n\r\n if (!ApiItemContainerMixin.isBaseClassOf(currentItem)) {\r\n // For example, {@link MyClass.myMethod.X} is invalid because methods cannot contain members\r\n result.errorMessage = `Unable to resolve ${JSON.stringify(\r\n identifier\r\n )} because ${currentItem.getScopedNameWithinPackage()} cannot act as a container`;\r\n return result;\r\n }\r\n\r\n const foundMembers: ReadonlyArray<ApiItem> = currentItem.findMembersByName(identifier);\r\n if (foundMembers.length === 0) {\r\n result.errorMessage = `The member reference ${JSON.stringify(identifier)} was not found`;\r\n return result;\r\n }\r\n\r\n const memberSelector: DocMemberSelector | undefined = memberReference.selector;\r\n if (memberSelector === undefined) {\r\n if (foundMembers.length > 1) {\r\n result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;\r\n return result;\r\n }\r\n currentItem = foundMembers[0];\r\n } else {\r\n let memberSelectorResult: IResolveDeclarationReferenceResult;\r\n switch (memberSelector.selectorKind) {\r\n case SelectorKind.System:\r\n memberSelectorResult = this._selectUsingSystemSelector(foundMembers, memberSelector, identifier);\r\n break;\r\n case SelectorKind.Index:\r\n memberSelectorResult = this._selectUsingIndexSelector(foundMembers, memberSelector, identifier);\r\n break;\r\n default:\r\n result.errorMessage = `The selector \"${memberSelector.selector}\" is not a supported selector type`;\r\n return result;\r\n }\r\n if (memberSelectorResult.resolvedApiItem === undefined) {\r\n return memberSelectorResult;\r\n }\r\n currentItem = memberSelectorResult.resolvedApiItem;\r\n }\r\n }\r\n result.resolvedApiItem = currentItem;\r\n return result;\r\n }\r\n\r\n private _selectUsingSystemSelector(\r\n foundMembers: ReadonlyArray<ApiItem>,\r\n memberSelector: DocMemberSelector,\r\n identifier: string\r\n ): IResolveDeclarationReferenceResult {\r\n const result: IResolveDeclarationReferenceResult = {\r\n resolvedApiItem: undefined,\r\n errorMessage: undefined\r\n };\r\n\r\n const selectorName: string = memberSelector.selector;\r\n\r\n let selectorItemKind: ApiItemKind;\r\n switch (selectorName) {\r\n case 'class':\r\n selectorItemKind = ApiItemKind.Class;\r\n break;\r\n case 'enum':\r\n selectorItemKind = ApiItemKind.Enum;\r\n break;\r\n case 'function':\r\n selectorItemKind = ApiItemKind.Function;\r\n break;\r\n case 'interface':\r\n selectorItemKind = ApiItemKind.Interface;\r\n break;\r\n case 'namespace':\r\n selectorItemKind = ApiItemKind.Namespace;\r\n break;\r\n case 'type':\r\n selectorItemKind = ApiItemKind.TypeAlias;\r\n break;\r\n case 'variable':\r\n selectorItemKind = ApiItemKind.Variable;\r\n break;\r\n default:\r\n result.errorMessage = `Unsupported system selector \"${selectorName}\"`;\r\n return result;\r\n }\r\n\r\n const matches: ApiItem[] = foundMembers.filter((x) => x.kind === selectorItemKind);\r\n if (matches.length === 0) {\r\n result.errorMessage =\r\n `A declaration for \"${identifier}\" was not found that matches the` +\r\n ` TSDoc selector \"${selectorName}\"`;\r\n return result;\r\n }\r\n if (matches.length > 1) {\r\n result.errorMessage = `More than one declaration \"${identifier}\" matches the TSDoc selector \"${selectorName}\"`;\r\n }\r\n result.resolvedApiItem = matches[0];\r\n return result;\r\n }\r\n\r\n private _selectUsingIndexSelector(\r\n foundMembers: ReadonlyArray<ApiItem>,\r\n memberSelector: DocMemberSelector,\r\n identifier: string\r\n ): IResolveDeclarationReferenceResult {\r\n const result: IResolveDeclarationReferenceResult = {\r\n resolvedApiItem: undefined,\r\n errorMessage: undefined\r\n };\r\n\r\n const selectedMembers: ApiItem[] = [];\r\n\r\n const selectorOverloadIndex: number = parseInt(memberSelector.selector);\r\n for (const foundMember of foundMembers) {\r\n if (ApiParameterListMixin.isBaseClassOf(foundMember)) {\r\n if (foundMember.overloadIndex === selectorOverloadIndex) {\r\n selectedMembers.push(foundMember);\r\n }\r\n }\r\n }\r\n\r\n if (selectedMembers.length === 0) {\r\n result.errorMessage =\r\n `An overload for ${JSON.stringify(identifier)} was not found that matches` +\r\n ` the TSDoc selector \":${selectorOverloadIndex}\"`;\r\n return result;\r\n }\r\n\r\n if (selectedMembers.length === 1) {\r\n result.resolvedApiItem = selectedMembers[0];\r\n return result;\r\n }\r\n\r\n result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;\r\n return result;\r\n }\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/api-extractor-model",
3
- "version": "7.14.0",
3
+ "version": "7.15.0",
4
4
  "description": "A helper library for loading and saving the .api.json files created by API Extractor",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,11 +18,10 @@
18
18
  },
19
19
  "devDependencies": {
20
20
  "@rushstack/eslint-config": "2.5.0",
21
- "@rushstack/heft": "0.42.5",
22
- "@rushstack/heft-node-rig": "1.3.0",
21
+ "@rushstack/heft": "0.43.0",
22
+ "@rushstack/heft-node-rig": "1.4.1",
23
23
  "@types/heft-jest": "1.0.1",
24
- "@types/node": "12.20.24",
25
- "typescript": "~4.5.2"
24
+ "@types/node": "12.20.24"
26
25
  },
27
26
  "scripts": {
28
27
  "build": "heft test --clean"