refactor(migrations): remove rxjs usage within static queries migration (#38657)

rxjs was only used within one location within the static queries migration to workaround
a previous limitation that schematics could not directly use a promise.  However, promise
support has been available since 8.0.  This change removes the observable promise wrapping.
It also removes an any cast that was previously needed to workaround rxjs version mismatches
during compilation.

PR Close #38657
This commit is contained in:
Charles Lyding 2020-08-31 17:21:25 -04:00 committed by Jessica Janiuk
parent 575a2d162c
commit 2b2a847ad7
1 changed files with 1 additions and 6 deletions

View File

@ -9,7 +9,6 @@
import {logging} from '@angular-devkit/core'; import {logging} from '@angular-devkit/core';
import {Rule, SchematicContext, SchematicsException, Tree} from '@angular-devkit/schematics'; import {Rule, SchematicContext, SchematicsException, Tree} from '@angular-devkit/schematics';
import {relative} from 'path'; import {relative} from 'path';
import {from} from 'rxjs';
import * as ts from 'typescript'; import * as ts from 'typescript';
import {NgComponentTemplateVisitor} from '../../utils/ng_component_template'; import {NgComponentTemplateVisitor} from '../../utils/ng_component_template';
@ -41,11 +40,7 @@ interface AnalyzedProject {
/** Entry point for the V8 static-query migration. */ /** Entry point for the V8 static-query migration. */
export default function(): Rule { export default function(): Rule {
return (tree: Tree, context: SchematicContext) => { return runMigration;
// We need to cast the returned "Observable" to "any" as there is a
// RxJS version mismatch that breaks the TS compilation.
return from(runMigration(tree, context).then(() => tree)) as any;
};
} }
/** Runs the V8 migration static-query migration for all determined TypeScript projects. */ /** Runs the V8 migration static-query migration for all determined TypeScript projects. */