Skip to content

Commit 9ac46d8

Browse files
committed
fix(material/schematics): add string literal check (#26475)
* related to issue #26038 (cherry picked from commit 834e865)
1 parent 8465f9e commit 9ac46d8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/material/schematics/ng-generate/mdc-migration/rules/ts-migration/runtime-migration.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ export class RuntimeCodeMigration extends Migration<ComponentMigrator[], Schemat
204204
}
205205

206206
node.initializer.forEachChild(stringLiteralNode => {
207-
this._migratePropertyAssignment(stringLiteralNode as ts.StringLiteral, this._stylesMigration);
207+
if (ts.isStringLiteralLike(stringLiteralNode)) {
208+
this._migratePropertyAssignment(stringLiteralNode, this._stylesMigration);
209+
}
208210
});
209211
}
210212

@@ -231,7 +233,9 @@ export class RuntimeCodeMigration extends Migration<ComponentMigrator[], Schemat
231233
}
232234
}
233235

234-
this._migratePropertyAssignment(node.initializer as ts.StringLiteral, this._templateMigration);
236+
if (ts.isStringLiteralLike(node.initializer)) {
237+
this._migratePropertyAssignment(node.initializer, this._templateMigration);
238+
}
235239
}
236240

237241
private _migratePropertyAssignment(

0 commit comments

Comments
 (0)