refactor(core): imrove ReplaceableTemplateDirective data type

#2404
pull/2522/head
mehmet-erim 6 years ago
parent 2239d010d4
commit 8f78d2371b

@ -24,7 +24,7 @@ import snq from 'snq';
@Directive({ selector: '[abpReplaceableTemplate]' })
export class ReplaceableTemplateDirective implements OnInit, OnDestroy, OnChanges {
@Input('abpReplaceableTemplate')
data: { inputs: any; outputs: any; componentKey: string };
data: ReplaceableComponents.ReplaceableTemplateDirectiveInput<any, any>;
providedData = { inputs: {}, outputs: {} } as ReplaceableComponents.ReplaceableTemplateData<
any,

@ -12,6 +12,15 @@ export namespace ReplaceableComponents {
key: string;
}
export interface ReplaceableTemplateDirectiveInput<
I,
O extends { [K in keyof O]: EventEmitter<any> | Subject<any> }
> {
inputs: { -readonly [K in keyof I]: { value: I[K]; twoWay?: boolean } };
outputs: { -readonly [K in keyof O]: (value: ABP.ExtractFromOutput<O[K]>) => void };
componentKey: string;
}
export interface ReplaceableTemplateData<
I,
O extends { [K in keyof O]: EventEmitter<any> | Subject<any> }

Loading…
Cancel
Save