From 19d4fa78b68f243591b99f13a9f1d9271ce2ff58 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Sat, 18 Apr 2026 09:31:19 +0200 Subject: [PATCH] refactor(cdk/schematics): clean up TypeScript 6 workaround Removes a workaround that was put in place to unblock the TypeScript 6 upgrade. --- src/cdk/schematics/utils/ast.ts | 14 +------------- src/cdk/schematics/utils/build-component.ts | 5 ++--- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/cdk/schematics/utils/ast.ts b/src/cdk/schematics/utils/ast.ts index 5bb8a7727f06..c266cea201b6 100644 --- a/src/cdk/schematics/utils/ast.ts +++ b/src/cdk/schematics/utils/ast.ts @@ -16,13 +16,6 @@ import {getAppModulePath} from '@schematics/angular/utility/ng-ast-utils'; import * as ts from 'typescript'; import {getProjectMainFile} from './project-main-file'; -/** - * Temporary type until the CLI starts bundling TS6. - * - * TODO(crisbeto): clean this up eventually. - */ -export type AnyDuringTs6Migration = any; - /** Reads file given path and returns TypeScript source file. */ export function parseSourceFile(host: Tree, path: string): ts.SourceFile { const buffer = host.read(path); @@ -62,12 +55,7 @@ export function addModuleImportToModule( throw new SchematicsException(`Module not found: ${modulePath}`); } - const changes = addImportToModule( - moduleSource as AnyDuringTs6Migration, - modulePath, - moduleName, - src, - ); + const changes = addImportToModule(moduleSource, modulePath, moduleName, src); const recorder = host.beginUpdate(modulePath); changes.forEach(change => { diff --git a/src/cdk/schematics/utils/build-component.ts b/src/cdk/schematics/utils/build-component.ts index 595672cc6159..1e1433266e16 100644 --- a/src/cdk/schematics/utils/build-component.ts +++ b/src/cdk/schematics/utils/build-component.ts @@ -36,7 +36,6 @@ import {dirname, join, resolve} from 'path'; import * as ts from 'typescript'; import {getProjectFromWorkspace} from './get-project'; import {getDefaultComponentOptions, isStandaloneSchematic} from './schematic-options'; -import {AnyDuringTs6Migration} from './ast'; /** * Build a default project path for generating. @@ -84,7 +83,7 @@ function addDeclarationToNgModule(options: ComponentOptions): Rule { const classifiedName = strings.classify(`${options.name}Component`); const declarationChanges = addDeclarationToModule( - source as AnyDuringTs6Migration, + source, modulePath, classifiedName, relativePath, @@ -104,7 +103,7 @@ function addDeclarationToNgModule(options: ComponentOptions): Rule { const exportRecorder = host.beginUpdate(modulePath); const exportChanges = addExportToModule( - source as AnyDuringTs6Migration, + source, modulePath, strings.classify(`${options.name}Component`), relativePath,