@microsoft/api-extractor-model 7.16.2 → 7.17.2

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.
package/dist/rollup.d.ts CHANGED
@@ -2157,6 +2157,7 @@ export declare interface ITypeParameterOptions {
2157
2157
  name: string;
2158
2158
  constraintExcerpt: Excerpt;
2159
2159
  defaultTypeExcerpt: Excerpt;
2160
+ isOptional: boolean;
2160
2161
  parent: ApiTypeParameterListMixin;
2161
2162
  }
2162
2163
 
@@ -2331,6 +2332,10 @@ export declare class TypeParameter {
2331
2332
  * The parameter name.
2332
2333
  */
2333
2334
  name: string;
2335
+ /**
2336
+ * Whether the type parameter is optional. True IFF there exists a `defaultTypeExcerpt`.
2337
+ */
2338
+ isOptional: boolean;
2334
2339
  private _parent;
2335
2340
  constructor(options: ITypeParameterOptions);
2336
2341
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ApiTypeParameterListMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiTypeParameterListMixin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKvD;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,kBAAkB,CAAC;IACzC,qBAAqB,EAAE,kBAAkB,CAAC;CAC3C;AAED;;;GAGG;AACH,MAAM,WAAW,iCAAkC,SAAQ,eAAe;IACxE,cAAc,EAAE,wBAAwB,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,8BAA+B,SAAQ,YAAY;IAClE,cAAc,EAAE,wBAAwB,EAAE,CAAC;CAC5C;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,yB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aAAa,CAAC,aAAa,CAAC,CAAC;IAEtD,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,SAAS,mBAAmB,EAC9E,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,yBAAyB,CAAC,CAqElE;AAED;;;GAGG;AACH,yBAAiB,yBAAyB,CAAC;IACzC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,yBAAyB,CAEpF;CACF"}
@@ -28,10 +28,12 @@ function ApiTypeParameterListMixin(baseClass
28
28
  if (this instanceof ApiDeclaredItem_1.ApiDeclaredItem) {
29
29
  if (options.typeParameters) {
30
30
  for (const typeParameterOptions of options.typeParameters) {
31
+ const defaultTypeExcerpt = this.buildExcerpt(typeParameterOptions.defaultTypeTokenRange);
31
32
  const typeParameter = new TypeParameter_1.TypeParameter({
32
33
  name: typeParameterOptions.typeParameterName,
33
34
  constraintExcerpt: this.buildExcerpt(typeParameterOptions.constraintTokenRange),
34
- defaultTypeExcerpt: this.buildExcerpt(typeParameterOptions.defaultTypeTokenRange),
35
+ defaultTypeExcerpt,
36
+ isOptional: !defaultTypeExcerpt.isEmpty,
35
37
  parent: this
36
38
  });
37
39
  this[_typeParameters].push(typeParameter);
@@ -1 +1 @@
1
- {"version":3,"file":"ApiTypeParameterListMixin.js","sourceRoot":"","sources":["../../src/mixins/ApiTypeParameterListMixin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,4DAA4D;;;AAI5D,0DAAuD;AACvD,oEAA6D;AAC7D,8DAA2D;AAyB3D,MAAM,eAAe,GAAkB,MAAM,CAAC,2CAA2C,CAAC,CAAC;AA2B3F;;;;;;;;GAQG;AACH,SAAgB,yBAAyB,CACvC,SAAqB;AACrB,8DAA8D;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CAAC;YAC5D,KAAK,MAAM,aAAa,IAAI,IAAI,CAAC,cAAc,EAAE;gBAC/C,oBAAoB,CAAC,IAAI,CAAC;oBACxB,iBAAiB,EAAE,aAAa,CAAC,IAAI;oBACrC,oBAAoB,EAAE,aAAa,CAAC,iBAAiB,CAAC,UAAU;oBAChE,qBAAqB,EAAE,aAAa,CAAC,kBAAkB,CAAC,UAAU;iBACnE,CAAC,CAAC;aACJ;YAED,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE;gBACnC,UAAU,CAAC,cAAc,GAAG,oBAAoB,CAAC;aAClD;QACH,CAAC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAtED,8DAsEC;AAED;;;GAGG;AACH,WAAiB,yBAAyB;IACxC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAgB;QAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;IAFe,uCAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAazC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.s\n\nimport { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';\nimport { IExcerptTokenRange } from './Excerpt';\nimport { TypeParameter } from '../model/TypeParameter';\nimport { InternalError } from '@rushstack/node-core-library';\nimport { ApiDeclaredItem } from '../items/ApiDeclaredItem';\nimport { DeserializerContext } from '../model/DeserializerContext';\n\n/**\n * Represents parameter information that is part of {@link IApiTypeParameterListMixinOptions}\n * @public\n */\nexport interface IApiTypeParameterOptions {\n typeParameterName: string;\n constraintTokenRange: IExcerptTokenRange;\n defaultTypeTokenRange: IExcerptTokenRange;\n}\n\n/**\n * Constructor options for {@link (ApiTypeParameterListMixin:interface)}.\n * @public\n */\nexport interface IApiTypeParameterListMixinOptions extends IApiItemOptions {\n typeParameters: IApiTypeParameterOptions[];\n}\n\nexport interface IApiTypeParameterListMixinJson extends IApiItemJson {\n typeParameters: IApiTypeParameterOptions[];\n}\n\nconst _typeParameters: unique symbol = Symbol('ApiTypeParameterListMixin._typeParameters');\n\n/**\n * The mixin base class for API items that can have type parameters.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\n * TypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\n * features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\n * to extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\n * the function that generates a subclass, an interface that describes the members of the subclass, and\n * a namespace containing static members of the class.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ApiTypeParameterListMixin extends ApiItem {\n /**\n * The type parameters.\n */\n readonly typeParameters: ReadonlyArray<TypeParameter>;\n\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link (ApiTypeParameterListMixin:interface)}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiTypeParameterListMixin:interface)}\n * functionality.\n *\n * @public\n */\nexport function ApiTypeParameterListMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiTypeParameterListMixin) {\n class MixedClass extends baseClass implements ApiTypeParameterListMixin {\n public readonly [_typeParameters]: TypeParameter[];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n\n const options: IApiTypeParameterListMixinOptions = args[0];\n\n this[_typeParameters] = [];\n\n if (this instanceof ApiDeclaredItem) {\n if (options.typeParameters) {\n for (const typeParameterOptions of options.typeParameters) {\n const typeParameter: TypeParameter = new TypeParameter({\n name: typeParameterOptions.typeParameterName,\n constraintExcerpt: this.buildExcerpt(typeParameterOptions.constraintTokenRange),\n defaultTypeExcerpt: this.buildExcerpt(typeParameterOptions.defaultTypeTokenRange),\n parent: this\n });\n\n this[_typeParameters].push(typeParameter);\n }\n }\n } else {\n throw new InternalError(\n 'ApiTypeParameterListMixin expects a base class that inherits from ApiDeclaredItem'\n );\n }\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiTypeParameterListMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiTypeParameterListMixinJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n\n options.typeParameters = jsonObject.typeParameters || [];\n }\n\n public get typeParameters(): ReadonlyArray<TypeParameter> {\n return this[_typeParameters];\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiTypeParameterListMixinJson>): void {\n super.serializeInto(jsonObject);\n\n const typeParameterObjects: IApiTypeParameterOptions[] = [];\n for (const typeParameter of this.typeParameters) {\n typeParameterObjects.push({\n typeParameterName: typeParameter.name,\n constraintTokenRange: typeParameter.constraintExcerpt.tokenRange,\n defaultTypeTokenRange: typeParameter.defaultTypeExcerpt.tokenRange\n });\n }\n\n if (typeParameterObjects.length > 0) {\n jsonObject.typeParameters = typeParameterObjects;\n }\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Static members for {@link (ApiTypeParameterListMixin:interface)}.\n * @public\n */\nexport namespace ApiTypeParameterListMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiTypeParameterListMixin {\n return apiItem.hasOwnProperty(_typeParameters);\n }\n}\n"]}
1
+ {"version":3,"file":"ApiTypeParameterListMixin.js","sourceRoot":"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AC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YAE1D,OAAO,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,IAAI,EAAE,CAAC;QAC3D,CAAC;QAED,IAAW,cAAc;YACvB,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC;QAC/B,CAAC;QAED,gBAAgB;QACT,aAAa,CAAC,UAAmD;YACtE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAEhC,MAAM,oBAAoB,GAA+B,EAAE,CAAC;YAC5D,KAAK,MAAM,aAAa,IAAI,IAAI,CAAC,cAAc,EAAE;gBAC/C,oBAAoB,CAAC,IAAI,CAAC;oBACxB,iBAAiB,EAAE,aAAa,CAAC,IAAI;oBACrC,oBAAoB,EAAE,aAAa,CAAC,iBAAiB,CAAC,UAAU;oBAChE,qBAAqB,EAAE,aAAa,CAAC,kBAAkB,CAAC,UAAU;iBACnE,CAAC,CAAC;aACJ;YAED,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE;gBACnC,UAAU,CAAC,cAAc,GAAG,oBAAoB,CAAC;aAClD;QACH,CAAC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAxED,8DAwEC;AAED;;;GAGG;AACH,WAAiB,yBAAyB;IACxC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAgB;QAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;IAFe,uCAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAazC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.s\n\nimport { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';\nimport { Excerpt, IExcerptTokenRange } from './Excerpt';\nimport { TypeParameter } from '../model/TypeParameter';\nimport { InternalError } from '@rushstack/node-core-library';\nimport { ApiDeclaredItem } from '../items/ApiDeclaredItem';\nimport { DeserializerContext } from '../model/DeserializerContext';\n\n/**\n * Represents parameter information that is part of {@link IApiTypeParameterListMixinOptions}\n * @public\n */\nexport interface IApiTypeParameterOptions {\n typeParameterName: string;\n constraintTokenRange: IExcerptTokenRange;\n defaultTypeTokenRange: IExcerptTokenRange;\n}\n\n/**\n * Constructor options for {@link (ApiTypeParameterListMixin:interface)}.\n * @public\n */\nexport interface IApiTypeParameterListMixinOptions extends IApiItemOptions {\n typeParameters: IApiTypeParameterOptions[];\n}\n\nexport interface IApiTypeParameterListMixinJson extends IApiItemJson {\n typeParameters: IApiTypeParameterOptions[];\n}\n\nconst _typeParameters: unique symbol = Symbol('ApiTypeParameterListMixin._typeParameters');\n\n/**\n * The mixin base class for API items that can have type parameters.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\n * TypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\n * features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\n * to extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\n * the function that generates a subclass, an interface that describes the members of the subclass, and\n * a namespace containing static members of the class.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ApiTypeParameterListMixin extends ApiItem {\n /**\n * The type parameters.\n */\n readonly typeParameters: ReadonlyArray<TypeParameter>;\n\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link (ApiTypeParameterListMixin:interface)}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiTypeParameterListMixin:interface)}\n * functionality.\n *\n * @public\n */\nexport function ApiTypeParameterListMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiTypeParameterListMixin) {\n class MixedClass extends baseClass implements ApiTypeParameterListMixin {\n public readonly [_typeParameters]: TypeParameter[];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n\n const options: IApiTypeParameterListMixinOptions = args[0];\n\n this[_typeParameters] = [];\n\n if (this instanceof ApiDeclaredItem) {\n if (options.typeParameters) {\n for (const typeParameterOptions of options.typeParameters) {\n const defaultTypeExcerpt: Excerpt = this.buildExcerpt(typeParameterOptions.defaultTypeTokenRange);\n const typeParameter: TypeParameter = new TypeParameter({\n name: typeParameterOptions.typeParameterName,\n constraintExcerpt: this.buildExcerpt(typeParameterOptions.constraintTokenRange),\n defaultTypeExcerpt,\n isOptional: !defaultTypeExcerpt.isEmpty,\n parent: this\n });\n\n this[_typeParameters].push(typeParameter);\n }\n }\n } else {\n throw new InternalError(\n 'ApiTypeParameterListMixin expects a base class that inherits from ApiDeclaredItem'\n );\n }\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiTypeParameterListMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiTypeParameterListMixinJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n\n options.typeParameters = jsonObject.typeParameters || [];\n }\n\n public get typeParameters(): ReadonlyArray<TypeParameter> {\n return this[_typeParameters];\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiTypeParameterListMixinJson>): void {\n super.serializeInto(jsonObject);\n\n const typeParameterObjects: IApiTypeParameterOptions[] = [];\n for (const typeParameter of this.typeParameters) {\n typeParameterObjects.push({\n typeParameterName: typeParameter.name,\n constraintTokenRange: typeParameter.constraintExcerpt.tokenRange,\n defaultTypeTokenRange: typeParameter.defaultTypeExcerpt.tokenRange\n });\n }\n\n if (typeParameterObjects.length > 0) {\n jsonObject.typeParameters = typeParameterObjects;\n }\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Static members for {@link (ApiTypeParameterListMixin:interface)}.\n * @public\n */\nexport namespace ApiTypeParameterListMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiTypeParameterListMixin {\n return apiItem.hasOwnProperty(_typeParameters);\n }\n}\n"]}
@@ -9,6 +9,7 @@ export interface ITypeParameterOptions {
9
9
  name: string;
10
10
  constraintExcerpt: Excerpt;
11
11
  defaultTypeExcerpt: Excerpt;
12
+ isOptional: boolean;
12
13
  parent: ApiTypeParameterListMixin;
13
14
  }
14
15
  /**
@@ -68,6 +69,10 @@ export declare class TypeParameter {
68
69
  * The parameter name.
69
70
  */
70
71
  name: string;
72
+ /**
73
+ * Whether the type parameter is optional. True IFF there exists a `defaultTypeExcerpt`.
74
+ */
75
+ isOptional: boolean;
71
76
  private _parent;
72
77
  constructor(options: ITypeParameterOptions);
73
78
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"TypeParameter.d.ts","sourceRoot":"","sources":["../../src/model/TypeParameter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAEhF;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,MAAM,EAAE,yBAAyB,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,aAAa;IACxB;;;;;;;;;;;OAWG;IACH,SAAgB,iBAAiB,EAAE,OAAO,CAAC;IAE3C;;;;;;;;;;;OAWG;IACH,SAAgB,kBAAkB,EAAE,OAAO,CAAC;IAE5C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAC;IAEpB,OAAO,CAAC,OAAO,CAA4B;gBAExB,OAAO,EAAE,qBAAqB;IAOjD;;OAEG;IACH,IAAW,mBAAmB,IAAI,KAAK,CAAC,aAAa,GAAG,SAAS,CAMhE;CACF"}
1
+ {"version":3,"file":"TypeParameter.d.ts","sourceRoot":"","sources":["../../src/model/TypeParameter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAEhF;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,yBAAyB,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,aAAa;IACxB;;;;;;;;;;;OAWG;IACH,SAAgB,iBAAiB,EAAE,OAAO,CAAC;IAE3C;;;;;;;;;;;OAWG;IACH,SAAgB,kBAAkB,EAAE,OAAO,CAAC;IAE5C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACI,UAAU,EAAE,OAAO,CAAC;IAE3B,OAAO,CAAC,OAAO,CAA4B;gBAExB,OAAO,EAAE,qBAAqB;IAQjD;;OAEG;IACH,IAAW,mBAAmB,IAAI,KAAK,CAAC,aAAa,GAAG,SAAS,CAMhE;CACF"}
@@ -35,6 +35,7 @@ class TypeParameter {
35
35
  this.name = options.name;
36
36
  this.constraintExcerpt = options.constraintExcerpt;
37
37
  this.defaultTypeExcerpt = options.defaultTypeExcerpt;
38
+ this.isOptional = options.isOptional;
38
39
  this._parent = options.parent;
39
40
  }
40
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"TypeParameter.js","sourceRoot":"","sources":["../../src/model/TypeParameter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,kEAA+D;AAe/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,aAAa;IAoCxB,YAAmB,OAA8B;QAC/C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACnD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAW,mBAAmB;QAC5B,IAAI,IAAI,CAAC,OAAO,YAAY,qCAAiB,EAAE;YAC7C,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;gBAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC1E;SACF;IACH,CAAC;CACF;AArDD,sCAqDC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as tsdoc from '@microsoft/tsdoc';\n\nimport { ApiDocumentedItem } from '../items/ApiDocumentedItem';\nimport { Excerpt } from '../mixins/Excerpt';\nimport { ApiTypeParameterListMixin } from '../mixins/ApiTypeParameterListMixin';\n\n/**\n * Constructor options for {@link TypeParameter}.\n * @public\n */\nexport interface ITypeParameterOptions {\n name: string;\n constraintExcerpt: Excerpt;\n defaultTypeExcerpt: Excerpt;\n parent: ApiTypeParameterListMixin;\n}\n\n/**\n * Represents a named type parameter for a generic declaration.\n *\n * @remarks\n *\n * `TypeParameter` represents a TypeScript declaration such as `T` in this example:\n *\n * ```ts\n * interface IIdentifier {\n * getCode(): string;\n * }\n *\n * class BarCode implements IIdentifier {\n * private _value: number;\n * public getCode(): string { return this._value.toString(); }\n * }\n *\n * class Book<TIdentifier extends IIdentifier = BarCode> {\n * public identifier: TIdentifier;\n * }\n * ```\n *\n * `TypeParameter` objects belong to the {@link (ApiTypeParameterListMixin:interface).typeParameters} collection.\n *\n * @public\n */\nexport class TypeParameter {\n /**\n * An {@link Excerpt} that describes the base constraint of the type parameter.\n *\n * @remarks\n * In the example below, the `constraintExcerpt` would correspond to the `IIdentifier` subexpression:\n *\n * ```ts\n * class Book<TIdentifier extends IIdentifier = BarCode> {\n * public identifier: TIdentifier;\n * }\n * ```\n */\n public readonly constraintExcerpt: Excerpt;\n\n /**\n * An {@link Excerpt} that describes the default type of the type parameter.\n *\n * @remarks\n * In the example below, the `defaultTypeExcerpt` would correspond to the `BarCode` subexpression:\n *\n * ```ts\n * class Book<TIdentifier extends IIdentifier = BarCode> {\n * public identifier: TIdentifier;\n * }\n * ```\n */\n public readonly defaultTypeExcerpt: Excerpt;\n\n /**\n * The parameter name.\n */\n public name: string;\n\n private _parent: ApiTypeParameterListMixin;\n\n public constructor(options: ITypeParameterOptions) {\n this.name = options.name;\n this.constraintExcerpt = options.constraintExcerpt;\n this.defaultTypeExcerpt = options.defaultTypeExcerpt;\n this._parent = options.parent;\n }\n\n /**\n * Returns the `@typeParam` documentation for this parameter, if present.\n */\n public get tsdocTypeParamBlock(): tsdoc.DocParamBlock | undefined {\n if (this._parent instanceof ApiDocumentedItem) {\n if (this._parent.tsdocComment) {\n return this._parent.tsdocComment.typeParams.tryGetBlockByName(this.name);\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"TypeParameter.js","sourceRoot":"","sources":["../../src/model/TypeParameter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,kEAA+D;AAgB/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,aAAa;IAyCxB,YAAmB,OAA8B;QAC/C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACnD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAW,mBAAmB;QAC5B,IAAI,IAAI,CAAC,OAAO,YAAY,qCAAiB,EAAE;YAC7C,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;gBAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC1E;SACF;IACH,CAAC;CACF;AA3DD,sCA2DC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as tsdoc from '@microsoft/tsdoc';\n\nimport { ApiDocumentedItem } from '../items/ApiDocumentedItem';\nimport { Excerpt } from '../mixins/Excerpt';\nimport { ApiTypeParameterListMixin } from '../mixins/ApiTypeParameterListMixin';\n\n/**\n * Constructor options for {@link TypeParameter}.\n * @public\n */\nexport interface ITypeParameterOptions {\n name: string;\n constraintExcerpt: Excerpt;\n defaultTypeExcerpt: Excerpt;\n isOptional: boolean;\n parent: ApiTypeParameterListMixin;\n}\n\n/**\n * Represents a named type parameter for a generic declaration.\n *\n * @remarks\n *\n * `TypeParameter` represents a TypeScript declaration such as `T` in this example:\n *\n * ```ts\n * interface IIdentifier {\n * getCode(): string;\n * }\n *\n * class BarCode implements IIdentifier {\n * private _value: number;\n * public getCode(): string { return this._value.toString(); }\n * }\n *\n * class Book<TIdentifier extends IIdentifier = BarCode> {\n * public identifier: TIdentifier;\n * }\n * ```\n *\n * `TypeParameter` objects belong to the {@link (ApiTypeParameterListMixin:interface).typeParameters} collection.\n *\n * @public\n */\nexport class TypeParameter {\n /**\n * An {@link Excerpt} that describes the base constraint of the type parameter.\n *\n * @remarks\n * In the example below, the `constraintExcerpt` would correspond to the `IIdentifier` subexpression:\n *\n * ```ts\n * class Book<TIdentifier extends IIdentifier = BarCode> {\n * public identifier: TIdentifier;\n * }\n * ```\n */\n public readonly constraintExcerpt: Excerpt;\n\n /**\n * An {@link Excerpt} that describes the default type of the type parameter.\n *\n * @remarks\n * In the example below, the `defaultTypeExcerpt` would correspond to the `BarCode` subexpression:\n *\n * ```ts\n * class Book<TIdentifier extends IIdentifier = BarCode> {\n * public identifier: TIdentifier;\n * }\n * ```\n */\n public readonly defaultTypeExcerpt: Excerpt;\n\n /**\n * The parameter name.\n */\n public name: string;\n\n /**\n * Whether the type parameter is optional. True IFF there exists a `defaultTypeExcerpt`.\n */\n public isOptional: boolean;\n\n private _parent: ApiTypeParameterListMixin;\n\n public constructor(options: ITypeParameterOptions) {\n this.name = options.name;\n this.constraintExcerpt = options.constraintExcerpt;\n this.defaultTypeExcerpt = options.defaultTypeExcerpt;\n this.isOptional = options.isOptional;\n this._parent = options.parent;\n }\n\n /**\n * Returns the `@typeParam` documentation for this parameter, if present.\n */\n public get tsdocTypeParamBlock(): tsdoc.DocParamBlock | undefined {\n if (this._parent instanceof ApiDocumentedItem) {\n if (this._parent.tsdocComment) {\n return this._parent.tsdocComment.typeParams.tryGetBlockByName(this.name);\n }\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/api-extractor-model",
3
- "version": "7.16.2",
3
+ "version": "7.17.2",
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",
@@ -14,10 +14,10 @@
14
14
  "dependencies": {
15
15
  "@microsoft/tsdoc": "0.14.1",
16
16
  "@microsoft/tsdoc-config": "~0.16.1",
17
- "@rushstack/node-core-library": "3.45.2"
17
+ "@rushstack/node-core-library": "3.45.4"
18
18
  },
19
19
  "devDependencies": {
20
- "@rushstack/eslint-config": "2.5.3",
20
+ "@rushstack/eslint-config": "2.6.0",
21
21
  "@rushstack/heft": "0.44.9",
22
22
  "@rushstack/heft-node-rig": "1.8.7",
23
23
  "@types/heft-jest": "1.0.1",