@arcgis/api-extractor 5.0.0-next.9 → 5.0.0-next.91

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 (35) hide show
  1. package/dist/apiJson.d.ts +342 -516
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +14 -0
  4. package/dist/config/typeReferences/docLinkAdditions.d.ts +51 -0
  5. package/dist/config/typeReferences/globals.d.ts +11 -0
  6. package/dist/config/typeReferences/stringDocLinkAdditions.d.ts +17 -0
  7. package/dist/config/typeReferences/typeScriptGlobals.json.d.ts +3 -0
  8. package/dist/diff/diffApiJson.d.ts +22 -2
  9. package/dist/diff/fetchApiJsonFromNpm.d.ts +1 -1
  10. package/dist/diff/index.d.ts +3 -3
  11. package/dist/diff/index.js +149 -0
  12. package/dist/diff/types.d.ts +20 -3
  13. package/dist/diffTypes/index.d.ts +24 -0
  14. package/dist/diffTypes/index.js +69 -0
  15. package/dist/extractor/ApiExtractor.d.ts +139 -0
  16. package/dist/extractor/config.d.ts +66 -0
  17. package/dist/index.d.ts +12 -8
  18. package/dist/index.js +782 -228
  19. package/dist/internalTypeScriptApis.d.ts +31 -0
  20. package/dist/types.d.ts +18 -21
  21. package/dist/uiUtils/index.d.ts +21 -0
  22. package/dist/uiUtils/index.js +57 -0
  23. package/dist/utils/apiHelpers.d.ts +61 -2
  24. package/dist/utils/astHelpers.d.ts +14 -2
  25. package/dist/utils/error.d.ts +6 -1
  26. package/dist/utils/jsDocHelpers.d.ts +2 -0
  27. package/dist/utils/jsDocParser.d.ts +46 -0
  28. package/dist/utils/jsDocPrinter.d.ts +13 -0
  29. package/dist/utils/partPrinter.d.ts +23 -0
  30. package/dist/utils/print.d.ts +0 -1
  31. package/package.json +15 -5
  32. package/dist/diff.js +0 -147
  33. package/dist/extractor/index.d.ts +0 -46
  34. package/dist/utils/docHelpers.d.ts +0 -9
  35. /package/dist/{ensureValidType.d.ts → ensureCemCompatibility.d.ts} +0 -0
package/dist/apiJson.d.ts CHANGED
@@ -4,8 +4,11 @@
4
4
  * `api.json` is a superset of custom-elements-manifest.
5
5
  *
6
6
  * @see https://custom-elements-manifest.open-wc.org/analyzer/getting-started/
7
+ * @privateRemarks
8
+ * PERF: when most code is moved from jsapi-extractor into api-extractor, replace
9
+ * ? with |undefined here to ensure more consistent shape.
7
10
  */
8
- export type ApiJson = {
11
+ export interface ApiJson {
9
12
  /**
10
13
  * The timestamp at which the metadata was generated, in the format
11
14
  * `YYYY-MM-DDThh:mm:ss`.
@@ -20,26 +23,7 @@ export type ApiJson = {
20
23
  * @remarks
21
24
  * Not present in vanilla custom-elements-manifest.
22
25
  */
23
- compiler: {
24
- /**
25
- * The name of the compiler that generated the metadata.
26
- *
27
- * @example "@arcgis/api-extractor"
28
- */
29
- name: string;
30
- /**
31
- * The version of the compiler that generated the metadata.
32
- *
33
- * @example "4.32.0"
34
- */
35
- version: string;
36
- /**
37
- * The version of TypeScript that was used to generate the metadata.
38
- *
39
- * @example "5.4.5"
40
- */
41
- typescriptVersion: string;
42
- };
26
+ compiler: ApiJsonCompiler;
43
27
  /**
44
28
  * The version of the schema used in this file.
45
29
  *
@@ -53,7 +37,7 @@ export type ApiJson = {
53
37
  * contains information irrelevant to custom element catalogs and
54
38
  * documentation viewers.
55
39
  *
56
- * @remarks
40
+ * @deprecated
57
41
  * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
58
42
  * with custom-elements-manifest.
59
43
  */
@@ -71,33 +55,51 @@ export type ApiJson = {
71
55
  *
72
56
  * @default false
73
57
  *
74
- * @remarks
58
+ * @deprecated
75
59
  * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
76
60
  * with custom-elements-manifest.
77
61
  */
78
- deprecated?: boolean | string;
79
- };
62
+ deprecated?: string | true;
63
+ }
64
+ export interface ApiJsonCompiler {
65
+ /**
66
+ * The name of the compiler that generated the metadata.
67
+ *
68
+ * @example "@arcgis/api-extractor"
69
+ */
70
+ name: string;
71
+ /**
72
+ * The version of the compiler that generated the metadata.
73
+ *
74
+ * @example "4.32.0"
75
+ */
76
+ version: string;
77
+ /**
78
+ * The version of TypeScript that was used to generate the metadata.
79
+ *
80
+ * @example "5.4.5"
81
+ */
82
+ typescriptVersion: string;
83
+ }
80
84
  export type ApiModule = ApiJavaScriptModule;
81
- export type ApiJavaScriptModule = {
85
+ export interface ApiJavaScriptModule extends ApiWithDescription, ApiWithDocsTags, ApiWithUnusedSummary {
82
86
  kind: "javascript-module";
83
87
  /**
84
- * Path to the javascript file needed to be imported.
88
+ * Public import path for the module
85
89
  *
86
- * @example "src/components/property-types/property-types.tsx"
90
+ * @example "components/arcgis-map"
87
91
  */
88
92
  path: string;
89
93
  /**
90
- * A markdown summary suitable for display in a listing.
94
+ * The original source file path, relative to extraction root (most commonly
95
+ * src/ folder).
96
+ *
97
+ * @example "components/map/map.tsx"
91
98
  *
92
99
  * @remarks
93
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
94
- * with custom-elements-manifest.
95
- */
96
- summary?: string;
97
- /**
98
- * A markdown description of the module.
100
+ * Not present in vanilla custom-elements-manifest.
99
101
  */
100
- description?: string;
102
+ sourcePath: string;
101
103
  /**
102
104
  * The declarations of a module.
103
105
  *
@@ -123,15 +125,59 @@ export type ApiJavaScriptModule = {
123
125
  *
124
126
  * @default false
125
127
  */
126
- deprecated?: boolean | string;
127
- };
128
- export type ApiExport = ApiCustomElementExport | ApiJavaScriptExport;
128
+ deprecated?: string | true;
129
+ }
130
+ export interface ApiWithDescription {
131
+ /**
132
+ * A markdown description of an api node
133
+ */
134
+ description?: string;
135
+ }
136
+ export interface ApiWithDocsTags {
137
+ docsTags?: ApiDocsTag[];
138
+ }
139
+ export interface ApiWithDeprecated {
140
+ /**
141
+ * Whether the node is deprecated.
142
+ * If the value is a string, it's the reason for the deprecation.
143
+ *
144
+ * @default false
145
+ */
146
+ deprecated?: string | true;
147
+ }
148
+ export interface ApiWithUnusedSummary {
149
+ /**
150
+ * A markdown summary suitable for display in a listing.
151
+ *
152
+ * @deprecated
153
+ * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
154
+ * with custom-elements-manifest.
155
+ */
156
+ summary?: string;
157
+ }
129
158
  /**
159
+ * A descriptor for a single JSDoc tag found in a block comment.
160
+ *
130
161
  * @remarks
131
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
132
- * with custom-elements-manifest.
162
+ * Some tags have dedicated fields. Those will be excluded from array of
163
+ * "docsTags".
133
164
  */
134
- export type ApiJavaScriptExport = {
165
+ export interface ApiDocsTag {
166
+ /**
167
+ * The tag name (immediately following the '@').
168
+ *
169
+ * @example "since"
170
+ */
171
+ name: string;
172
+ /**
173
+ * The description that immediately follows the tag name.
174
+ *
175
+ * @example "4.31"
176
+ */
177
+ text?: string;
178
+ }
179
+ export type ApiExport = ApiCustomElementExport | ApiJavaScriptExport | ApiTypeScriptExport;
180
+ export interface ApiJavaScriptExport {
135
181
  kind: "js";
136
182
  /**
137
183
  * The name of the exported symbol.
@@ -157,9 +203,23 @@ export type ApiJavaScriptExport = {
157
203
  * If the value is a string, it's the reason for the deprecation.
158
204
  *
159
205
  * @default false
206
+ * @deprecated
207
+ * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
208
+ * with custom-elements-manifest. Read the deprecated status from the declaration.
160
209
  */
161
- deprecated?: boolean | string;
162
- };
210
+ deprecated?: string | true;
211
+ }
212
+ /**
213
+ * Indicates that the export is type-only and has no runtime impact (is a type alias
214
+ * or an interface).
215
+ *
216
+ * @remarks
217
+ * Not present in vanilla custom-elements-manifest, but may be added in the future.
218
+ * See https://github.com/webcomponents/custom-elements-manifest/pull/77#issuecomment-873552677
219
+ */
220
+ export interface ApiTypeScriptExport extends Omit<ApiJavaScriptExport, "kind"> {
221
+ kind: "ts";
222
+ }
163
223
  /**
164
224
  * A global custom element definition, ie the result of a
165
225
  * `customElements.define()` call.
@@ -167,7 +227,7 @@ export type ApiJavaScriptExport = {
167
227
  * This is represented as an export because a definition makes the element
168
228
  * available outside of the module it's defined it.
169
229
  */
170
- export type ApiCustomElementExport = {
230
+ export interface ApiCustomElementExport {
171
231
  kind: "custom-element-definition";
172
232
  /**
173
233
  * The tag name of the custom element.
@@ -186,13 +246,13 @@ export type ApiCustomElementExport = {
186
246
  * If the value is a string, it's the reason for the deprecation.
187
247
  *
188
248
  * @default false
189
- * @remarks
249
+ * @deprecated
190
250
  * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
191
- * with custom-elements-manifest.
251
+ * with custom-elements-manifest. Read the deprecated status from the declaration.
192
252
  */
193
- deprecated?: boolean | string;
194
- };
195
- export type ApiDeclaration = ApiClassDeclaration | ApiCustomElementDeclaration | ApiCustomElementMixinDeclaration | ApiFunctionDeclaration | ApiMixinDeclaration | ApiVariableDeclaration;
253
+ deprecated?: string | true;
254
+ }
255
+ export type ApiDeclaration = ApiClassDeclaration | ApiCustomElementDeclaration | ApiCustomElementMixinDeclaration | ApiFunctionDeclaration | ApiInterfaceDeclaration | ApiMixinDeclaration | ApiVariableDeclaration;
196
256
  /**
197
257
  * A reference to an export of a module.
198
258
  *
@@ -206,7 +266,7 @@ export type ApiDeclaration = ApiClassDeclaration | ApiCustomElementDeclaration |
206
266
  * References to global symbols like `Array`, `HTMLElement`, or `Event` should
207
267
  * use a `package` name of `"global:"`.
208
268
  */
209
- export type ApiReference = {
269
+ export interface ApiReference {
210
270
  /**
211
271
  * @example "AreaMeasurementAnalysis"
212
272
  */
@@ -225,23 +285,15 @@ export type ApiReference = {
225
285
  * @example "https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html"
226
286
  */
227
287
  viewUrl?: string;
228
- };
288
+ }
229
289
  /**
230
- * A reference to the source of a declaration or member.
231
- *
232
290
  * @remarks
233
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
234
- * with custom-elements-manifest.
291
+ * Not present in vanilla custom-elements-manifest.
235
292
  */
236
- export type ApiSourceReference = {
237
- /**
238
- * An absolute URL to the source (ie. a GitHub URL).
239
- */
240
- href: string;
241
- };
293
+ export interface ApiReferenceWithTypeArguments extends ApiReference {
294
+ typeArguments?: ApiType[];
295
+ }
242
296
  /**
243
- * A description of a custom element class.
244
- *
245
297
  * Custom elements are JavaScript classes, so this extends from
246
298
  * `ClassDeclaration` and adds custom-element-specific features like attributes,
247
299
  * events, and slots.
@@ -258,7 +310,7 @@ export type ApiSourceReference = {
258
310
  * these cases one `Module` should contain the `CustomElement` without a
259
311
  * tagName, and another `Module` should contain the `CustomElementExport`.
260
312
  */
261
- export type ApiCustomElementDeclaration = Omit<ApiClassDeclaration, "members"> & {
313
+ export interface ApiCustomElementDeclaration extends ApiClassDeclaration, ApiWithPrivacy {
262
314
  /**
263
315
  * An optional tag name that should be specified if this is a
264
316
  * self-registering element.
@@ -280,7 +332,6 @@ export type ApiCustomElementDeclaration = Omit<ApiClassDeclaration, "members"> &
280
332
  */
281
333
  pascalCaseName: string;
282
334
  members: ApiCustomElementMember[];
283
- superclass: ApiReference;
284
335
  /**
285
336
  * The attributes that this element is known to understand.
286
337
  *
@@ -302,71 +353,47 @@ export type ApiCustomElementDeclaration = Omit<ApiClassDeclaration, "members"> &
302
353
  */
303
354
  customElement: true;
304
355
  /**
356
+ * @default "shadow"
357
+ *
305
358
  * @remarks
306
359
  * Not present in vanilla custom-elements-manifest.
307
360
  */
308
- docsTags?: ApiDocsTag[];
361
+ encapsulation?: "none" | "shadow";
309
362
  /**
310
363
  * The path from which the component can be imported.
311
364
  *
365
+ * @deprecated Use ApiModule.path instead.
366
+ *
312
367
  * @example "components/arcgis-area-measurement-2d"
313
368
  *
314
369
  * @remarks
315
370
  * Not present in vanilla custom-elements-manifest.
316
371
  */
317
372
  importPath: string;
373
+ }
374
+ export interface ApiWithPrivacy {
318
375
  /**
319
- * @default "shadow"
320
- *
321
- * @remarks
322
- * Not present in vanilla custom-elements-manifest.
323
- */
324
- encapsulation?: "none" | "shadow";
325
- };
326
- /**
327
- * A descriptor for a single JSDoc tag found in a block comment.
328
- *
329
- * @remarks
330
- * Some tags have dedicated fields. Those will be excluded from array of
331
- * "docsTags".
332
- */
333
- export type ApiDocsTag = {
334
- /**
335
- * The tag name (immediately following the '@').
376
+ * @default "public"
336
377
  *
337
- * @example "since"
338
- */
339
- name: string;
340
- /**
341
- * The description that immediately follows the tag name.
378
+ * If this field is absent, default value is assumed.
379
+ * All private fields are excluded from the api.json.
380
+ * So in practice, this value will be either "protected" or undefined.
342
381
  *
343
- * @example "4.31"
382
+ * \@arcgis/api-extractor may only ever set this field on class members, even
383
+ * though the original spec also allows it on classes and events.
344
384
  */
345
- text?: string;
346
- };
385
+ privacy?: "private" | "protected" | "public";
386
+ }
347
387
  /**
348
- * For most use cases, the "members" array includes properties will all the
388
+ * For most use cases, the "members" array includes properties with all the
349
389
  * information included in the "attributes" array. Thus directly accessing
350
390
  * "attributes" is not necessary.
351
391
  */
352
- export type ApiAttribute = {
392
+ export interface ApiAttribute extends ApiWithDeprecated, ApiWithDescription, ApiWithInheritance, ApiWithUnusedSummary {
353
393
  /**
354
394
  * @example "initial-count"
355
395
  */
356
396
  name: string;
357
- /**
358
- * A markdown summary suitable for display in a listing.
359
- *
360
- * @remarks
361
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
362
- * with custom-elements-manifest.
363
- */
364
- summary?: string;
365
- /**
366
- * A markdown description.
367
- */
368
- description?: string;
369
- inheritedFrom?: ApiReference;
370
397
  /**
371
398
  * The type that the attribute will be serialized/deserialized as.
372
399
  */
@@ -386,151 +413,95 @@ export type ApiAttribute = {
386
413
  * @example "initialCount"
387
414
  */
388
415
  fieldName?: string;
389
- /**
390
- * Whether the attribute is deprecated.
391
- * If the value is a string, it's the reason for the deprecation.
392
- *
393
- * @default false
394
- */
395
- deprecated?: boolean | string;
396
- };
397
- export type ApiEvent = {
416
+ }
417
+ export interface ApiEvent extends ApiWithDescription, ApiWithDocsTags, ApiWithDeprecated, ApiWithInheritance, ApiWithPrivacy, ApiWithUnusedSummary {
398
418
  /**
399
419
  * @example "arcgisClick"
400
420
  */
401
421
  name: string;
402
- /**
403
- * A markdown summary suitable for display in a listing.
404
- *
405
- * @remarks
406
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
407
- * with custom-elements-manifest.
408
- */
409
- summary?: string;
410
- /**
411
- * A markdown description.
412
- */
413
- description?: string;
414
422
  /**
415
423
  * The type of the event object that's fired.
416
424
  */
417
425
  type: ApiType;
418
- inheritedFrom?: ApiReference;
419
- /**
420
- * Whether the event is deprecated.
421
- * If the value is a string, it's the reason for the deprecation.
422
- *
423
- * @default false
424
- */
425
- deprecated?: boolean | string;
426
- /**
427
- * @remarks
428
- * Not present in vanilla custom-elements-manifest.
429
- */
430
- docsTags?: ApiDocsTag[];
431
426
  /**
432
427
  * @default true
433
428
  *
434
429
  * @remarks
435
430
  * Not present in vanilla custom-elements-manifest.
436
431
  */
437
- bubbles?: boolean;
432
+ bubbles?: false;
438
433
  /**
439
434
  * @default true
440
435
  *
441
436
  * @remarks
442
437
  * Not present in vanilla custom-elements-manifest.
443
438
  */
444
- cancelable?: boolean;
439
+ cancelable?: false;
445
440
  /**
446
441
  * @default true
447
442
  *
448
443
  * @remarks
449
444
  * Not present in vanilla custom-elements-manifest.
450
445
  */
451
- composed?: boolean;
446
+ composed?: false;
447
+ }
448
+ export interface ApiWithInheritance {
452
449
  /**
453
- * @default "public"
454
- *
455
- * @remarks
456
- * Not used by `@arcgis/api-extractor`. Present for completeness.
450
+ * To keep api.json size in check, `inheritedFrom` object does not include
451
+ * `viewUrl`.
457
452
  */
458
- privacy?: ApiPrivacy;
459
- };
453
+ inheritedFrom?: ApiReference;
454
+ }
460
455
  /**
461
456
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot
462
457
  */
463
- export type ApiSlot = {
458
+ export interface ApiSlot extends ApiWithDescription, ApiWithUnusedSummary {
464
459
  /**
465
460
  * The slot name, or the empty string for an unnamed slot.
466
461
  *
467
462
  * @example "header"
468
463
  */
469
464
  name: string;
470
- /**
471
- * A markdown summary suitable for display in a listing.
472
- *
473
- * @remarks
474
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
475
- * with custom-elements-manifest.
476
- */
477
- summary?: string;
478
- /**
479
- * A markdown description.
480
- */
481
- description?: string;
482
465
  /**
483
466
  * Whether the slot is deprecated.
484
467
  * If the value is a string, it's the reason for the deprecation.
485
468
  *
486
469
  * @default false
487
470
  *
488
- * @remarks
471
+ * @deprecated
489
472
  * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
490
473
  * with custom-elements-manifest.
491
474
  */
492
- deprecated?: boolean | string;
493
- };
475
+ deprecated?: string | true;
476
+ }
494
477
  /**
495
478
  * The description of exposed CSS Parts
496
479
  *
497
480
  * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_shadow_parts
498
481
  */
499
- export type ApiCssPart = {
482
+ export interface ApiCssPart extends ApiWithDescription, ApiWithUnusedSummary {
500
483
  /**
501
484
  * @example "tab"
502
485
  */
503
486
  name: string;
504
- /**
505
- * A markdown summary suitable for display in a listing.
506
- *
507
- * @remarks
508
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
509
- * with custom-elements-manifest.
510
- */
511
- summary?: string;
512
- /**
513
- * A markdown description.
514
- */
515
- description?: string;
516
487
  /**
517
488
  * Whether the CSS shadow part is deprecated.
518
489
  * If the value is a string, it's the reason for the deprecation.
519
490
  *
520
491
  * @default false
521
492
  *
522
- * @remarks
493
+ * @deprecated
523
494
  * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
524
495
  * with custom-elements-manifest.
525
496
  */
526
- deprecated?: boolean | string;
527
- };
497
+ deprecated?: string | true;
498
+ }
528
499
  /**
529
500
  * The description of a CSS Custom State.
530
501
  *
531
502
  * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet
532
503
  */
533
- export type ApiCssCustomState = {
504
+ export interface ApiCssCustomState extends ApiWithDescription, ApiWithUnusedSummary {
534
505
  /**
535
506
  * The name of the state. Note: Unlike CSS custom properties, custom states
536
507
  * do not have a leading `--`.
@@ -538,31 +509,19 @@ export type ApiCssCustomState = {
538
509
  * @example "active"
539
510
  */
540
511
  name: string;
541
- /**
542
- * A markdown summary suitable for display in a listing.
543
- *
544
- * @remarks
545
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
546
- * with custom-elements-manifest.
547
- */
548
- summary?: string;
549
- /**
550
- * A markdown description.
551
- */
552
- description?: string;
553
512
  /**
554
513
  * Whether the CSS custom state is deprecated.
555
514
  * If the value is a string, it's the reason for the deprecation.
556
515
  *
557
516
  * @default false
558
517
  *
559
- * @remarks
518
+ * @deprecated
560
519
  * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
561
520
  * with custom-elements-manifest.
562
521
  */
563
- deprecated?: boolean | string;
564
- };
565
- export type ApiCssCustomProperty = {
522
+ deprecated?: string | true;
523
+ }
524
+ export interface ApiCssCustomProperty extends ApiWithDescription, ApiWithUnusedSummary {
566
525
  /**
567
526
  * The name of the property, including leading `--`.
568
527
  *
@@ -582,34 +541,26 @@ export type ApiCssCustomProperty = {
582
541
  * "<length> | <percentage>": accepts lengths or percentages but not calc expressions with a combination of the two
583
542
  * "small | medium | large": accepts one of these values set as custom indents.
584
543
  * "*": any valid token
585
- */
586
- syntax?: string;
587
- default?: string;
588
- /**
589
- * A markdown summary suitable for display in a listing.
590
544
  *
591
- * @remarks
545
+ * @deprecated
592
546
  * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
593
547
  * with custom-elements-manifest.
594
548
  */
595
- summary?: string;
596
- /**
597
- * A markdown description.
598
- */
599
- description?: string;
549
+ syntax?: string;
550
+ default?: string;
600
551
  /**
601
552
  * Whether the CSS custom property is deprecated.
602
553
  * If the value is a string, it's the reason for the deprecation.
603
554
  *
604
555
  * @default false
605
556
  *
606
- * @remarks
557
+ * @deprecated
607
558
  * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
608
559
  * with custom-elements-manifest.
609
560
  */
610
- deprecated?: boolean | string;
611
- };
612
- export type ApiType = {
561
+ deprecated?: string | true;
562
+ }
563
+ export interface ApiType extends ApiWithUnusedSource {
613
564
  /**
614
565
  * The full string representation of the type, in whatever type syntax is
615
566
  * used, such as JSDoc, Closure, or TypeScript.
@@ -630,21 +581,52 @@ export type ApiType = {
630
581
  * and `BarElement` without understanding arrays, generics, or union types.
631
582
  */
632
583
  references?: ApiTypeReference[];
633
- /**
634
- * @remarks
635
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
636
- * with custom-elements-manifest.
637
- */
638
- source?: ApiSourceReference;
639
584
  /**
640
585
  * An enum of possible values for this type.
641
586
  *
642
587
  * @remarks
643
588
  * Not present in vanilla custom-elements-manifest.
589
+ *
590
+ * @privateRemarks
591
+ * FINAL: should we drop this field in favor of offering a util that infers
592
+ * type values from the type string?
593
+ *
594
+ * Pros:
595
+ * - smaller api.json
596
+ * - simpler implementation in some ways (don't need to keep type string and
597
+ * values in sync when doing post processing)
598
+ * - one less non-standard field
599
+ *
600
+ * Cons:
601
+ * - Lumina compiler at present relies on type values in several places, so
602
+ * it may have to compute this anyway
603
+ * - inferring it from the type string is not trivial, think of:
604
+ *
605
+ * ```ts
606
+ * type A = "a|\"" | { b: string | undefined } | T extends `a${1|2}b` ? X | Y : Z;
607
+ * ```
608
+ *
609
+ * though, ChatGPT one-shotted a working solution:
610
+ * https://chatgpt.com/share/68ccd574-2a8c-8003-a6cc-aa3ef01c40ad
611
+ *
612
+ * still, it will be a maintenance burden whenever new TS syntax is added
644
613
  */
645
614
  values?: ApiValue[];
646
- };
647
- export type ApiValue = {
615
+ }
616
+ export interface ApiWithUnusedSource {
617
+ /**
618
+ * A reference to the source of a declaration or member.
619
+ * An absolute URL to the source (ie. a GitHub URL).
620
+ *
621
+ * @deprecated
622
+ * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
623
+ * with custom-elements-manifest.
624
+ */
625
+ source?: {
626
+ href: string;
627
+ };
628
+ }
629
+ export interface ApiValue {
648
630
  /**
649
631
  * @example "string"
650
632
  */
@@ -653,7 +635,7 @@ export type ApiValue = {
653
635
  * @example "active"
654
636
  */
655
637
  value?: string;
656
- };
638
+ }
657
639
  /**
658
640
  * A reference that is associated with a type string and optionally a range
659
641
  * within the string.
@@ -663,31 +645,40 @@ export type ApiValue = {
663
645
  * type string is the symbol referenced and the name should match the type
664
646
  * string.
665
647
  */
666
- export type ApiTypeReference = ApiReference & {
648
+ export interface ApiTypeReference extends ApiReference {
667
649
  start?: number;
668
650
  end?: number;
669
- };
670
- /**
671
- * The common interface of classes and mixins.
672
- */
673
- export type ApiClassDeclaration = {
674
- kind: "class";
651
+ }
652
+ export interface ApiObjectLikeDeclaration extends ApiWithDescription, ApiWithDocsTags, ApiWithDeprecated, ApiWithUnusedSource, ApiWithUnusedSummary, ApiWithTypeParameters {
675
653
  /**
676
654
  * @example "ArcgisCounter"
677
655
  */
678
656
  name: string;
679
- /**
680
- * A markdown summary suitable for display in a listing.
681
- *
682
- * @remarks
683
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
684
- * with custom-elements-manifest.
685
- */
686
- summary?: string;
687
- /**
688
- * A markdown description of the class.
689
- */
690
- description?: string;
657
+ members?: ApiClassMember[];
658
+ }
659
+ export interface ApiWithTypeParameters {
660
+ typeParameters?: ApiTypeParameter[];
661
+ }
662
+ /**
663
+ * @remarks
664
+ * Not present in vanilla custom-elements-manifest.
665
+ */
666
+ export interface ApiTypeParameter {
667
+ name: string;
668
+ constraint?: ApiType;
669
+ default?: ApiType;
670
+ /** @default false */
671
+ const?: true;
672
+ /** @default false */
673
+ in?: true;
674
+ /** @default false */
675
+ out?: true;
676
+ }
677
+ /**
678
+ * The common interface of classes and mixins.
679
+ */
680
+ export interface ApiClassDeclaration extends ApiObjectLikeDeclaration, ApiWithEvents {
681
+ kind: "class";
691
682
  /**
692
683
  * The superclass of this class.
693
684
  *
@@ -695,7 +686,7 @@ export type ApiClassDeclaration = {
695
686
  * includes the mixin applications and the true superclass is computed
696
687
  * from them.
697
688
  */
698
- superclass?: ApiReference;
689
+ superclass?: ApiReferenceWithTypeArguments;
699
690
  /**
700
691
  * Any class mixins applied in the extends clause of this class.
701
692
  *
@@ -708,137 +699,92 @@ export type ApiClassDeclaration = {
708
699
  * matches the order of language used to describe mixin application, like
709
700
  * "S with A, B".
710
701
  *
711
- * @example
712
- *
713
- * ```javascript
714
- * class T extends B(A(S)) {}
715
- * ```
716
- *
717
- * is described by:
718
- * ```json
719
- * {
720
- * "kind": "class",
721
- * "superclass": {
722
- * "name": "S"
723
- * },
724
- * "mixins": [
725
- * {
726
- * "name": "A"
727
- * },
728
- * {
729
- * "name": "B"
730
- * },
731
- * ]
732
- * }
733
- * ```
702
+ * @see https://webgis.esri.com/webgis/core/core/mixins
734
703
  *
735
- * @remarks
736
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
737
- * with custom-elements-manifest.
738
704
  */
739
- mixins?: ApiReference[];
740
- members?: ApiClassMember[];
705
+ mixins?: ApiReferenceWithTypeArguments[];
706
+ }
707
+ export interface ApiWithEvents {
741
708
  /**
742
- * The events that this element fires.
709
+ * The events that this object fires.
743
710
  */
744
711
  events?: ApiEvent[];
712
+ }
713
+ /**
714
+ * An interface that describes the properties and methods of an object.
715
+ *
716
+ * @remarks
717
+ * Not yet part of vanilla custom-elements-manifest, but may be added in the
718
+ * future. See https://github.com/webcomponents/custom-elements-manifest/pull/77
719
+ */
720
+ export interface ApiInterfaceDeclaration extends ApiObjectLikeDeclaration {
721
+ kind: "interface";
745
722
  /**
746
- * @remarks
747
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
748
- * with custom-elements-manifest.
749
- */
750
- source?: ApiSourceReference;
751
- /**
752
- * Whether the class or mixin is deprecated.
753
- * If the value is a string, it's the reason for the deprecation.
754
- *
755
- * @default false
723
+ * The interfaces that this interface extends.
756
724
  */
757
- deprecated?: boolean | string;
725
+ supertypes?: ApiReferenceWithTypeArguments[];
758
726
  /**
759
- * @default "public"
760
- *
761
- * @remarks
762
- * Not used by `@arcgis/api-extractor`. Present for completeness.
727
+ * Present in type aliases only. If type alias is an intersection, then type
728
+ * reference members will be represented in the `supertypes` field. If type
729
+ * alias is an object literal, then object members will be represented in
730
+ * the `members` field. Thus, the `type` field will only be used for unions,
731
+ * mapped types, conditional types, and other types that cannot be represented
732
+ * as supertypes/members.
763
733
  */
764
- privacy?: ApiPrivacy;
765
- };
766
- export type ApiClassMember = ApiClassField | ApiClassMethod;
734
+ type?: ApiType;
735
+ }
736
+ export type ApiClassMember = ApiClassCallSignature | ApiClassConstructor | ApiClassField | ApiClassMethod;
767
737
  export type ApiCustomElementMember = ApiClassMethod | ApiCustomElementField;
768
738
  /**
769
739
  * The common interface of variables, class fields, and function
770
740
  * parameters.
771
741
  */
772
- export type ApiPropertyLike = {
742
+ export interface ApiPropertyLike extends ApiWithDescription, ApiWithDocsTags, ApiWithDeprecated, ApiWithUnusedSummary {
773
743
  /**
774
744
  * @example "initialCount"
745
+ * @example Special names appear unquoted and unescaped: "@eventTypes"
746
+ * @example Computed Symbol properties appear as "[Symbol.iterator]"
775
747
  */
776
748
  name: string;
777
- /**
778
- * A markdown summary suitable for display in a listing.
779
- *
780
- * @remarks
781
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
782
- * with custom-elements-manifest.
783
- */
784
- summary?: string;
785
- /**
786
- * A markdown description of the field.
787
- */
788
- description?: string;
789
749
  type: ApiType;
790
750
  /**
791
751
  * @example 10
792
752
  */
793
753
  default?: string;
794
- /**
795
- * Whether the property is deprecated.
796
- * If the value is a string, it's the reason for the deprecation.
797
- *
798
- * @default false
799
- */
800
- deprecated?: boolean | string;
754
+ }
755
+ export interface ApiClassField extends ApiPropertyLike, ApiWithInheritance, ApiWithStatic, ApiWithPrivacy, ApiWithUnusedSource {
756
+ kind: "field";
801
757
  /**
802
758
  * Whether the property is read-only.
803
759
  *
804
760
  * @default false
805
761
  */
806
- readonly?: boolean;
807
- };
808
- export type ApiClassField = ApiPropertyLike & {
809
- kind: "field";
762
+ readonly?: true;
810
763
  /**
811
- * @default false
764
+ * Getter type if any.
812
765
  *
813
- * @remarks
814
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
815
- * with custom-elements-manifest.
766
+ * This property will only be set if it differs from `type` property in order
767
+ * to keep documentation UI cleaner, and api.json smaller.
816
768
  *
817
- * All static members are excluded from the api.json.
818
- */
819
- static?: boolean;
820
- /**
821
- * @default "public"
769
+ * If property is read-only, only the `type` property will be set.
822
770
  *
823
- * @remarks
824
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
825
- * with custom-elements-manifest.
771
+ * @default undefined
826
772
  *
827
- * All private and protected fields are excluded from the api.json.
773
+ * @remarks
774
+ * Not present in vanilla custom-elements-manifest.
828
775
  */
829
- privacy?: ApiPrivacy;
830
- inheritedFrom?: ApiReference;
776
+ getterType?: ApiType;
777
+ }
778
+ export interface ApiWithStatic {
831
779
  /**
832
- * @remarks
833
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
834
- * with custom-elements-manifest.
780
+ * @default false
835
781
  */
836
- source?: ApiSourceReference;
837
- };
782
+ static?: true;
783
+ }
838
784
  /**
839
785
  * Additional metadata for fields on custom elements.
840
786
  */
841
- export type ApiCustomElementField = ApiClassField & {
787
+ export interface ApiCustomElementField extends ApiClassField {
842
788
  /**
843
789
  * The corresponding attribute name if there is one.
844
790
  *
@@ -855,22 +801,7 @@ export type ApiCustomElementField = ApiClassField & {
855
801
  *
856
802
  * @default false
857
803
  */
858
- reflects?: boolean;
859
- /**
860
- * @remarks
861
- * Not present in vanilla custom-elements-manifest.
862
- */
863
- docsTags?: ApiDocsTag[];
864
- /**
865
- * If getter type differs from setter type, this property will
866
- * contain the getter type.
867
- *
868
- * @default undefined
869
- *
870
- * @remarks
871
- * Not present in vanilla custom-elements-manifest.
872
- */
873
- getterType?: Pick<ApiType, "text">;
804
+ reflects?: true;
874
805
  /**
875
806
  * For some properties, we show them as read-only in the docs and in the
876
807
  * typings but don't actually enforce read-only at runtime.
@@ -885,214 +816,109 @@ export type ApiCustomElementField = ApiClassField & {
885
816
  * @remarks
886
817
  * Not present in vanilla custom-elements-manifest.
887
818
  */
888
- docsOnlyReadonly?: boolean;
889
- };
890
- export type ApiClassMethod = ApiFunctionLike & {
819
+ docsOnlyReadonly?: true;
820
+ }
821
+ export interface ApiClassMethod extends ApiFunctionLike, ApiWithInheritance, ApiWithStatic, ApiWithPrivacy, ApiWithUnusedSource {
891
822
  kind: "method";
892
823
  /**
893
824
  * @default false
894
- *
895
- * @remarks
896
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
897
- * with custom-elements-manifest.
898
- *
899
- * All static members are excluded from the api.json.
900
825
  */
901
- static?: boolean;
902
- /**
903
- * @default "public"
904
- *
905
- * @remarks
906
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
907
- * with custom-elements-manifest.
908
- *
909
- * All private and protected fields are excluded from the api.json.
910
- */
911
- privacy?: ApiPrivacy;
912
- inheritedFrom?: ApiReference;
913
- /**
914
- * @remarks
915
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
916
- * with custom-elements-manifest.
917
- */
918
- source?: ApiSourceReference;
919
- /**
920
- * @remarks
921
- * Not present in vanilla custom-elements-manifest.
922
- */
923
- docsTags?: ApiDocsTag[];
826
+ static?: true;
924
827
  /**
828
+ * @example "(options?: __esri.PopupViewOpenPopupOptions): Promise<void>"
829
+ * @deprecated
830
+ * If documentation UI shows a table with parameters and the return type, then
831
+ * displaying the signature is redundant.
832
+ * Still, if needed, you can use printSignature() util from
833
+ * `@arcgis/api-extractor`.
925
834
  * @remarks
926
835
  * Not present in vanilla custom-elements-manifest.
927
836
  */
928
837
  signature: string;
929
- /**
930
- * @default false
931
- *
932
- * @remarks
933
- * Not present in vanilla custom-elements-manifest.
934
- */
935
- async?: boolean;
936
- };
838
+ }
937
839
  /**
938
- * A description of a class mixin.
939
- *
940
- * Mixins are functions which generate a new subclass of a given superclass.
941
- * This interfaces describes the class and custom element features that
942
- * are added by the mixin. As such, it extends the CustomElement interface and
943
- * ClassLike interface.
944
- *
945
- * Since mixins are functions, it also extends the FunctionLike interface. This
946
- * means a mixin is callable, and has parameters and a return type.
947
- *
948
- * The return type is often hard or impossible to accurately describe in type
949
- * systems like TypeScript. It requires generics and an `extends` operator
950
- * that TypeScript lacks. Therefore it's recommended that the return type is
951
- * left empty. The most common form of a mixin function takes a single
952
- * argument, so consumers of this interface should assume that the return type
953
- * is the single argument subclassed by this declaration.
954
- *
955
- * A mixin should not have a superclass. If a mixins composes other mixins,
956
- * they should be listed in the `mixins` field.
957
- *
958
- * See more information on the class mixin pattern in JavaScript:
959
- * https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/
960
- *
961
- * @example
962
- *
963
- * This JavaScript mixin declaration:
964
- * ```javascript
965
- * const MyMixin = (base) => class extends base {
966
- * foo() { ... }
967
- * }
968
- * ```
969
- *
970
- * Is described by this JSON:
971
- * ```json
972
- * {
973
- * "kind": "mixin",
974
- * "name": "MyMixin",
975
- * "parameters": [
976
- * {
977
- * "name": "base",
978
- * }
979
- * ],
980
- * "members": [
981
- * {
982
- * "kind": "method",
983
- * "name": "foo",
984
- * }
985
- * ]
986
- * }
987
- * ```
988
- *
989
840
  * @remarks
990
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
991
- * with custom-elements-manifest.
841
+ * Not present in vanilla custom-elements-manifest.
992
842
  */
993
- export type ApiMixinDeclaration = ApiClassDeclaration & ApiFunctionLike & {
994
- kind: "mixin";
995
- };
843
+ export interface ApiClassConstructor extends Omit<ApiFunctionLike, "name" | "return">, ApiWithInheritance, ApiWithPrivacy {
844
+ kind: "constructor";
845
+ }
996
846
  /**
997
- * A class mixin that also adds custom element related properties.
998
- *
999
847
  * @remarks
1000
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
1001
- * with custom-elements-manifest.
848
+ * Not present in vanilla custom-elements-manifest.
1002
849
  */
1003
- export type ApiCustomElementMixinDeclaration = ApiCustomElementDeclaration & ApiMixinDeclaration;
850
+ export interface ApiClassCallSignature extends Omit<ApiFunctionLike, "name">, ApiWithInheritance, ApiWithPrivacy {
851
+ kind: "call-signature";
852
+ }
1004
853
  /**
1005
- * @remarks
1006
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
1007
- * with custom-elements-manifest.
854
+ * A description of a class mixin.
855
+ *
856
+ * @see https://webgis.esri.com/webgis/core/core/mixins
1008
857
  */
1009
- export type ApiVariableDeclaration = ApiPropertyLike & {
1010
- kind: "variable";
1011
- source?: ApiSourceReference;
1012
- };
858
+ export interface ApiMixinDeclaration extends Omit<ApiFunctionLike, "return">, ApiObjectLikeDeclaration, ApiWithEvents {
859
+ kind: "mixin";
860
+ /**
861
+ * The mixins that this mixin uses, if any.
862
+ */
863
+ mixins?: ApiReferenceWithTypeArguments[];
864
+ /**
865
+ * @deprecated
866
+ * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
867
+ * with custom-elements-manifest.
868
+ */
869
+ return?: ApiFunctionLikeReturn;
870
+ }
1013
871
  /**
1014
- * @remarks
872
+ * A class mixin that also adds custom element related properties.
873
+ *
874
+ * @deprecated
1015
875
  * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
1016
876
  * with custom-elements-manifest.
1017
877
  */
1018
- export type ApiFunctionDeclaration = ApiFunctionLike & {
878
+ export interface ApiCustomElementMixinDeclaration extends Omit<ApiCustomElementDeclaration, "kind">, Omit<ApiMixinDeclaration, "members"> {
879
+ }
880
+ export interface ApiVariableDeclaration extends ApiPropertyLike, ApiWithUnusedSource {
881
+ kind: "variable";
882
+ }
883
+ export interface ApiFunctionDeclaration extends ApiFunctionLike, ApiWithUnusedSource {
1019
884
  kind: "function";
1020
- source?: ApiSourceReference;
1021
- };
1022
- export type ApiParameter = ApiPropertyLike & {
885
+ }
886
+ export interface ApiParameter extends ApiPropertyLike {
1023
887
  /**
1024
888
  * Whether the parameter is optional.
1025
889
  *
1026
890
  * @default false
1027
891
  */
1028
- optional?: boolean;
892
+ optional?: true;
1029
893
  /**
1030
894
  * @default false
1031
895
  *
1032
896
  * Whether the parameter is a rest parameter. Only the last parameter may be a rest parameter.
1033
897
  * Undefined implies single parameter.
1034
898
  */
1035
- rest?: boolean;
1036
- };
1037
- export type ApiFunctionLike = {
899
+ rest?: true;
900
+ }
901
+ export interface ApiFunctionLike extends ApiWithDescription, ApiWithDocsTags, ApiWithDeprecated, ApiWithUnusedSummary, ApiWithTypeParameters {
1038
902
  /**
1039
903
  * @example "increment"
904
+ * @example Special names appear unquoted and unescaped: "@eventTypes"
905
+ * @example Computed Symbol properties appear as "[Symbol.iterator]"
1040
906
  */
1041
907
  name: string;
1042
- /**
1043
- * A markdown summary suitable for display in a listing.
1044
- *
1045
- * @remarks
1046
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
1047
- * with custom-elements-manifest.
1048
- */
1049
- summary?: string;
1050
- /**
1051
- * A markdown description.
1052
- */
1053
- description?: string;
1054
- /**
1055
- * Whether the function is deprecated.
1056
- * If the value is a string, it's the reason for the deprecation.
1057
- *
1058
- * @default false
1059
- */
1060
- deprecated?: boolean | string;
1061
908
  /**
1062
909
  * @default []
1063
910
  */
1064
911
  parameters?: ApiParameter[];
1065
- return?: {
1066
- type?: ApiType;
1067
- /**
1068
- * A markdown summary suitable for display in a listing.
1069
- *
1070
- * @remarks
1071
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
1072
- * with custom-elements-manifest.
1073
- */
1074
- summary?: string;
1075
- /**
1076
- * A markdown description.
1077
- */
1078
- description?: string;
1079
- };
1080
- };
1081
- /**
1082
- * @remarks
1083
- * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
1084
- * with custom-elements-manifest.
1085
- */
1086
- export type ApiPrivacy = "private" | "protected" | "public";
1087
- export type ApiDemo = {
1088
- /**
1089
- * A markdown description of the demo.
1090
- */
1091
- description: string;
912
+ return: ApiFunctionLikeReturn;
913
+ }
914
+ export interface ApiFunctionLikeReturn extends ApiWithDescription, ApiWithUnusedSummary {
915
+ type: ApiType;
916
+ }
917
+ export interface ApiDemo extends ApiWithUnusedSource {
1092
918
  /**
1093
919
  * Relative URL of the demo if it's published with the package. Absolute URL
1094
920
  * if it's hosted.
1095
921
  */
1096
922
  url: string;
1097
- source?: ApiSourceReference;
1098
- };
923
+ description: NonNullable<ApiWithDescription["description"]>;
924
+ }