fix(ivy): ngcc should not emit TypeScript syntax (#27051)
If a template contains specific TypeScript syntax, such as a non-null assertion, the code that is emitted from ngcc into a JavaScript bundle should not retain such syntax as it is invalid in JS. A full-blown TypeScript emit of a complete ts.SourceFile would be required to be able to emit JS and possibly downlevel into a lower language target, which is not an option for ngcc as it currently operates on partial ASTs, not full source files. Instead, ngtsc no longer produces TypeScript specific syntax in the first place, such that TypeScript print logic will only generate JS code. PR Close #27051
This commit is contained in:
@ -252,7 +252,7 @@ class ExpressionTranslatorVisitor implements ExpressionVisitor, StatementVisitor
|
||||
}
|
||||
|
||||
visitAssertNotNullExpr(ast: AssertNotNull, context: Context): ts.NonNullExpression {
|
||||
return ts.createNonNullExpression(ast.condition.visitExpression(this, context));
|
||||
return ast.condition.visitExpression(this, context);
|
||||
}
|
||||
|
||||
visitCastExpr(ast: CastExpr, context: Context): ts.Expression {
|
||||
|
Reference in New Issue
Block a user