11// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22// See LICENSE in the project root for license information.
33
4- import { Deserializer } from './Deserializer' ;
5-
64export const enum ApiItemKind {
75 Class = 'Class' ,
86 EntryPoint = 'EntryPoint' ,
97 Method = 'Method' ,
108 Model = 'Model' ,
119 Namespace = 'Namespace' ,
1210 Package = 'Package' ,
13- Parameter = 'Parameter'
11+ Parameter = 'Parameter' ,
12+ None = 'None'
1413}
1514
1615export interface IApiItemParameters {
@@ -24,14 +23,11 @@ export interface ISerializedMetadata {
2423
2524export type SerializedApiItem < T extends IApiItemParameters > = T & ISerializedMetadata ;
2625
27- export abstract class ApiItem {
28- public abstract readonly kind : ApiItemKind ;
29-
30- private _members : ApiItem [ ] ;
31- private _name : string ;
32- private _membersSorted : boolean ;
26+ export class ApiItem {
27+ private readonly _name : string ;
3328
3429 public static deserialize ( jsonObject : SerializedApiItem < IApiItemParameters > ) : ApiItem {
30+ // tslint:disable-next-line:no-use-before-declare
3531 return Deserializer . deserialize ( jsonObject ) ;
3632 }
3733
@@ -57,19 +53,21 @@ export abstract class ApiItem {
5753 return this . _name ;
5854 }
5955
60- public addMember ( member : ApiItem ) : void {
61- this . _members . push ( member ) ;
62- this . _membersSorted = false ;
63- }
64-
56+ /** @virtual */
6557 public get members ( ) : ReadonlyArray < ApiItem > {
66- if ( ! this . _membersSorted ) {
67- this . _members . sort ( ( x , y ) => x . getSortKey ( ) . localeCompare ( y . getSortKey ( ) ) ) ;
68- this . _membersSorted = true ;
69- }
58+ return [ ] ;
59+ }
7060
71- return this . _members ;
61+ /** @virtual */
62+ public get kind ( ) : ApiItemKind {
63+ throw new Error ( 'ApiItem.kind was not implemented by the child class' ) ;
7264 }
7365
74- protected abstract getSortKey ( ) : string ;
66+ /** @virtual */
67+ public getSortKey ( ) : string {
68+ throw new Error ( 'ApiItem.getSortKey was not implemented by the child class' ) ;
69+ }
7570}
71+
72+ // Circular import
73+ import { Deserializer } from './Deserializer' ;
0 commit comments