type()

in src/Package.ts [133:146]


  type(ServiceTypeOrName: string | TypeDef, ServiceType?: TypeDef) {
    let name;
    if ( typeof ServiceTypeOrName === 'string' ) {
      name = ServiceTypeOrName;
    } else {
      ServiceType = ServiceTypeOrName;
      if (!ServiceType.name) { throw new Error('ServiceType must have a name'); }
      name = ServiceType.name;
    }
    if (typeof ServiceType !== 'function' ) { throw new Error('ServiceType must be a constructor function'); }

    this.module[name] = ['type', ServiceType];
    return this;
  }