Skip to content

Commit

Permalink
Merge a5f0643 into 4f9584c
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondfeng committed Jun 1, 2020
2 parents 4f9584c + a5f0643 commit 9a40399
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
5 changes: 5 additions & 0 deletions packages/boot/src/mixins/boot.mixin.ts
Expand Up @@ -45,6 +45,11 @@ export {Binding};
* - Provides the `booter()` convenience method to bind a Booter(s) to the Application
* - Override `component()` to call `mountComponentBooters`
* - Adds `mountComponentBooters` which binds Booters to the application from `component.booters[]`
*
* @param superClass - Application class
* @returns A new class that extends the super class with boot related methods
*
* @typeParam T - Type of the application class as the target for the mixin
*/
export function BootMixin<T extends MixinTarget<Application>>(superClass: T) {
return class extends superClass implements Bootable {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/mixin-target.ts
Expand Up @@ -26,6 +26,7 @@ import {Constructor} from '@loopback/context';
* the base class. You can use the following approach as a workaround:
*
* ```ts
* // eslint-disable-next-line @typescript-eslint/ban-ts-comment
* // @ts-ignore
* (this as unknown as {YourBaseClass}).protectedMember
* ```
Expand Down
6 changes: 6 additions & 0 deletions packages/repository/src/mixins/repository.mixin.ts
Expand Up @@ -44,6 +44,12 @@ import * as loopbackCore from '@loopback/core';
* Please note: the members in the mixin function are documented in a dummy class
* called <a href="#RepositoryMixinDoc">RepositoryMixinDoc</a>
*
* @param superClass - Application class
* @returns A new class that extends the super class with repository related
* methods
*
* @typeParam T - Type of the application class as the target for the mixin
*
*/
export function RepositoryMixin<T extends MixinTarget<Application>>(
superClass: T,
Expand Down
20 changes: 14 additions & 6 deletions packages/service-proxy/src/mixins/service.mixin.ts
Expand Up @@ -45,6 +45,11 @@ export interface Class<T> {
* Please note: the members in the mixin function are documented in a dummy class
* called <a href="#ServiceMixinDoc">ServiceMixinDoc</a>
*
* @param superClass - Application class
* @returns A new class that extends the super class with service proxy related
* methods
*
* @typeParam T - Type of the application class as the target for the mixin
*/
export function ServiceMixin<T extends MixinTarget<Application>>(
superClass: T,
Expand Down Expand Up @@ -146,9 +151,12 @@ export function ServiceMixin<T extends MixinTarget<Application>>(
* Interface for an Application mixed in with ServiceMixin
*/
export interface ApplicationWithServices extends Application {
serviceProvider<S>(provider: Class<Provider<S>>, name?: string): Binding<S>;
component(component: Class<{}>, name?: string): Binding;
mountComponentServices(component: Class<{}>): void;
serviceProvider<S>(
provider: Constructor<Provider<S>>,
name?: string,
): Binding<S>;
component(component: Constructor<{}>, name?: string): Binding;
mountComponentServices(component: Constructor<{}>): void;
}

/**
Expand Down Expand Up @@ -191,7 +199,7 @@ export class ServiceMixinDoc {
* app.serviceProvider(GeocoderServiceProvider);
* ```
*/
serviceProvider<S>(provider: Class<Provider<S>>): Binding<S> {
serviceProvider<S>(provider: Constructor<Provider<S>>): Binding<S> {
throw new Error();
}

Expand All @@ -216,7 +224,7 @@ export class ServiceMixinDoc {
* app.component(ProductComponent);
* ```
*/
public component(component: Class<unknown>): Binding {
public component(component: Constructor<unknown>): Binding {
throw new Error();
}

Expand All @@ -227,5 +235,5 @@ export class ServiceMixinDoc {
*
* @param component - The component to mount services of
*/
mountComponentServices(component: Class<unknown>) {}
mountComponentServices(component: Constructor<unknown>) {}
}

0 comments on commit 9a40399

Please sign in to comment.