Skip to content

Commit 677972a

Browse files
authored
refactor(cdk/schematics): clean up TypeScript 6 workaround (#33104)
Removes a workaround that was put in place to unblock the TypeScript 6 upgrade.
1 parent c512555 commit 677972a

2 files changed

Lines changed: 3 additions & 16 deletions

File tree

src/cdk/schematics/utils/ast.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ import {getAppModulePath} from '@schematics/angular/utility/ng-ast-utils';
1616
import * as ts from 'typescript';
1717
import {getProjectMainFile} from './project-main-file';
1818

19-
/**
20-
* Temporary type until the CLI starts bundling TS6.
21-
*
22-
* TODO(crisbeto): clean this up eventually.
23-
*/
24-
export type AnyDuringTs6Migration = any;
25-
2619
/** Reads file given path and returns TypeScript source file. */
2720
export function parseSourceFile(host: Tree, path: string): ts.SourceFile {
2821
const buffer = host.read(path);
@@ -62,12 +55,7 @@ export function addModuleImportToModule(
6255
throw new SchematicsException(`Module not found: ${modulePath}`);
6356
}
6457

65-
const changes = addImportToModule(
66-
moduleSource as AnyDuringTs6Migration,
67-
modulePath,
68-
moduleName,
69-
src,
70-
);
58+
const changes = addImportToModule(moduleSource, modulePath, moduleName, src);
7159
const recorder = host.beginUpdate(modulePath);
7260

7361
changes.forEach(change => {

src/cdk/schematics/utils/build-component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import {dirname, join, resolve} from 'path';
3636
import * as ts from 'typescript';
3737
import {getProjectFromWorkspace} from './get-project';
3838
import {getDefaultComponentOptions, isStandaloneSchematic} from './schematic-options';
39-
import {AnyDuringTs6Migration} from './ast';
4039

4140
/**
4241
* Build a default project path for generating.
@@ -84,7 +83,7 @@ function addDeclarationToNgModule(options: ComponentOptions): Rule {
8483
const classifiedName = strings.classify(`${options.name}Component`);
8584

8685
const declarationChanges = addDeclarationToModule(
87-
source as AnyDuringTs6Migration,
86+
source,
8887
modulePath,
8988
classifiedName,
9089
relativePath,
@@ -104,7 +103,7 @@ function addDeclarationToNgModule(options: ComponentOptions): Rule {
104103

105104
const exportRecorder = host.beginUpdate(modulePath);
106105
const exportChanges = addExportToModule(
107-
source as AnyDuringTs6Migration,
106+
source,
108107
modulePath,
109108
strings.classify(`${options.name}Component`),
110109
relativePath,

0 commit comments

Comments
 (0)