File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
etc/api/angular_devkit/schematics/src
packages/angular_devkit/schematics/src Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -426,7 +426,7 @@ export interface RequiredWorkflowExecutionContext {
426426 schematic : string ;
427427}
428428
429- export declare type Rule = ( tree : Tree , context : SchematicContext ) => Tree | Observable < Tree > | Rule | Promise < void > | void ;
429+ export declare type Rule = ( tree : Tree , context : SchematicContext ) => Tree | Observable < Tree > | Rule | Promise < void > | Promise < Rule > | void ;
430430
431431export declare type RuleFactory < T extends object > = ( options : T ) => Rule ;
432432
Original file line number Diff line number Diff line change @@ -231,4 +231,4 @@ export type AsyncFileOperator = (tree: FileEntry) => Observable<FileEntry | null
231231 */
232232export type Source = ( context : SchematicContext ) => Tree | Observable < Tree > ;
233233export type Rule = ( tree : Tree , context : SchematicContext ) =>
234- Tree | Observable < Tree > | Rule | Promise < void > | void ;
234+ Tree | Observable < Tree > | Rule | Promise < void > | Promise < Rule > | void ;
Original file line number Diff line number Diff line change @@ -97,7 +97,16 @@ export function callRule(
9797 } ) ,
9898 ) ;
9999 } else if ( isPromise ( result ) ) {
100- return from ( result ) . pipe ( map ( ( ) => inputTree ) ) ;
100+ return from ( result ) . pipe (
101+ mergeMap ( inner => {
102+ if ( typeof inner === 'function' ) {
103+ // This is considered a Rule, chain the rule and return its output.
104+ return callRule ( inner , observableOf ( inputTree ) , context ) ;
105+ } else {
106+ return observableOf ( inputTree ) ;
107+ }
108+ } ) ,
109+ ) ;
101110 } else if ( TreeSymbol in result ) {
102111 return observableOf ( result ) ;
103112 } else {
You can’t perform that action at this time.
0 commit comments