Skip to content

Commit

Permalink
fix(compiler): resolve deprecation warning (#48652)
Browse files Browse the repository at this point in the history
Fixes a deprecation warning that was being logged by compiler when generating aliases, because we weren't going through `ts.factory` to create an AST node.

PR Close #48652
  • Loading branch information
crisbeto authored and alxhub committed Jan 10, 2023
1 parent 896c04f commit caf7228
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/compiler-cli/src/ngtsc/transform/src/alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ts from 'typescript';

export function aliasTransformFactory(exportStatements: Map<string, Map<string, [string, string]>>):
ts.TransformerFactory<ts.SourceFile> {
return (context: ts.TransformationContext) => {
return () => {
return (file: ts.SourceFile) => {
if (ts.isBundle(file) || !exportStatements.has(file.fileName)) {
return file;
Expand All @@ -19,10 +19,9 @@ export function aliasTransformFactory(exportStatements: Map<string, Map<string,
const statements = [...file.statements];
exportStatements.get(file.fileName)!.forEach(([moduleName, symbolName], aliasName) => {
const stmt = ts.factory.createExportDeclaration(
/* decorators */ undefined,
/* modifiers */ undefined,
/* isTypeOnly */ false,
/* exportClause */ ts.createNamedExports([ts.factory.createExportSpecifier(
/* exportClause */ ts.factory.createNamedExports([ts.factory.createExportSpecifier(
false, symbolName, aliasName)]),
/* moduleSpecifier */ ts.factory.createStringLiteral(moduleName));
statements.push(stmt);
Expand Down

0 comments on commit caf7228

Please sign in to comment.