@angular/compiler-cli 21.2.1 → 22.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/bundles/{chunk-WBUBKNAO.js → chunk-CNKW2AJK.js} +1 -1
  2. package/bundles/chunk-FLWAEX6T.js +1 -1
  3. package/bundles/{chunk-VO3Q626H.js → chunk-S54YHUIA.js} +2 -2
  4. package/bundles/{chunk-IG22BDVK.js → chunk-V5JJK5O4.js} +876 -1172
  5. package/bundles/{chunk-PW54LIP6.js → chunk-WI7ANR5X.js} +1 -1
  6. package/bundles/index.js +4 -4
  7. package/bundles/private/migrations.js +2 -2
  8. package/bundles/private/testing.js +1 -1
  9. package/bundles/private/tooling.js +1 -1
  10. package/bundles/src/bin/ng_xi18n.js +4 -4
  11. package/bundles/src/bin/ngc.js +4 -4
  12. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  13. package/package.json +3 -3
  14. package/src/ngtsc/diagnostics/src/error_code.d.ts +4 -0
  15. package/src/ngtsc/typecheck/src/comments.d.ts +0 -7
  16. package/src/ngtsc/typecheck/src/environment.d.ts +7 -6
  17. package/src/ngtsc/typecheck/src/expression.d.ts +3 -15
  18. package/src/ngtsc/typecheck/src/host_bindings.d.ts +1 -1
  19. package/src/ngtsc/typecheck/src/ops/base.d.ts +3 -3
  20. package/src/ngtsc/typecheck/src/ops/bindings.d.ts +8 -3
  21. package/src/ngtsc/typecheck/src/ops/codegen.d.ts +74 -0
  22. package/src/ngtsc/typecheck/src/ops/context.d.ts +1 -2
  23. package/src/ngtsc/typecheck/src/ops/directive_constructor.d.ts +3 -3
  24. package/src/ngtsc/typecheck/src/ops/directive_type.d.ts +4 -4
  25. package/src/ngtsc/typecheck/src/ops/element.d.ts +2 -2
  26. package/src/ngtsc/typecheck/src/ops/events.d.ts +2 -2
  27. package/src/ngtsc/typecheck/src/ops/expression.d.ts +5 -5
  28. package/src/ngtsc/typecheck/src/ops/for_block.d.ts +2 -2
  29. package/src/ngtsc/typecheck/src/ops/host.d.ts +2 -2
  30. package/src/ngtsc/typecheck/src/ops/inputs.d.ts +2 -2
  31. package/src/ngtsc/typecheck/src/ops/let.d.ts +2 -2
  32. package/src/ngtsc/typecheck/src/ops/references.d.ts +3 -3
  33. package/src/ngtsc/typecheck/src/ops/schema.d.ts +2 -2
  34. package/src/ngtsc/typecheck/src/ops/scope.d.ts +9 -9
  35. package/src/ngtsc/typecheck/src/ops/selectorless.d.ts +2 -2
  36. package/src/ngtsc/typecheck/src/ops/template.d.ts +2 -2
  37. package/src/ngtsc/typecheck/src/ops/variables.d.ts +6 -6
  38. package/src/ngtsc/typecheck/src/reference_emit_environment.d.ts +2 -5
  39. package/src/ngtsc/typecheck/src/ts_util.d.ts +0 -37
  40. package/src/ngtsc/typecheck/src/type_check_block.d.ts +1 -1
  41. package/src/ngtsc/typecheck/src/type_check_file.d.ts +3 -2
  42. package/src/ngtsc/typecheck/src/type_constructor.d.ts +3 -2
@@ -34,6 +34,7 @@ var ErrorCode;
34
34
  ErrorCode2[ErrorCode2["INITIALIZER_API_DECORATOR_METADATA_COLLISION"] = 1051] = "INITIALIZER_API_DECORATOR_METADATA_COLLISION";
35
35
  ErrorCode2[ErrorCode2["INITIALIZER_API_NO_REQUIRED_FUNCTION"] = 1052] = "INITIALIZER_API_NO_REQUIRED_FUNCTION";
36
36
  ErrorCode2[ErrorCode2["INITIALIZER_API_DISALLOWED_MEMBER_VISIBILITY"] = 1053] = "INITIALIZER_API_DISALLOWED_MEMBER_VISIBILITY";
37
+ ErrorCode2[ErrorCode2["DUPLICATE_BINDING_NAME"] = 1054] = "DUPLICATE_BINDING_NAME";
37
38
  ErrorCode2[ErrorCode2["INCORRECTLY_DECLARED_ON_STATIC_MEMBER"] = 1100] = "INCORRECTLY_DECLARED_ON_STATIC_MEMBER";
38
39
  ErrorCode2[ErrorCode2["COMPONENT_MISSING_TEMPLATE"] = 2001] = "COMPONENT_MISSING_TEMPLATE";
39
40
  ErrorCode2[ErrorCode2["PIPE_MISSING_NAME"] = 2002] = "PIPE_MISSING_NAME";
@@ -229,7 +230,7 @@ var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
229
230
  import { VERSION } from "@angular/compiler";
230
231
  var DOC_PAGE_BASE_URL = (() => {
231
232
  const full = VERSION.full;
232
- const isPreRelease = full.includes("-next") || full.includes("-rc") || full === "21.2.1";
233
+ const isPreRelease = full.includes("-next") || full.includes("-rc") || full === "22.0.0-next.1";
233
234
  const prefix = isPreRelease ? "next" : `v${VERSION.major}`;
234
235
  return `https://${prefix}.angular.dev`;
235
236
  })();
@@ -7013,6 +7014,7 @@ function insertDebugNameIntoCallExpression(node, debugName) {
7013
7014
  return ts32.factory.updateCallExpression(node, node.expression, node.typeArguments, newArgs);
7014
7015
  }
7015
7016
  function createNgDevModeConditional(devModeExpression, prodModeExpression) {
7017
+ ts32.addSyntheticLeadingComment(prodModeExpression, ts32.SyntaxKind.MultiLineCommentTrivia, " istanbul ignore next ", false);
7016
7018
  return ts32.factory.createParenthesizedExpression(ts32.factory.createConditionalExpression(ts32.factory.createIdentifier("ngDevMode"), void 0, devModeExpression, void 0, prodModeExpression));
7017
7019
  }
7018
7020
  function isVariableDeclarationCase(node) {
@@ -8786,12 +8788,19 @@ function tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTr
8786
8788
  }
8787
8789
  function parseInputFields(clazz, members, evaluator, reflector, importTracker, refEmitter, isCore, compilationMode, inputsFromClassDecorator, classDecorator, emitDeclarationOnly) {
8788
8790
  const inputs = {};
8791
+ const bindings = /* @__PURE__ */ new Map();
8789
8792
  for (const member of members) {
8790
8793
  const classPropertyName = member.name;
8791
8794
  const inputMapping = tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTracker, isCore, refEmitter, compilationMode, emitDeclarationOnly);
8792
8795
  if (inputMapping === null) {
8793
8796
  continue;
8794
8797
  }
8798
+ const bindingPropertyName = inputMapping.bindingPropertyName;
8799
+ if (bindings.has(bindingPropertyName)) {
8800
+ const firstMember = bindings.get(bindingPropertyName);
8801
+ throw new FatalDiagnosticError(ErrorCode.DUPLICATE_BINDING_NAME, member.node ?? clazz, `Input '${bindingPropertyName}' is bound to both '${firstMember.name}' and '${member.name}'.`, [makeRelatedInformation(firstMember.node ?? clazz, `The first binding is declared here.`)]);
8802
+ }
8803
+ bindings.set(bindingPropertyName, member);
8795
8804
  if (member.isStatic) {
8796
8805
  throw new FatalDiagnosticError(ErrorCode.INCORRECTLY_DECLARED_ON_STATIC_MEMBER, member.node ?? clazz, `Input "${member.name}" is incorrectly declared as static member of "${clazz.name.text}".`);
8797
8806
  }
@@ -8953,6 +8962,7 @@ function parseOutputsArray(directive, evaluator) {
8953
8962
  }
8954
8963
  function parseOutputFields(clazz, classDecorator, members, isCore, reflector, importTracker, evaluator, outputsFromMeta) {
8955
8964
  const outputs = {};
8965
+ const bindings = /* @__PURE__ */ new Map();
8956
8966
  for (const member of members) {
8957
8967
  const decoratorOutput = tryParseDecoratorOutput(member, evaluator, isCore);
8958
8968
  const initializerOutput = tryParseInitializerBasedOutput(member, reflector, importTracker);
@@ -8977,6 +8987,11 @@ function parseOutputFields(clazz, classDecorator, members, isCore, reflector, im
8977
8987
  } else {
8978
8988
  continue;
8979
8989
  }
8990
+ if (bindings.has(bindingPropertyName)) {
8991
+ const firstMember = bindings.get(bindingPropertyName);
8992
+ throw new FatalDiagnosticError(ErrorCode.DUPLICATE_BINDING_NAME, member.node ?? clazz, `Output '${bindingPropertyName}' is bound to both '${firstMember.name}' and '${member.name}'.`, [makeRelatedInformation(firstMember.node ?? clazz, `The first binding is declared here.`)]);
8993
+ }
8994
+ bindings.set(bindingPropertyName, member);
8980
8995
  if ((initializerOutput !== null || modelMapping !== null) && outputsFromMeta.hasOwnProperty(member.name)) {
8981
8996
  throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_DECORATOR_METADATA_COLLISION, member.node ?? clazz, `Output "${member.name}" is unexpectedly declared in @${classDecorator.name} as well.`);
8982
8997
  }
@@ -9836,7 +9851,7 @@ function _extractTemplateStyleUrls(template) {
9836
9851
 
9837
9852
  // packages/compiler-cli/src/ngtsc/annotations/component/src/handler.js
9838
9853
  import { compileClassDebugInfo, compileHmrInitializer, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareComponentFromMetadata, compileDeferResolverFunction, ConstantPool as ConstantPool2, CssSelector as CssSelector5, DomElementSchemaRegistry as DomElementSchemaRegistry3, ExternalExpr as ExternalExpr10, FactoryTarget as FactoryTarget3, makeBindingParser as makeBindingParser3, outputAst as o5, R3TargetBinder as R3TargetBinder2, R3TemplateDependencyKind, SelectorMatcher as SelectorMatcher3, ViewEncapsulation as ViewEncapsulation2, SelectorlessMatcher as SelectorlessMatcher2 } from "@angular/compiler";
9839
- import ts94 from "typescript";
9854
+ import ts79 from "typescript";
9840
9855
 
9841
9856
  // packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.js
9842
9857
  import ts43 from "typescript";
@@ -10954,8 +10969,8 @@ var TypeCheckScopeRegistry = class {
10954
10969
  };
10955
10970
 
10956
10971
  // packages/compiler-cli/src/ngtsc/annotations/directive/src/handler.js
10957
- import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, FactoryTarget, makeBindingParser as makeBindingParser2, R3TargetBinder, WrappedNodeExpr as WrappedNodeExpr9 } from "@angular/compiler";
10958
- import ts87 from "typescript";
10972
+ import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, FactoryTarget, makeBindingParser as makeBindingParser2, R3TargetBinder, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
10973
+ import ts72 from "typescript";
10959
10974
 
10960
10975
  // packages/compiler-cli/src/ngtsc/annotations/directive/src/symbol.js
10961
10976
  var DirectiveSymbol = class _DirectiveSymbol extends SemanticSymbol {
@@ -11044,7 +11059,7 @@ function isBaseClassEqual(current, previous) {
11044
11059
  }
11045
11060
 
11046
11061
  // packages/compiler-cli/src/ngtsc/typecheck/src/checker.js
11047
- import { CssSelector as CssSelector4, DomElementSchemaRegistry as DomElementSchemaRegistry2, ExternalExpr as ExternalExpr8, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
11062
+ import { CssSelector as CssSelector4, DomElementSchemaRegistry as DomElementSchemaRegistry2, ExternalExpr as ExternalExpr8, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
11048
11063
 
11049
11064
  // packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.js
11050
11065
  import ts48 from "typescript";
@@ -11078,25 +11093,7 @@ var ExpressionIdentifier;
11078
11093
  ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
11079
11094
  ExpressionIdentifier2["VARIABLE_AS_EXPRESSION"] = "VAE";
11080
11095
  })(ExpressionIdentifier || (ExpressionIdentifier = {}));
11081
- function addExpressionIdentifier(node, identifier) {
11082
- ts47.addSyntheticTrailingComment(
11083
- node,
11084
- ts47.SyntaxKind.MultiLineCommentTrivia,
11085
- `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`,
11086
- /* hasTrailingNewLine */
11087
- false
11088
- );
11089
- }
11090
11096
  var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
11091
- function markIgnoreDiagnostics(node) {
11092
- ts47.addSyntheticTrailingComment(
11093
- node,
11094
- ts47.SyntaxKind.MultiLineCommentTrivia,
11095
- IGNORE_FOR_DIAGNOSTICS_MARKER,
11096
- /* hasTrailingNewLine */
11097
- false
11098
- );
11099
- }
11100
11097
  function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
11101
11098
  return ts47.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
11102
11099
  if (kind !== ts47.SyntaxKind.MultiLineCommentTrivia) {
@@ -11182,119 +11179,9 @@ function hasExpressionIdentifier(sourceFile, node, identifier) {
11182
11179
  }
11183
11180
 
11184
11181
  // packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.js
11185
- var SAFE_TO_CAST_WITHOUT_PARENS = null;
11186
- function tsCastToAny(expr) {
11187
- if (SAFE_TO_CAST_WITHOUT_PARENS === null) {
11188
- SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
11189
- // Expressions which are already parenthesized can be cast without further wrapping.
11190
- ts48.SyntaxKind.ParenthesizedExpression,
11191
- // Expressions which form a single lexical unit leave no room for precedence issues with the cast.
11192
- ts48.SyntaxKind.Identifier,
11193
- ts48.SyntaxKind.CallExpression,
11194
- ts48.SyntaxKind.NonNullExpression,
11195
- ts48.SyntaxKind.ElementAccessExpression,
11196
- ts48.SyntaxKind.PropertyAccessExpression,
11197
- ts48.SyntaxKind.ArrayLiteralExpression,
11198
- ts48.SyntaxKind.ObjectLiteralExpression,
11199
- // The same goes for various literals.
11200
- ts48.SyntaxKind.StringLiteral,
11201
- ts48.SyntaxKind.NumericLiteral,
11202
- ts48.SyntaxKind.TrueKeyword,
11203
- ts48.SyntaxKind.FalseKeyword,
11204
- ts48.SyntaxKind.NullKeyword,
11205
- ts48.SyntaxKind.UndefinedKeyword
11206
- ]);
11207
- }
11208
- if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
11209
- expr = ts48.factory.createParenthesizedExpression(expr);
11210
- }
11211
- return ts48.factory.createParenthesizedExpression(ts48.factory.createAsExpression(expr, ts48.factory.createKeywordTypeNode(ts48.SyntaxKind.AnyKeyword)));
11212
- }
11213
- function tsCreateElement(...tagNames) {
11214
- const createElement = ts48.factory.createPropertyAccessExpression(
11215
- /* expression */
11216
- ts48.factory.createIdentifier("document"),
11217
- "createElement"
11218
- );
11219
- let arg;
11220
- if (tagNames.length === 1) {
11221
- arg = ts48.factory.createStringLiteral(tagNames[0]);
11222
- } else {
11223
- const assertedNullExpression = ts48.factory.createNonNullExpression(ts48.factory.createNull());
11224
- const type = ts48.factory.createUnionTypeNode(tagNames.map((tag) => ts48.factory.createLiteralTypeNode(ts48.factory.createStringLiteral(tag))));
11225
- arg = ts48.factory.createAsExpression(assertedNullExpression, type);
11226
- }
11227
- return ts48.factory.createCallExpression(
11228
- /* expression */
11229
- createElement,
11230
- /* typeArguments */
11231
- void 0,
11232
- /* argumentsArray */
11233
- [arg]
11234
- );
11235
- }
11236
- function tsDeclareVariable(id, type) {
11237
- addExpressionIdentifier(type, ExpressionIdentifier.VARIABLE_AS_EXPRESSION);
11238
- const initializer = ts48.factory.createAsExpression(ts48.factory.createNonNullExpression(ts48.factory.createNull()), type);
11239
- const decl = ts48.factory.createVariableDeclaration(
11240
- /* name */
11241
- id,
11242
- /* exclamationToken */
11243
- void 0,
11244
- /* type */
11245
- void 0,
11246
- /* initializer */
11247
- initializer
11248
- );
11249
- return ts48.factory.createVariableStatement(
11250
- /* modifiers */
11251
- void 0,
11252
- /* declarationList */
11253
- [decl]
11254
- );
11255
- }
11256
- function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
11257
- return ts48.factory.createTypeQueryNode(ts48.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
11258
- }
11259
- function tsCreateVariable(id, initializer, flags = null) {
11260
- const decl = ts48.factory.createVariableDeclaration(
11261
- /* name */
11262
- id,
11263
- /* exclamationToken */
11264
- void 0,
11265
- /* type */
11266
- void 0,
11267
- /* initializer */
11268
- initializer
11269
- );
11270
- return ts48.factory.createVariableStatement(
11271
- /* modifiers */
11272
- void 0,
11273
- /* declarationList */
11274
- flags === null ? [decl] : ts48.factory.createVariableDeclarationList([decl], flags)
11275
- );
11276
- }
11277
- function tsCallMethod(receiver, methodName, args = []) {
11278
- const methodAccess = ts48.factory.createPropertyAccessExpression(receiver, methodName);
11279
- return ts48.factory.createCallExpression(
11280
- /* expression */
11281
- methodAccess,
11282
- /* typeArguments */
11283
- void 0,
11284
- /* argumentsArray */
11285
- args
11286
- );
11287
- }
11288
11182
  function isAccessExpression(node) {
11289
11183
  return ts48.isPropertyAccessExpression(node) || ts48.isElementAccessExpression(node);
11290
11184
  }
11291
- function tsNumericExpression2(value) {
11292
- if (value < 0) {
11293
- const operand = ts48.factory.createNumericLiteral(Math.abs(value));
11294
- return ts48.factory.createPrefixUnaryExpression(ts48.SyntaxKind.MinusToken, operand);
11295
- }
11296
- return ts48.factory.createNumericLiteral(value);
11297
- }
11298
11185
  function isDirectiveDeclaration(node) {
11299
11186
  const sourceFile = node.getSourceFile();
11300
11187
  return (ts48.isTypeNode(node) || ts48.isIdentifier(node)) && ts48.isVariableDeclaration(node.parent) && hasExpressionIdentifier(sourceFile, node, ExpressionIdentifier.DIRECTIVE);
@@ -11316,7 +11203,7 @@ function isSymbolAliasOf(firstSymbol, lastSymbol, typeChecker) {
11316
11203
  }
11317
11204
 
11318
11205
  // packages/compiler-cli/src/ngtsc/typecheck/src/checker.js
11319
- import ts86 from "typescript";
11206
+ import ts71 from "typescript";
11320
11207
 
11321
11208
  // packages/compiler-cli/src/ngtsc/program_driver/src/api.js
11322
11209
  var NgOriginalFile = Symbol("NgOriginalFile");
@@ -12908,7 +12795,7 @@ var MagicString = class _MagicString {
12908
12795
  };
12909
12796
 
12910
12797
  // packages/compiler-cli/src/ngtsc/typecheck/src/context.js
12911
- import ts84 from "typescript";
12798
+ import ts68 from "typescript";
12912
12799
 
12913
12800
  // packages/compiler-cli/src/ngtsc/typecheck/src/dom.js
12914
12801
  import { DomElementSchemaRegistry } from "@angular/compiler";
@@ -12977,10 +12864,112 @@ var RegistryDomSchemaChecker = class {
12977
12864
  };
12978
12865
 
12979
12866
  // packages/compiler-cli/src/ngtsc/typecheck/src/environment.js
12980
- import ts57 from "typescript";
12867
+ import ts59 from "typescript";
12981
12868
 
12982
12869
  // packages/compiler-cli/src/ngtsc/typecheck/src/reference_emit_environment.js
12983
12870
  import { ExpressionType, ExternalExpr as ExternalExpr7, TypeModifier } from "@angular/compiler";
12871
+ import ts54 from "typescript";
12872
+
12873
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/codegen.js
12874
+ import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
12875
+ import ts53 from "typescript";
12876
+ var TcbExpr = class {
12877
+ source;
12878
+ /** Text for the content containing the expression's location information. */
12879
+ spanComment = null;
12880
+ /** Text for the content containing the expression's identifier. */
12881
+ identifierComment = null;
12882
+ /**
12883
+ * Text of the comment instructing the type checker to
12884
+ * ignore diagnostics coming from this expression.
12885
+ */
12886
+ ignoreComment = null;
12887
+ constructor(source) {
12888
+ this.source = source;
12889
+ }
12890
+ /**
12891
+ * Converts the node's current state to a string.
12892
+ * @param ignoreComments Whether the comments associated with the expression should be skipped.
12893
+ */
12894
+ print(ignoreComments = false) {
12895
+ if (ignoreComments) {
12896
+ return this.source;
12897
+ }
12898
+ return this.source + this.formatComment(this.identifierComment) + this.formatComment(this.ignoreComment) + this.formatComment(this.spanComment);
12899
+ }
12900
+ /**
12901
+ * Adds a synthetic comment to the expression that represents the parse span of the provided node.
12902
+ * This comment can later be retrieved as trivia of a node to recover original source locations.
12903
+ * @param span Span from the parser containing the location information.
12904
+ */
12905
+ addParseSpanInfo(span) {
12906
+ let start;
12907
+ let end;
12908
+ if (span instanceof AbsoluteSourceSpan2) {
12909
+ start = span.start;
12910
+ end = span.end;
12911
+ } else {
12912
+ start = span.start.offset;
12913
+ end = span.end.offset;
12914
+ }
12915
+ this.spanComment = `${start},${end}`;
12916
+ return this;
12917
+ }
12918
+ /** Marks the expression to be ignored for diagnostics. */
12919
+ markIgnoreDiagnostics() {
12920
+ this.ignoreComment = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
12921
+ return this;
12922
+ }
12923
+ /**
12924
+ * Wraps the expression in parenthesis such that inserted
12925
+ * span comments become attached to the proper node.
12926
+ */
12927
+ wrapForTypeChecker() {
12928
+ this.source = `(${this.print()})`;
12929
+ this.spanComment = this.identifierComment = this.ignoreComment = null;
12930
+ return this;
12931
+ }
12932
+ /**
12933
+ * Tags the expression with an identifier.
12934
+ * @param identifier Identifier to apply to the expression.
12935
+ */
12936
+ addExpressionIdentifier(identifier) {
12937
+ this.identifierComment = `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`;
12938
+ return this;
12939
+ }
12940
+ /**
12941
+ * `toString` implementation meant to catch errors like accidentally
12942
+ * writing `foo ${expr} bar` instead of `foo ${expr.print()} bar`.
12943
+ */
12944
+ toString() {
12945
+ throw new Error("Assertion error: TcbExpr should not be converted to a string through concatenation. Use the `print` method instead.");
12946
+ }
12947
+ /** Format a comment string as a TypeScript comment. */
12948
+ formatComment(content) {
12949
+ return content === null || content.length === 0 ? "" : ` /*${content}*/`;
12950
+ }
12951
+ };
12952
+ function declareVariable(identifier, type) {
12953
+ type.addExpressionIdentifier(ExpressionIdentifier.VARIABLE_AS_EXPRESSION);
12954
+ return new TcbExpr(`var ${identifier.print()} = null! as ${type.print()}`);
12955
+ }
12956
+ function getStatementsBlock(expressions, singleLine = false) {
12957
+ let result = "";
12958
+ for (const expr of expressions) {
12959
+ result += `${expr.print()};${singleLine ? " " : "\n"}`;
12960
+ }
12961
+ return result;
12962
+ }
12963
+ function quoteAndEscape(value) {
12964
+ return JSON.stringify(value);
12965
+ }
12966
+ var tempPrinter = null;
12967
+ function tempPrint(node, sourceFile) {
12968
+ tempPrinter ??= ts53.createPrinter();
12969
+ return tempPrinter.printNode(ts53.EmitHint.Unspecified, node, sourceFile);
12970
+ }
12971
+
12972
+ // packages/compiler-cli/src/ngtsc/typecheck/src/reference_emit_environment.js
12984
12973
  var ReferenceEmitEnvironment = class {
12985
12974
  importManager;
12986
12975
  refEmitter;
@@ -13006,13 +12995,18 @@ var ReferenceEmitEnvironment = class {
13006
12995
  assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "symbol");
13007
12996
  return translateType(new ExpressionType(ngExpr.expression), this.contextFile, this.reflector, this.refEmitter, this.importManager);
13008
12997
  }
13009
- /**
13010
- * Generate a `ts.Expression` that refers to the external symbol. This
13011
- * may result in new imports being generated.
13012
- */
13013
12998
  referenceExternalSymbol(moduleName, name) {
13014
- const external = new ExternalExpr7({ moduleName, name });
13015
- return translateExpression(this.contextFile, external, this.importManager);
12999
+ const importResult = this.importManager.addImport({
13000
+ exportModuleSpecifier: moduleName,
13001
+ exportSymbolName: name,
13002
+ requestedFile: this.contextFile
13003
+ });
13004
+ if (ts54.isIdentifier(importResult)) {
13005
+ return new TcbExpr(importResult.text);
13006
+ } else if (ts54.isIdentifier(importResult.expression)) {
13007
+ return new TcbExpr(`${importResult.expression.text}.${importResult.name.text}`);
13008
+ }
13009
+ throw new Error("Unexpected value returned by import manager");
13016
13010
  }
13017
13011
  /**
13018
13012
  * Generate a `ts.TypeNode` that references a given type from the provided module.
@@ -13035,15 +13029,15 @@ var ReferenceEmitEnvironment = class {
13035
13029
  };
13036
13030
 
13037
13031
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.js
13038
- import { ExpressionType as ExpressionType2, R3Identifiers as R3Identifiers3, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
13039
- import ts56 from "typescript";
13032
+ import { R3Identifiers as R3Identifiers3 } from "@angular/compiler";
13033
+ import ts58 from "typescript";
13040
13034
 
13041
13035
  // packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.js
13042
13036
  import { R3Identifiers as R3Identifiers2 } from "@angular/compiler";
13043
- import ts55 from "typescript";
13037
+ import ts57 from "typescript";
13044
13038
 
13045
13039
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.js
13046
- import ts53 from "typescript";
13040
+ import ts55 from "typescript";
13047
13041
  var TypeParameterEmitter = class {
13048
13042
  typeParameters;
13049
13043
  reflector;
@@ -13090,11 +13084,11 @@ var TypeParameterEmitter = class {
13090
13084
  return this.typeParameters.map((typeParam) => {
13091
13085
  const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
13092
13086
  const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
13093
- return ts53.factory.updateTypeParameterDeclaration(typeParam, typeParam.modifiers, typeParam.name, constraint, defaultType);
13087
+ return ts55.factory.updateTypeParameterDeclaration(typeParam, typeParam.modifiers, typeParam.name, constraint, defaultType);
13094
13088
  });
13095
13089
  }
13096
13090
  resolveTypeReference(type) {
13097
- const target = ts53.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
13091
+ const target = ts55.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
13098
13092
  const declaration = this.reflector.getDeclarationOfIdentifier(target);
13099
13093
  if (declaration === null || declaration.node === null) {
13100
13094
  return null;
@@ -13120,8 +13114,8 @@ var TypeParameterEmitter = class {
13120
13114
  if (typeNode === null) {
13121
13115
  return null;
13122
13116
  }
13123
- if (!ts53.isTypeReferenceNode(typeNode)) {
13124
- throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts53.SyntaxKind[typeNode.kind]}.`);
13117
+ if (!ts55.isTypeReferenceNode(typeNode)) {
13118
+ throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts55.SyntaxKind[typeNode.kind]}.`);
13125
13119
  }
13126
13120
  return typeNode;
13127
13121
  }
@@ -13131,8 +13125,8 @@ var TypeParameterEmitter = class {
13131
13125
  };
13132
13126
 
13133
13127
  // packages/compiler-cli/src/ngtsc/typecheck/src/host_bindings.js
13134
- import { BindingType, CssSelector as CssSelector2, makeBindingParser, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstHostElement, AbsoluteSourceSpan as AbsoluteSourceSpan2, ParseSpan, PropertyRead as PropertyRead2, ParsedEventType, Call, ThisReceiver as ThisReceiver2, KeyedRead, LiteralPrimitive, RecursiveAstVisitor, ASTWithName, SafeCall, ImplicitReceiver as ImplicitReceiver2 } from "@angular/compiler";
13135
- import ts54 from "typescript";
13128
+ import { BindingType, CssSelector as CssSelector2, makeBindingParser, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstHostElement, AbsoluteSourceSpan as AbsoluteSourceSpan3, ParseSpan, PropertyRead as PropertyRead2, ParsedEventType, Call, ThisReceiver as ThisReceiver2, KeyedRead, LiteralPrimitive, RecursiveAstVisitor, ASTWithName, SafeCall, ImplicitReceiver as ImplicitReceiver2 } from "@angular/compiler";
13129
+ import ts56 from "typescript";
13136
13130
  var GUARD_COMMENT_TEXT = "hostBindingsBlockGuard";
13137
13131
  function createHostElement(type, selector, sourceNode, literal4, bindingDecorators, listenerDecorators) {
13138
13132
  const bindings = [];
@@ -13140,7 +13134,7 @@ function createHostElement(type, selector, sourceNode, literal4, bindingDecorato
13140
13134
  let parser = null;
13141
13135
  if (literal4 !== null) {
13142
13136
  for (const prop of literal4.properties) {
13143
- if (ts54.isPropertyAssignment(prop) && ts54.isStringLiteralLike(prop.initializer) && isStaticName(prop.name)) {
13137
+ if (ts56.isPropertyAssignment(prop) && ts56.isStringLiteralLike(prop.initializer) && isStaticName(prop.name)) {
13144
13138
  parser ??= makeBindingParser();
13145
13139
  createNodeFromHostLiteralProperty(prop, parser, bindings, listeners);
13146
13140
  }
@@ -13171,19 +13165,18 @@ function createHostElement(type, selector, sourceNode, literal4, bindingDecorato
13171
13165
  return new TmplAstHostElement(tagNames, bindings, listeners, createSourceSpan(sourceNode.name));
13172
13166
  }
13173
13167
  function createHostBindingsBlockGuard() {
13174
- const trueExpr = ts54.addSyntheticTrailingComment(ts54.factory.createTrue(), ts54.SyntaxKind.MultiLineCommentTrivia, GUARD_COMMENT_TEXT);
13175
- return ts54.factory.createParenthesizedExpression(trueExpr);
13168
+ return `(true /*${GUARD_COMMENT_TEXT}*/)`;
13176
13169
  }
13177
13170
  function isHostBindingsBlockGuard(node) {
13178
- if (!ts54.isIfStatement(node)) {
13171
+ if (!ts56.isIfStatement(node)) {
13179
13172
  return false;
13180
13173
  }
13181
13174
  const expr = node.expression;
13182
- if (!ts54.isParenthesizedExpression(expr) || expr.expression.kind !== ts54.SyntaxKind.TrueKeyword) {
13175
+ if (!ts56.isParenthesizedExpression(expr) || expr.expression.kind !== ts56.SyntaxKind.TrueKeyword) {
13183
13176
  return false;
13184
13177
  }
13185
13178
  const text = expr.getSourceFile().text;
13186
- return ts54.forEachTrailingCommentRange(text, expr.expression.getEnd(), (pos, end, kind) => kind === ts54.SyntaxKind.MultiLineCommentTrivia && text.substring(pos + 2, end - 2) === GUARD_COMMENT_TEXT) || false;
13179
+ return ts56.forEachTrailingCommentRange(text, expr.expression.getEnd(), (pos, end, kind) => kind === ts56.SyntaxKind.MultiLineCommentTrivia && text.substring(pos + 2, end - 2) === GUARD_COMMENT_TEXT) || false;
13187
13180
  }
13188
13181
  function createNodeFromHostLiteralProperty(property, parser, bindings, listeners) {
13189
13182
  const { name, initializer } = property;
@@ -13207,19 +13200,19 @@ function createNodeFromHostLiteralProperty(property, parser, bindings, listeners
13207
13200
  }
13208
13201
  }
13209
13202
  function createNodeFromBindingDecorator(decorator, bindings) {
13210
- if (!ts54.isCallExpression(decorator.expression)) {
13203
+ if (!ts56.isCallExpression(decorator.expression)) {
13211
13204
  return;
13212
13205
  }
13213
13206
  const args = decorator.expression.arguments;
13214
13207
  const property = decorator.parent;
13215
13208
  let nameNode = null;
13216
13209
  let propertyName = null;
13217
- if (property && ts54.isPropertyDeclaration(property) && isStaticName(property.name)) {
13210
+ if (property && ts56.isPropertyDeclaration(property) && isStaticName(property.name)) {
13218
13211
  propertyName = property.name;
13219
13212
  }
13220
13213
  if (args.length === 0) {
13221
13214
  nameNode = propertyName;
13222
- } else if (ts54.isStringLiteralLike(args[0])) {
13215
+ } else if (ts56.isStringLiteralLike(args[0])) {
13223
13216
  nameNode = args[0];
13224
13217
  } else {
13225
13218
  return;
@@ -13229,36 +13222,36 @@ function createNodeFromBindingDecorator(decorator, bindings) {
13229
13222
  }
13230
13223
  const span = new ParseSpan(-1, -1);
13231
13224
  const propertyStart = property.getStart();
13232
- const receiver = new ThisReceiver2(span, new AbsoluteSourceSpan2(propertyStart, propertyStart));
13233
- const nameSpan = new AbsoluteSourceSpan2(propertyName.getStart(), propertyName.getEnd());
13234
- const read = ts54.isIdentifier(propertyName) ? new PropertyRead2(span, nameSpan, nameSpan, receiver, propertyName.text) : new KeyedRead(span, nameSpan, receiver, new LiteralPrimitive(span, nameSpan, propertyName.text));
13225
+ const receiver = new ThisReceiver2(span, new AbsoluteSourceSpan3(propertyStart, propertyStart));
13226
+ const nameSpan = new AbsoluteSourceSpan3(propertyName.getStart(), propertyName.getEnd());
13227
+ const read = ts56.isIdentifier(propertyName) ? new PropertyRead2(span, nameSpan, nameSpan, receiver, propertyName.text) : new KeyedRead(span, nameSpan, receiver, new LiteralPrimitive(span, nameSpan, propertyName.text));
13235
13228
  const { attrName, type } = inferBoundAttribute(nameNode.text);
13236
13229
  bindings.push(new TmplAstBoundAttribute(attrName, type, 0, read, null, createSourceSpan(decorator), createStaticExpressionSpan(nameNode), createSourceSpan(decorator), void 0));
13237
13230
  }
13238
13231
  function createNodeFromListenerDecorator(decorator, parser, listeners) {
13239
- if (!ts54.isCallExpression(decorator.expression) || decorator.expression.arguments.length === 0) {
13232
+ if (!ts56.isCallExpression(decorator.expression) || decorator.expression.arguments.length === 0) {
13240
13233
  return;
13241
13234
  }
13242
13235
  const args = decorator.expression.arguments;
13243
13236
  const method = decorator.parent;
13244
- if (!method || !ts54.isMethodDeclaration(method) || !isStaticName(method.name) || !ts54.isStringLiteralLike(args[0])) {
13237
+ if (!method || !ts56.isMethodDeclaration(method) || !isStaticName(method.name) || !ts56.isStringLiteralLike(args[0])) {
13245
13238
  return;
13246
13239
  }
13247
13240
  const span = new ParseSpan(-1, -1);
13248
13241
  const argNodes = [];
13249
13242
  const methodStart = method.getStart();
13250
- const methodReceiver = new ThisReceiver2(span, new AbsoluteSourceSpan2(methodStart, methodStart));
13251
- const nameSpan = new AbsoluteSourceSpan2(method.name.getStart(), method.name.getEnd());
13252
- const receiver = ts54.isIdentifier(method.name) ? new PropertyRead2(span, nameSpan, nameSpan, methodReceiver, method.name.text) : new KeyedRead(span, nameSpan, methodReceiver, new LiteralPrimitive(span, nameSpan, method.name.text));
13253
- if (args.length > 1 && ts54.isArrayLiteralExpression(args[1])) {
13243
+ const methodReceiver = new ThisReceiver2(span, new AbsoluteSourceSpan3(methodStart, methodStart));
13244
+ const nameSpan = new AbsoluteSourceSpan3(method.name.getStart(), method.name.getEnd());
13245
+ const receiver = ts56.isIdentifier(method.name) ? new PropertyRead2(span, nameSpan, nameSpan, methodReceiver, method.name.text) : new KeyedRead(span, nameSpan, methodReceiver, new LiteralPrimitive(span, nameSpan, method.name.text));
13246
+ if (args.length > 1 && ts56.isArrayLiteralExpression(args[1])) {
13254
13247
  for (const expr of args[1].elements) {
13255
- if (ts54.isStringLiteralLike(expr)) {
13248
+ if (ts56.isStringLiteralLike(expr)) {
13256
13249
  const span2 = createStaticExpressionSpan(expr);
13257
13250
  const ast = parser.parseBinding(expr.text, true, span2, span2.start.offset);
13258
13251
  fixupSpans(ast, expr);
13259
13252
  argNodes.push(ast);
13260
13253
  } else {
13261
- const expressionSpan = new AbsoluteSourceSpan2(expr.getStart(), expr.getEnd());
13254
+ const expressionSpan = new AbsoluteSourceSpan3(expr.getStart(), expr.getEnd());
13262
13255
  const anyRead = new PropertyRead2(span, expressionSpan, expressionSpan, new ImplicitReceiver2(span, expressionSpan), "$any");
13263
13256
  const anyCall = new Call(span, expressionSpan, anyRead, [new LiteralPrimitive(span, expressionSpan, 0)], expressionSpan);
13264
13257
  argNodes.push(anyCall);
@@ -13316,11 +13309,11 @@ function inferBoundAttribute(name) {
13316
13309
  return { attrName, type };
13317
13310
  }
13318
13311
  function isStaticName(node) {
13319
- return ts54.isIdentifier(node) || ts54.isStringLiteralLike(node);
13312
+ return ts56.isIdentifier(node) || ts56.isStringLiteralLike(node);
13320
13313
  }
13321
13314
  function createStaticExpressionSpan(node) {
13322
13315
  const span = createSourceSpan(node);
13323
- if (ts54.isStringLiteralLike(node)) {
13316
+ if (ts56.isStringLiteralLike(node)) {
13324
13317
  span.fullStart = span.fullStart.moveBy(1);
13325
13318
  span.start = span.start.moveBy(1);
13326
13319
  span.end = span.end.moveBy(-1);
@@ -13331,7 +13324,7 @@ function fixupSpans(ast, initializer) {
13331
13324
  const escapeIndex = initializer.getText().indexOf("\\", 1);
13332
13325
  if (escapeIndex > -1) {
13333
13326
  const newSpan = new ParseSpan(0, initializer.getWidth());
13334
- const newSourceSpan = new AbsoluteSourceSpan2(initializer.getStart(), initializer.getEnd());
13327
+ const newSourceSpan = new AbsoluteSourceSpan3(initializer.getStart(), initializer.getEnd());
13335
13328
  ast.visit(new ReplaceSpanVisitor(escapeIndex, newSpan, newSourceSpan));
13336
13329
  }
13337
13330
  }
@@ -13410,7 +13403,7 @@ function getSourceMapping(shimSf, position, resolver, isDiagnosticRequest) {
13410
13403
  }
13411
13404
  function isInHostBindingTcb(node) {
13412
13405
  let current = node;
13413
- while (current && !ts55.isFunctionDeclaration(current)) {
13406
+ while (current && !ts57.isFunctionDeclaration(current)) {
13414
13407
  if (isHostBindingsBlockGuard(current)) {
13415
13408
  return true;
13416
13409
  }
@@ -13420,14 +13413,14 @@ function isInHostBindingTcb(node) {
13420
13413
  }
13421
13414
  function findTypeCheckBlock(file, id, isDiagnosticRequest) {
13422
13415
  for (const stmt of file.statements) {
13423
- if (ts55.isFunctionDeclaration(stmt) && getTypeCheckId2(stmt, file, isDiagnosticRequest) === id) {
13416
+ if (ts57.isFunctionDeclaration(stmt) && getTypeCheckId2(stmt, file, isDiagnosticRequest) === id) {
13424
13417
  return stmt;
13425
13418
  }
13426
13419
  }
13427
- return findNodeInFile(file, (node) => ts55.isFunctionDeclaration(node) && getTypeCheckId2(node, file, isDiagnosticRequest) === id);
13420
+ return findNodeInFile(file, (node) => ts57.isFunctionDeclaration(node) && getTypeCheckId2(node, file, isDiagnosticRequest) === id);
13428
13421
  }
13429
13422
  function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
13430
- while (node !== void 0 && !ts55.isFunctionDeclaration(node)) {
13423
+ while (node !== void 0 && !ts57.isFunctionDeclaration(node)) {
13431
13424
  if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
13432
13425
  return null;
13433
13426
  }
@@ -13444,7 +13437,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
13444
13437
  return null;
13445
13438
  }
13446
13439
  function getTypeCheckId2(node, sourceFile, isDiagnosticRequest) {
13447
- while (!ts55.isFunctionDeclaration(node)) {
13440
+ while (!ts57.isFunctionDeclaration(node)) {
13448
13441
  if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
13449
13442
  return null;
13450
13443
  }
@@ -13454,8 +13447,8 @@ function getTypeCheckId2(node, sourceFile, isDiagnosticRequest) {
13454
13447
  }
13455
13448
  }
13456
13449
  const start = node.getFullStart();
13457
- return ts55.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
13458
- if (kind !== ts55.SyntaxKind.MultiLineCommentTrivia) {
13450
+ return ts57.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
13451
+ if (kind !== ts57.SyntaxKind.MultiLineCommentTrivia) {
13459
13452
  return null;
13460
13453
  }
13461
13454
  const commentText = sourceFile.text.substring(pos + 2, end - 2);
@@ -13480,167 +13473,92 @@ function findNodeInFile(file, predicate) {
13480
13473
  if (predicate(node)) {
13481
13474
  return node;
13482
13475
  }
13483
- return ts55.forEachChild(node, visit2) ?? null;
13476
+ return ts57.forEachChild(node, visit2) ?? null;
13484
13477
  };
13485
- return ts55.forEachChild(file, visit2) ?? null;
13478
+ return ts57.forEachChild(file, visit2) ?? null;
13486
13479
  }
13487
13480
 
13488
13481
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.js
13489
13482
  function generateTypeCtorDeclarationFn(env, meta, nodeTypeRef, typeParams) {
13490
- const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
13491
- const rawType = ts56.factory.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
13492
- const initParam = constructTypeCtorParameter(env, meta, rawType);
13483
+ const typeArgs = generateGenericArgs(typeParams);
13484
+ const typeRef = ts58.isIdentifier(nodeTypeRef) ? nodeTypeRef.text : tempPrint(nodeTypeRef, nodeTypeRef.getSourceFile());
13485
+ const typeRefWithGenerics = `${typeRef}${typeArgs}`;
13486
+ const initParam = constructTypeCtorParameter(env, meta, nodeTypeRef.getSourceFile(), typeRef, typeRefWithGenerics);
13493
13487
  const typeParameters = typeParametersWithDefaultTypes(typeParams);
13488
+ let source;
13494
13489
  if (meta.body) {
13495
- const fnType = ts56.factory.createFunctionTypeNode(
13496
- /* typeParameters */
13497
- typeParameters,
13498
- /* parameters */
13499
- [initParam],
13500
- /* type */
13501
- rawType
13502
- );
13503
- const decl = ts56.factory.createVariableDeclaration(
13504
- /* name */
13505
- meta.fnName,
13506
- /* exclamationToken */
13507
- void 0,
13508
- /* type */
13509
- fnType,
13510
- /* body */
13511
- ts56.factory.createNonNullExpression(ts56.factory.createNull())
13512
- );
13513
- const declList = ts56.factory.createVariableDeclarationList([decl], ts56.NodeFlags.Const);
13514
- return ts56.factory.createVariableStatement(
13515
- /* modifiers */
13516
- void 0,
13517
- /* declarationList */
13518
- declList
13519
- );
13490
+ const fnType = `${typeParameters}(${initParam}) => ${typeRefWithGenerics}`;
13491
+ source = `const ${meta.fnName}: ${fnType} = null!`;
13520
13492
  } else {
13521
- return ts56.factory.createFunctionDeclaration(
13522
- /* modifiers */
13523
- [ts56.factory.createModifier(ts56.SyntaxKind.DeclareKeyword)],
13524
- /* asteriskToken */
13525
- void 0,
13526
- /* name */
13527
- meta.fnName,
13528
- /* typeParameters */
13529
- typeParameters,
13530
- /* parameters */
13531
- [initParam],
13532
- /* type */
13533
- rawType,
13534
- /* body */
13535
- void 0
13536
- );
13493
+ source = `declare function ${meta.fnName}${typeParameters}(${initParam}): ${typeRefWithGenerics}`;
13537
13494
  }
13495
+ return new TcbExpr(source);
13538
13496
  }
13539
13497
  function generateInlineTypeCtor(env, node, meta) {
13540
- const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
13541
- const rawType = ts56.factory.createTypeReferenceNode(node.name, rawTypeArgs);
13542
- const initParam = constructTypeCtorParameter(env, meta, rawType);
13543
- let body = void 0;
13544
- if (meta.body) {
13545
- body = ts56.factory.createBlock([
13546
- ts56.factory.createReturnStatement(ts56.factory.createNonNullExpression(ts56.factory.createNull()))
13547
- ]);
13548
- }
13549
- return ts56.factory.createMethodDeclaration(
13550
- /* modifiers */
13551
- [ts56.factory.createModifier(ts56.SyntaxKind.StaticKeyword)],
13552
- /* asteriskToken */
13553
- void 0,
13554
- /* name */
13555
- meta.fnName,
13556
- /* questionToken */
13557
- void 0,
13558
- /* typeParameters */
13559
- typeParametersWithDefaultTypes(node.typeParameters),
13560
- /* parameters */
13561
- [initParam],
13562
- /* type */
13563
- rawType,
13564
- /* body */
13565
- body
13566
- );
13567
- }
13568
- function constructTypeCtorParameter(env, meta, rawType) {
13498
+ const typeRef = node.name.text;
13499
+ const typeRefWithGenerics = `${typeRef}${generateGenericArgs(node.typeParameters)}`;
13500
+ const initParam = constructTypeCtorParameter(env, meta, node.getSourceFile(), typeRef, typeRefWithGenerics);
13501
+ const body = `{ return null!; }`;
13502
+ const typeParams = typeParametersWithDefaultTypes(node.typeParameters);
13503
+ return `static ${meta.fnName}${typeParams}(${initParam}): ${typeRefWithGenerics} ${body}`;
13504
+ }
13505
+ function constructTypeCtorParameter(env, meta, sourceFile, typeRef, typeRefWithGenerics) {
13569
13506
  let initType = null;
13570
13507
  const plainKeys = [];
13571
13508
  const coercedKeys = [];
13572
13509
  const signalInputKeys = [];
13573
13510
  for (const { classPropertyName, transform, isSignal } of meta.fields.inputs) {
13574
13511
  if (isSignal) {
13575
- signalInputKeys.push(ts56.factory.createLiteralTypeNode(ts56.factory.createStringLiteral(classPropertyName)));
13512
+ signalInputKeys.push(quoteAndEscape(classPropertyName));
13576
13513
  } else if (!meta.coercedInputFields.has(classPropertyName)) {
13577
- plainKeys.push(ts56.factory.createLiteralTypeNode(ts56.factory.createStringLiteral(classPropertyName)));
13514
+ plainKeys.push(quoteAndEscape(classPropertyName));
13578
13515
  } else {
13579
- const coercionType = transform != null ? transform.type.node : tsCreateTypeQueryForCoercedInput(rawType.typeName, classPropertyName);
13580
- coercedKeys.push(ts56.factory.createPropertySignature(
13581
- /* modifiers */
13582
- void 0,
13583
- /* name */
13584
- classPropertyName,
13585
- /* questionToken */
13586
- void 0,
13587
- /* type */
13588
- coercionType
13589
- ));
13516
+ const coercionType = transform != null ? tempPrint(transform.type.node, sourceFile) : `typeof ${typeRef}.ngAcceptInputType_${classPropertyName}`;
13517
+ coercedKeys.push(`${classPropertyName}: ${coercionType}`);
13590
13518
  }
13591
13519
  }
13592
13520
  if (plainKeys.length > 0) {
13593
- const keyTypeUnion = ts56.factory.createUnionTypeNode(plainKeys);
13594
- initType = ts56.factory.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
13521
+ initType = `Pick<${typeRefWithGenerics}, ${plainKeys.join(" | ")}>`;
13595
13522
  }
13596
13523
  if (coercedKeys.length > 0) {
13597
- const coercedLiteral = ts56.factory.createTypeLiteralNode(coercedKeys);
13598
- initType = initType !== null ? ts56.factory.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
13524
+ let coercedLiteral = "{\n";
13525
+ for (const key of coercedKeys) {
13526
+ coercedLiteral += `${key};
13527
+ `;
13528
+ }
13529
+ coercedLiteral += "}";
13530
+ initType = initType !== null ? `${initType} & ${coercedLiteral}` : coercedLiteral;
13599
13531
  }
13600
13532
  if (signalInputKeys.length > 0) {
13601
- const keyTypeUnion = ts56.factory.createUnionTypeNode(signalInputKeys);
13602
- const unwrapDirectiveSignalInputsExpr = env.referenceExternalType(R3Identifiers3.UnwrapDirectiveSignalInputs.moduleName, R3Identifiers3.UnwrapDirectiveSignalInputs.name, [
13603
- // TODO:
13604
- new ExpressionType2(new WrappedNodeExpr7(rawType)),
13605
- new ExpressionType2(new WrappedNodeExpr7(keyTypeUnion))
13606
- ]);
13607
- initType = initType !== null ? ts56.factory.createIntersectionTypeNode([initType, unwrapDirectiveSignalInputsExpr]) : unwrapDirectiveSignalInputsExpr;
13533
+ const keyTypeUnion = signalInputKeys.join(" | ");
13534
+ const unwrapRef = env.referenceExternalSymbol(R3Identifiers3.UnwrapDirectiveSignalInputs.moduleName, R3Identifiers3.UnwrapDirectiveSignalInputs.name);
13535
+ const unwrapExpr = `${unwrapRef.print()}<${typeRefWithGenerics}, ${keyTypeUnion}>`;
13536
+ initType = initType !== null ? `${initType} & ${unwrapExpr}` : unwrapExpr;
13608
13537
  }
13609
13538
  if (initType === null) {
13610
- initType = ts56.factory.createTypeLiteralNode([]);
13539
+ initType = "{}";
13611
13540
  }
13612
- return ts56.factory.createParameterDeclaration(
13613
- /* modifiers */
13614
- void 0,
13615
- /* dotDotDotToken */
13616
- void 0,
13617
- /* name */
13618
- "init",
13619
- /* questionToken */
13620
- void 0,
13621
- /* type */
13622
- initType,
13623
- /* initializer */
13624
- void 0
13625
- );
13541
+ return `init: ${initType}`;
13626
13542
  }
13627
- function generateGenericArgs(params) {
13628
- return params.map((param) => ts56.factory.createTypeReferenceNode(param.name, void 0));
13543
+ function generateGenericArgs(typeParameters) {
13544
+ if (typeParameters === void 0 || typeParameters.length === 0) {
13545
+ return "";
13546
+ }
13547
+ return `<${typeParameters.map((param) => param.name.text).join(", ")}>`;
13629
13548
  }
13630
13549
  function requiresInlineTypeCtor(node, host, env) {
13631
13550
  return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
13632
13551
  }
13633
13552
  function typeParametersWithDefaultTypes(params) {
13634
- if (params === void 0) {
13635
- return void 0;
13553
+ if (params === void 0 || params.length === 0) {
13554
+ return "";
13636
13555
  }
13637
- return params.map((param) => {
13638
- if (param.default === void 0) {
13639
- return ts56.factory.updateTypeParameterDeclaration(param, param.modifiers, param.name, param.constraint, ts56.factory.createKeywordTypeNode(ts56.SyntaxKind.AnyKeyword));
13640
- } else {
13641
- return param;
13642
- }
13556
+ const paramStrings = params.map((param) => {
13557
+ const constraint = param.constraint ? ` extends ${tempPrint(param.constraint, param.getSourceFile())}` : "";
13558
+ const defaultValue = ` = ${param.default ? tempPrint(param.default, param.getSourceFile()) : "any"}`;
13559
+ return `${param.name.text}${constraint}${defaultValue}`;
13643
13560
  });
13561
+ return `<${paramStrings.join(", ")}>`;
13644
13562
  }
13645
13563
 
13646
13564
  // packages/compiler-cli/src/ngtsc/typecheck/src/environment.js
@@ -13668,17 +13586,17 @@ var Environment = class extends ReferenceEmitEnvironment {
13668
13586
  const dirRef = dir.ref;
13669
13587
  const node = dirRef.node;
13670
13588
  if (this.typeCtors.has(node)) {
13671
- return this.typeCtors.get(node);
13589
+ return new TcbExpr(this.typeCtors.get(node));
13672
13590
  }
13673
13591
  if (requiresInlineTypeCtor(node, this.reflector, this)) {
13674
13592
  const ref = this.reference(dirRef);
13675
- const typeCtorExpr = ts57.factory.createPropertyAccessExpression(ref, "ngTypeCtor");
13593
+ const typeCtorExpr = `${ref.print()}.ngTypeCtor`;
13676
13594
  this.typeCtors.set(node, typeCtorExpr);
13677
- return typeCtorExpr;
13595
+ return new TcbExpr(typeCtorExpr);
13678
13596
  } else {
13679
13597
  const fnName = `_ctor${this.nextIds.typeCtor++}`;
13680
13598
  const nodeTypeRef = this.referenceType(dirRef);
13681
- if (!ts57.isTypeReferenceNode(nodeTypeRef)) {
13599
+ if (!ts59.isTypeReferenceNode(nodeTypeRef)) {
13682
13600
  throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
13683
13601
  }
13684
13602
  const meta = {
@@ -13694,9 +13612,8 @@ var Environment = class extends ReferenceEmitEnvironment {
13694
13612
  const typeParams = this.emitTypeParameters(node);
13695
13613
  const typeCtor = generateTypeCtorDeclarationFn(this, meta, nodeTypeRef.typeName, typeParams);
13696
13614
  this.typeCtorStatements.push(typeCtor);
13697
- const fnId = ts57.factory.createIdentifier(fnName);
13698
- this.typeCtors.set(node, fnId);
13699
- return fnId;
13615
+ this.typeCtors.set(node, fnName);
13616
+ return new TcbExpr(fnName);
13700
13617
  }
13701
13618
  }
13702
13619
  /*
@@ -13704,13 +13621,13 @@ var Environment = class extends ReferenceEmitEnvironment {
13704
13621
  */
13705
13622
  pipeInst(ref) {
13706
13623
  if (this.pipeInsts.has(ref.node)) {
13707
- return this.pipeInsts.get(ref.node);
13624
+ return new TcbExpr(this.pipeInsts.get(ref.node));
13708
13625
  }
13709
13626
  const pipeType = this.referenceType(ref);
13710
- const pipeInstId = ts57.factory.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
13711
- this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
13627
+ const pipeInstId = `_pipe${this.nextIds.pipeInst++}`;
13712
13628
  this.pipeInsts.set(ref.node, pipeInstId);
13713
- return pipeInstId;
13629
+ this.pipeInstStatements.push(declareVariable(new TcbExpr(pipeInstId), new TcbExpr(tempPrint(pipeType, this.contextFile))));
13630
+ return new TcbExpr(pipeInstId);
13714
13631
  }
13715
13632
  /**
13716
13633
  * Generate a `ts.Expression` that references the given node.
@@ -13720,7 +13637,8 @@ var Environment = class extends ReferenceEmitEnvironment {
13720
13637
  reference(ref) {
13721
13638
  const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing);
13722
13639
  assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "class");
13723
- return translateExpression(this.contextFile, ngExpr.expression, this.importManager);
13640
+ const tsExpression = translateExpression(this.contextFile, ngExpr.expression, this.importManager);
13641
+ return new TcbExpr(tempPrint(tsExpression, this.contextFile));
13724
13642
  }
13725
13643
  emitTypeParameters(declaration) {
13726
13644
  const emitter = new TypeParameterEmitter(declaration.typeParameters, this.reflector);
@@ -13732,8 +13650,8 @@ var Environment = class extends ReferenceEmitEnvironment {
13732
13650
  };
13733
13651
 
13734
13652
  // packages/compiler-cli/src/ngtsc/typecheck/src/oob.js
13735
- import { AbsoluteSourceSpan as AbsoluteSourceSpan3, BindingType as BindingType2, ParseSourceSpan as ParseSourceSpan2, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent as TmplAstBoundEvent2, TmplAstComponent, TmplAstDirective, TmplAstElement } from "@angular/compiler";
13736
- import ts58 from "typescript";
13653
+ import { AbsoluteSourceSpan as AbsoluteSourceSpan4, BindingType as BindingType2, ParseSourceSpan as ParseSourceSpan2, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent as TmplAstBoundEvent2, TmplAstComponent, TmplAstDirective, TmplAstElement } from "@angular/compiler";
13654
+ import ts60 from "typescript";
13737
13655
  var OutOfBandDiagnosticRecorderImpl = class {
13738
13656
  resolver;
13739
13657
  _diagnostics = [];
@@ -13768,7 +13686,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
13768
13686
  const mapping = this.resolver.getTemplateSourceMapping(id);
13769
13687
  const value = ref.value.trim();
13770
13688
  const errorMsg = `No directive found with exportAs '${value}'.`;
13771
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, ref.valueSpan || ref.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
13689
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, ref.valueSpan || ref.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
13772
13690
  }
13773
13691
  missingPipe(id, ast, isStandalone) {
13774
13692
  if (this.recordedPipes.has(ast)) {
@@ -13791,7 +13709,7 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
13791
13709
  To fix this, import the "${suggestedClassName}" class from "${suggestedImport}" and add it to the "imports" array of the module declaring the component.`;
13792
13710
  }
13793
13711
  }
13794
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
13712
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
13795
13713
  this.recordedPipes.add(ast);
13796
13714
  }
13797
13715
  deferredPipeUsedEagerly(id, ast) {
@@ -13804,24 +13722,24 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
13804
13722
  if (sourceSpan === null) {
13805
13723
  throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
13806
13724
  }
13807
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_PIPE_USED_EAGERLY), errorMsg));
13725
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_PIPE_USED_EAGERLY), errorMsg));
13808
13726
  this.recordedPipes.add(ast);
13809
13727
  }
13810
13728
  deferredComponentUsedEagerly(id, element) {
13811
13729
  const mapping = this.resolver.getTemplateSourceMapping(id);
13812
13730
  const errorMsg = `Element '${element.name}' contains a component or a directive that was imported via \`@Component.deferredImports\`, but the element itself is located outside of a \`@defer\` block in a template. To fix this, either use the '${element.name}' element inside of a \`@defer\` block or import referenced component/directive dependency using the \`@Component.imports\` field.`;
13813
13731
  const { start, end } = element.startSourceSpan;
13814
- const absoluteSourceSpan = new AbsoluteSourceSpan3(start.offset, end.offset);
13732
+ const absoluteSourceSpan = new AbsoluteSourceSpan4(start.offset, end.offset);
13815
13733
  const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, absoluteSourceSpan);
13816
13734
  if (sourceSpan === null) {
13817
13735
  throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${element.name}'.`);
13818
13736
  }
13819
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
13737
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
13820
13738
  }
13821
13739
  duplicateTemplateVar(id, variable, firstDecl) {
13822
13740
  const mapping = this.resolver.getTemplateSourceMapping(id);
13823
13741
  const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
13824
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, variable.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [
13742
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, variable.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [
13825
13743
  {
13826
13744
  text: `The variable '${firstDecl.name}' was first declared here.`,
13827
13745
  start: firstDecl.sourceSpan.start.offset,
@@ -13862,7 +13780,7 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
13862
13780
  const message = `This structural directive supports advanced type inference, but the current compiler configuration prevents its usage. The variable ${varIdentification} will have type 'any' as a result.
13863
13781
 
13864
13782
  Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
13865
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, diagnosticVar.keySpan, ts58.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
13783
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, diagnosticVar.keySpan, ts60.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
13866
13784
  }
13867
13785
  splitTwoWayBinding(id, input, output, inputConsumer, outputConsumer) {
13868
13786
  const mapping = this.resolver.getTemplateSourceMapping(id);
@@ -13896,7 +13814,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13896
13814
  sourceFile: outputConsumer.name.getSourceFile()
13897
13815
  });
13898
13816
  }
13899
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, input.keySpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
13817
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, input.keySpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
13900
13818
  }
13901
13819
  missingRequiredInputs(id, element, directiveName, isComponent, inputAliases) {
13902
13820
  const message = `Required input${inputAliases.length === 1 ? "" : "s"} ${inputAliases.map((n2) => `'${n2}'`).join(", ")} from ${isComponent ? "component" : "directive"} ${directiveName} must be specified.`;
@@ -13916,7 +13834,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13916
13834
  const end = element.startSourceSpan.end.moveBy(start.offset + name.length - element.startSourceSpan.end.offset);
13917
13835
  span = new ParseSourceSpan2(start, end);
13918
13836
  }
13919
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), span, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
13837
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), span, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
13920
13838
  }
13921
13839
  illegalForLoopTrackAccess(id, block, access) {
13922
13840
  const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, access.sourceSpan);
@@ -13925,7 +13843,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13925
13843
  }
13926
13844
  const messageVars = [block.item, ...block.contextVariables.filter((v) => v.value === "$index")].map((v) => `'${v.name}'`).join(", ");
13927
13845
  const message = `Cannot access '${access.name}' inside of a track expression. Only ${messageVars} and properties on the containing component are available to this expression.`;
13928
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_FOR_LOOP_TRACK_ACCESS), message));
13846
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_FOR_LOOP_TRACK_ACCESS), message));
13929
13847
  }
13930
13848
  inaccessibleDeferredTriggerElement(id, trigger) {
13931
13849
  let message;
@@ -13936,7 +13854,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13936
13854
  Check that an element with #${trigger.reference} exists in the same template and it's accessible from the @defer block.
13937
13855
  Deferred blocks can only access triggers in same view, a parent embedded view or the root view of the @placeholder block.`;
13938
13856
  }
13939
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
13857
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
13940
13858
  }
13941
13859
  controlFlowPreventingContentProjection(id, category, projectionNode, componentName, slotSelector, controlFlowNode, preservesWhitespaces) {
13942
13860
  const blockName = controlFlowNode.nameSpan.toString().trim();
@@ -13958,43 +13876,43 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
13958
13876
  if (sourceSpan === null) {
13959
13877
  throw new Error(`Assertion failure: no SourceLocation found for property write.`);
13960
13878
  }
13961
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_LET_WRITE), `Cannot assign to @let declaration '${target.name}'.`));
13879
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_LET_WRITE), `Cannot assign to @let declaration '${target.name}'.`));
13962
13880
  }
13963
13881
  letUsedBeforeDefinition(id, node, target) {
13964
13882
  const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, node.sourceSpan);
13965
13883
  if (sourceSpan === null) {
13966
13884
  throw new Error(`Assertion failure: no SourceLocation found for property read.`);
13967
13885
  }
13968
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.LET_USED_BEFORE_DEFINITION), `Cannot read @let declaration '${target.name}' before it has been defined.`));
13886
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.LET_USED_BEFORE_DEFINITION), `Cannot read @let declaration '${target.name}' before it has been defined.`));
13969
13887
  }
13970
13888
  conflictingDeclaration(id, decl) {
13971
13889
  const mapping = this.resolver.getTemplateSourceMapping(id);
13972
13890
  const errorMsg = `Cannot declare @let called '${decl.name}' as there is another symbol in the template with the same name.`;
13973
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, decl.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.CONFLICTING_LET_DECLARATION), errorMsg));
13891
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, decl.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.CONFLICTING_LET_DECLARATION), errorMsg));
13974
13892
  }
13975
13893
  missingNamedTemplateDependency(id, node) {
13976
13894
  this._diagnostics.push(makeTemplateDiagnostic(
13977
13895
  id,
13978
13896
  this.resolver.getTemplateSourceMapping(id),
13979
13897
  node.startSourceSpan,
13980
- ts58.DiagnosticCategory.Error,
13898
+ ts60.DiagnosticCategory.Error,
13981
13899
  ngErrorCode(ErrorCode.MISSING_NAMED_TEMPLATE_DEPENDENCY),
13982
13900
  // Wording is meant to mimic the wording TS uses in their diagnostic for missing symbols.
13983
13901
  `Cannot find name "${node instanceof TmplAstDirective ? node.name : node.componentName}". Selectorless references are only supported to classes or non-type import statements.`
13984
13902
  ));
13985
13903
  }
13986
13904
  incorrectTemplateDependencyType(id, node) {
13987
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.startSourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INCORRECT_NAMED_TEMPLATE_DEPENDENCY_TYPE), `Incorrect reference type. Type must be a standalone ${node instanceof TmplAstComponent ? "@Component" : "@Directive"}.`));
13905
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.startSourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INCORRECT_NAMED_TEMPLATE_DEPENDENCY_TYPE), `Incorrect reference type. Type must be a standalone ${node instanceof TmplAstComponent ? "@Component" : "@Directive"}.`));
13988
13906
  }
13989
13907
  unclaimedDirectiveBinding(id, directive, node) {
13990
13908
  const errorMsg = `Directive ${directive.name} does not have an ${node instanceof TmplAstBoundEvent2 ? "output" : "input"} named "${node.name}". Bindings to directives must target existing inputs or outputs.`;
13991
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.keySpan || node.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.UNCLAIMED_DIRECTIVE_BINDING), errorMsg));
13909
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.keySpan || node.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.UNCLAIMED_DIRECTIVE_BINDING), errorMsg));
13992
13910
  }
13993
13911
  deferImplicitTriggerMissingPlaceholder(id, trigger) {
13994
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFER_IMPLICIT_TRIGGER_MISSING_PLACEHOLDER), "Trigger with no target can only be placed on an @defer that has a @placeholder block"));
13912
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFER_IMPLICIT_TRIGGER_MISSING_PLACEHOLDER), "Trigger with no target can only be placed on an @defer that has a @placeholder block"));
13995
13913
  }
13996
13914
  deferImplicitTriggerInvalidPlaceholder(id, trigger) {
13997
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFER_IMPLICIT_TRIGGER_INVALID_PLACEHOLDER), "Trigger with no target can only be placed on an @defer that has a @placeholder block with exactly one root element node"));
13915
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFER_IMPLICIT_TRIGGER_INVALID_PLACEHOLDER), "Trigger with no target can only be placed on an @defer that has a @placeholder block with exactly one root element node"));
13998
13916
  }
13999
13917
  formFieldUnsupportedBinding(id, node) {
14000
13918
  let message;
@@ -14011,7 +13929,7 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
14011
13929
  } else {
14012
13930
  message = `Setting the '${node.name}' attribute is not allowed on nodes using the '[formField]' directive`;
14013
13931
  }
14014
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.FORM_FIELD_UNSUPPORTED_BINDING), message));
13932
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.FORM_FIELD_UNSUPPORTED_BINDING), message));
14015
13933
  }
14016
13934
  };
14017
13935
  function makeInlineDiagnostic(id, code, node, messageText, relatedInformation) {
@@ -14023,7 +13941,7 @@ function makeInlineDiagnostic(id, code, node, messageText, relatedInformation) {
14023
13941
  }
14024
13942
 
14025
13943
  // packages/compiler-cli/src/ngtsc/typecheck/src/shim.js
14026
- import ts59 from "typescript";
13944
+ import ts61 from "typescript";
14027
13945
  var TypeCheckShimGenerator = class {
14028
13946
  extensionPrefix = "ngtypecheck";
14029
13947
  shouldEmit = false;
@@ -14031,7 +13949,7 @@ var TypeCheckShimGenerator = class {
14031
13949
  if (priorShimSf !== null) {
14032
13950
  return priorShimSf;
14033
13951
  }
14034
- return ts59.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts59.ScriptTarget.Latest, true, ts59.ScriptKind.TS);
13952
+ return ts61.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts61.ScriptTarget.Latest, true, ts61.ScriptKind.TS);
14035
13953
  }
14036
13954
  static shimFor(fileName) {
14037
13955
  return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
@@ -14039,71 +13957,9 @@ var TypeCheckShimGenerator = class {
14039
13957
  };
14040
13958
 
14041
13959
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js
14042
- import ts82 from "typescript";
14043
-
14044
- // packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.js
14045
- import { AbsoluteSourceSpan as AbsoluteSourceSpan4 } from "@angular/compiler";
14046
- import ts60 from "typescript";
14047
- function wrapForDiagnostics(expr) {
14048
- return ts60.factory.createParenthesizedExpression(expr);
14049
- }
14050
- function wrapForTypeChecker(expr) {
14051
- return ts60.factory.createParenthesizedExpression(expr);
14052
- }
14053
- function addParseSpanInfo(node, span) {
14054
- let commentText;
14055
- if (span instanceof AbsoluteSourceSpan4) {
14056
- commentText = `${span.start},${span.end}`;
14057
- } else {
14058
- commentText = `${span.start.offset},${span.end.offset}`;
14059
- }
14060
- ts60.addSyntheticTrailingComment(
14061
- node,
14062
- ts60.SyntaxKind.MultiLineCommentTrivia,
14063
- commentText,
14064
- /* hasTrailingNewLine */
14065
- false
14066
- );
14067
- }
14068
- function addTypeCheckId(tcb, id) {
14069
- ts60.addSyntheticLeadingComment(tcb, ts60.SyntaxKind.MultiLineCommentTrivia, id, true);
14070
- }
14071
- function shouldReportDiagnostic(diagnostic) {
14072
- const { code } = diagnostic;
14073
- if (code === 6133) {
14074
- return false;
14075
- } else if (code === 6199) {
14076
- return false;
14077
- } else if (code === 2695) {
14078
- return false;
14079
- } else if (code === 7006) {
14080
- return false;
14081
- }
14082
- return true;
14083
- }
14084
- function translateDiagnostic(diagnostic, resolver) {
14085
- if (diagnostic.file === void 0 || diagnostic.start === void 0) {
14086
- return null;
14087
- }
14088
- const fullMapping = getSourceMapping(
14089
- diagnostic.file,
14090
- diagnostic.start,
14091
- resolver,
14092
- /*isDiagnosticsRequest*/
14093
- true
14094
- );
14095
- if (fullMapping === null) {
14096
- return null;
14097
- }
14098
- const { sourceLocation, sourceMapping: templateSourceMapping, span } = fullMapping;
14099
- return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText, void 0, diagnostic.reportsDeprecated !== void 0 ? {
14100
- reportsDeprecated: diagnostic.reportsDeprecated,
14101
- relatedMessages: diagnostic.relatedInformation
14102
- } : void 0);
14103
- }
13960
+ import ts66 from "typescript";
14104
13961
 
14105
13962
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/context.js
14106
- import ts61 from "typescript";
14107
13963
  var TcbGenericContextBehavior;
14108
13964
  (function(TcbGenericContextBehavior2) {
14109
13965
  TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
@@ -14139,7 +13995,7 @@ var Context2 = class {
14139
13995
  * might change depending on the type of data being stored.
14140
13996
  */
14141
13997
  allocateId() {
14142
- return ts61.factory.createIdentifier(`_t${this.nextId++}`);
13998
+ return `_t${this.nextId++}`;
14143
13999
  }
14144
14000
  getPipeByName(name) {
14145
14001
  if (this.pipes === null || !this.pipes.has(name)) {
@@ -14151,10 +14007,8 @@ var Context2 = class {
14151
14007
 
14152
14008
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/scope.js
14153
14009
  import { TmplAstBoundText, TmplAstComponent as TmplAstComponent3, TmplAstContent, TmplAstDeferredBlock, TmplAstDirective as TmplAstDirective2, TmplAstElement as TmplAstElement8, TmplAstForLoopBlock as TmplAstForLoopBlock2, TmplAstHostElement as TmplAstHostElement5, TmplAstIcu, TmplAstIfBlock as TmplAstIfBlock2, TmplAstIfBlockBranch, TmplAstLetDeclaration as TmplAstLetDeclaration3, TmplAstReference as TmplAstReference2, TmplAstSwitchBlock as TmplAstSwitchBlock2, TmplAstTemplate as TmplAstTemplate5, TmplAstText as TmplAstText2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
14154
- import ts81 from "typescript";
14155
14010
 
14156
14011
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/base.js
14157
- import ts62 from "typescript";
14158
14012
  var TcbOp = class {
14159
14013
  /**
14160
14014
  * Replacement value or operation used while this `TcbOp` is executing (i.e. to resolve circular
@@ -14165,70 +14019,25 @@ var TcbOp = class {
14165
14019
  * circular references.
14166
14020
  */
14167
14021
  circularFallback() {
14168
- return ts62.factory.createNonNullExpression(ts62.factory.createNull());
14022
+ return new TcbExpr("null!");
14169
14023
  }
14170
14024
  };
14171
14025
 
14172
14026
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/template.js
14173
14027
  import { TmplAstBoundAttribute as TmplAstBoundAttribute3, TmplAstTemplate } from "@angular/compiler";
14174
- import ts65 from "typescript";
14175
14028
 
14176
14029
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/expression.js
14177
14030
  import { Binary, BindingPipe, Call as Call3, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead4, R3Identifiers as R3Identifiers4, SafeCall as SafeCall2, SafePropertyRead as SafePropertyRead3, ThisReceiver as ThisReceiver4, TmplAstLetDeclaration as TmplAstLetDeclaration2 } from "@angular/compiler";
14178
- import ts64 from "typescript";
14179
14031
 
14180
14032
  // packages/compiler-cli/src/ngtsc/typecheck/src/expression.js
14181
14033
  import { ASTWithSource, Call as Call2, ImplicitReceiver as ImplicitReceiver3, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2, ThisReceiver as ThisReceiver3 } from "@angular/compiler";
14182
- import ts63 from "typescript";
14183
- function getAnyExpression() {
14184
- return ts63.factory.createAsExpression(ts63.factory.createNumericLiteral("0"), ts63.factory.createKeywordTypeNode(ts63.SyntaxKind.AnyKeyword));
14185
- }
14186
- function astToTypescript(ast, maybeResolve, config) {
14187
- const translator = new AstTranslator(maybeResolve, config);
14034
+ function astToTcbExpr(ast, maybeResolve, config) {
14035
+ const translator = new TcbExprTranslator(maybeResolve, config);
14188
14036
  return translator.translate(ast);
14189
14037
  }
14190
- var AstTranslator = class {
14038
+ var TcbExprTranslator = class {
14191
14039
  maybeResolve;
14192
14040
  config;
14193
- UNDEFINED = ts63.factory.createIdentifier("undefined");
14194
- UNARY_OPS = /* @__PURE__ */ new Map([
14195
- ["+", ts63.SyntaxKind.PlusToken],
14196
- ["-", ts63.SyntaxKind.MinusToken]
14197
- ]);
14198
- BINARY_OPS = /* @__PURE__ */ new Map([
14199
- ["+", ts63.SyntaxKind.PlusToken],
14200
- ["-", ts63.SyntaxKind.MinusToken],
14201
- ["<", ts63.SyntaxKind.LessThanToken],
14202
- [">", ts63.SyntaxKind.GreaterThanToken],
14203
- ["<=", ts63.SyntaxKind.LessThanEqualsToken],
14204
- [">=", ts63.SyntaxKind.GreaterThanEqualsToken],
14205
- ["=", ts63.SyntaxKind.EqualsToken],
14206
- ["==", ts63.SyntaxKind.EqualsEqualsToken],
14207
- ["===", ts63.SyntaxKind.EqualsEqualsEqualsToken],
14208
- ["*", ts63.SyntaxKind.AsteriskToken],
14209
- ["**", ts63.SyntaxKind.AsteriskAsteriskToken],
14210
- ["/", ts63.SyntaxKind.SlashToken],
14211
- ["%", ts63.SyntaxKind.PercentToken],
14212
- ["!=", ts63.SyntaxKind.ExclamationEqualsToken],
14213
- ["!==", ts63.SyntaxKind.ExclamationEqualsEqualsToken],
14214
- ["||", ts63.SyntaxKind.BarBarToken],
14215
- ["&&", ts63.SyntaxKind.AmpersandAmpersandToken],
14216
- ["&", ts63.SyntaxKind.AmpersandToken],
14217
- ["|", ts63.SyntaxKind.BarToken],
14218
- ["??", ts63.SyntaxKind.QuestionQuestionToken],
14219
- ["=", ts63.SyntaxKind.EqualsToken],
14220
- ["+=", ts63.SyntaxKind.PlusEqualsToken],
14221
- ["-=", ts63.SyntaxKind.MinusEqualsToken],
14222
- ["*=", ts63.SyntaxKind.AsteriskEqualsToken],
14223
- ["/=", ts63.SyntaxKind.SlashEqualsToken],
14224
- ["%=", ts63.SyntaxKind.PercentEqualsToken],
14225
- ["**=", ts63.SyntaxKind.AsteriskAsteriskEqualsToken],
14226
- ["&&=", ts63.SyntaxKind.AmpersandAmpersandEqualsToken],
14227
- ["||=", ts63.SyntaxKind.BarBarEqualsToken],
14228
- ["??=", ts63.SyntaxKind.QuestionQuestionEqualsToken],
14229
- ["in", ts63.SyntaxKind.InKeyword],
14230
- ["instanceof", ts63.SyntaxKind.InstanceOfKeyword]
14231
- ]);
14232
14041
  constructor(maybeResolve, config) {
14233
14042
  this.maybeResolve = maybeResolve;
14234
14043
  this.config = config;
@@ -14245,37 +14054,31 @@ var AstTranslator = class {
14245
14054
  }
14246
14055
  visitUnary(ast) {
14247
14056
  const expr = this.translate(ast.expr);
14248
- const op = this.UNARY_OPS.get(ast.operator);
14249
- if (op === void 0) {
14250
- throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
14251
- }
14252
- const node = wrapForDiagnostics(ts63.factory.createPrefixUnaryExpression(op, expr));
14253
- addParseSpanInfo(node, ast.sourceSpan);
14254
- return node;
14057
+ const node = new TcbExpr(`${ast.operator}${expr.print()}`);
14058
+ return node.wrapForTypeChecker().addParseSpanInfo(ast.sourceSpan);
14255
14059
  }
14256
14060
  visitBinary(ast) {
14257
- const lhs = wrapForDiagnostics(this.translate(ast.left));
14258
- const rhs = wrapForDiagnostics(this.translate(ast.right));
14259
- const op = this.BINARY_OPS.get(ast.operation);
14260
- if (op === void 0) {
14261
- throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
14262
- }
14263
- const node = ts63.factory.createBinaryExpression(lhs, op, rhs);
14264
- addParseSpanInfo(node, ast.sourceSpan);
14061
+ const lhs = this.translate(ast.left);
14062
+ const rhs = this.translate(ast.right);
14063
+ lhs.wrapForTypeChecker();
14064
+ rhs.wrapForTypeChecker();
14065
+ const expression = `${lhs.print()} ${ast.operation} ${rhs.print()}`;
14066
+ const node = new TcbExpr(ast.operation === "??" || ast.operation === "**" ? `(${expression})` : expression);
14067
+ node.addParseSpanInfo(ast.sourceSpan);
14265
14068
  return node;
14266
14069
  }
14267
14070
  visitChain(ast) {
14268
- const elements = ast.expressions.map((expr) => this.translate(expr));
14269
- const node = wrapForDiagnostics(ts63.factory.createCommaListExpression(elements));
14270
- addParseSpanInfo(node, ast.sourceSpan);
14071
+ const elements = ast.expressions.map((expr) => this.translate(expr).print());
14072
+ const node = new TcbExpr(elements.join(", "));
14073
+ node.wrapForTypeChecker();
14074
+ node.addParseSpanInfo(ast.sourceSpan);
14271
14075
  return node;
14272
14076
  }
14273
14077
  visitConditional(ast) {
14274
14078
  const condExpr = this.translate(ast.condition);
14275
14079
  const trueExpr = this.translate(ast.trueExp);
14276
- const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
14277
- const node = ts63.factory.createParenthesizedExpression(ts63.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
14278
- addParseSpanInfo(node, ast.sourceSpan);
14080
+ const falseExpr = this.translate(ast.falseExp).wrapForTypeChecker();
14081
+ const node = new TcbExpr(`(${condExpr.print()} ? ${trueExpr.print()} : ${falseExpr.print()})`).addParseSpanInfo(ast.sourceSpan);
14279
14082
  return node;
14280
14083
  }
14281
14084
  visitImplicitReceiver(ast) {
@@ -14285,141 +14088,136 @@ var AstTranslator = class {
14285
14088
  throw new Error("Method not implemented.");
14286
14089
  }
14287
14090
  visitRegularExpressionLiteral(ast, context) {
14288
- return wrapForTypeChecker(ts63.factory.createRegularExpressionLiteral(`/${ast.body}/${ast.flags ?? ""}`));
14091
+ const node = new TcbExpr(`/${ast.body}/${ast.flags ?? ""}`);
14092
+ node.wrapForTypeChecker();
14093
+ return node;
14289
14094
  }
14290
14095
  visitInterpolation(ast) {
14291
- return ast.expressions.reduce((lhs, ast2) => ts63.factory.createBinaryExpression(lhs, ts63.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts63.factory.createStringLiteral(""));
14096
+ const exprs = ast.expressions.map((e) => {
14097
+ const node = this.translate(e);
14098
+ node.wrapForTypeChecker();
14099
+ return node.print();
14100
+ });
14101
+ return new TcbExpr(`"" + ${exprs.join(" + ")}`);
14292
14102
  }
14293
14103
  visitKeyedRead(ast) {
14294
- const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14104
+ const receiver = this.translate(ast.receiver).wrapForTypeChecker();
14295
14105
  const key = this.translate(ast.key);
14296
- const node = ts63.factory.createElementAccessExpression(receiver, key);
14297
- addParseSpanInfo(node, ast.sourceSpan);
14298
- return node;
14106
+ return new TcbExpr(`${receiver.print()}[${key.print()}]`).addParseSpanInfo(ast.sourceSpan);
14299
14107
  }
14300
14108
  visitLiteralArray(ast) {
14301
14109
  const elements = ast.expressions.map((expr) => this.translate(expr));
14302
- const literal4 = ts63.factory.createArrayLiteralExpression(elements);
14303
- const node = this.config.strictLiteralTypes ? literal4 : tsCastToAny(literal4);
14304
- addParseSpanInfo(node, ast.sourceSpan);
14305
- return node;
14110
+ let literal4 = `[${elements.map((el) => el.print()).join(", ")}]`;
14111
+ if (!this.config.strictLiteralTypes) {
14112
+ literal4 = `(${literal4} as any)`;
14113
+ }
14114
+ return new TcbExpr(literal4).addParseSpanInfo(ast.sourceSpan);
14306
14115
  }
14307
14116
  visitLiteralMap(ast) {
14308
14117
  const properties = ast.keys.map((key, idx) => {
14309
14118
  const value = this.translate(ast.values[idx]);
14310
14119
  if (key.kind === "property") {
14311
- const keyNode = ts63.factory.createStringLiteral(key.key);
14312
- addParseSpanInfo(keyNode, key.sourceSpan);
14313
- return ts63.factory.createPropertyAssignment(keyNode, value);
14120
+ const keyNode = new TcbExpr(quoteAndEscape(key.key));
14121
+ keyNode.addParseSpanInfo(key.sourceSpan);
14122
+ return `${keyNode.print()}: ${value.print()}`;
14314
14123
  } else {
14315
- return ts63.factory.createSpreadAssignment(value);
14124
+ return `...${value.print()}`;
14316
14125
  }
14317
14126
  });
14318
- const literal4 = ts63.factory.createObjectLiteralExpression(properties, true);
14319
- const node = this.config.strictLiteralTypes ? literal4 : tsCastToAny(literal4);
14320
- addParseSpanInfo(node, ast.sourceSpan);
14321
- return node;
14127
+ let literal4 = `{ ${properties.join(", ")} }`;
14128
+ if (!this.config.strictLiteralTypes) {
14129
+ literal4 = `${literal4} as any`;
14130
+ }
14131
+ const expression = new TcbExpr(literal4).addParseSpanInfo(ast.sourceSpan);
14132
+ expression.wrapForTypeChecker();
14133
+ return expression;
14322
14134
  }
14323
14135
  visitLiteralPrimitive(ast) {
14324
14136
  let node;
14325
14137
  if (ast.value === void 0) {
14326
- node = ts63.factory.createIdentifier("undefined");
14138
+ node = new TcbExpr("undefined");
14327
14139
  } else if (ast.value === null) {
14328
- node = ts63.factory.createNull();
14140
+ node = new TcbExpr("null");
14329
14141
  } else if (typeof ast.value === "string") {
14330
- node = ts63.factory.createStringLiteral(ast.value);
14142
+ node = new TcbExpr(quoteAndEscape(ast.value));
14331
14143
  } else if (typeof ast.value === "number") {
14332
- node = tsNumericExpression2(ast.value);
14144
+ if (Number.isNaN(ast.value)) {
14145
+ node = new TcbExpr("NaN");
14146
+ } else if (!Number.isFinite(ast.value)) {
14147
+ node = new TcbExpr(ast.value > 0 ? "Infinity" : "-Infinity");
14148
+ } else {
14149
+ node = new TcbExpr(ast.value.toString());
14150
+ }
14333
14151
  } else if (typeof ast.value === "boolean") {
14334
- node = ast.value ? ts63.factory.createTrue() : ts63.factory.createFalse();
14152
+ node = new TcbExpr(ast.value + "");
14335
14153
  } else {
14336
14154
  throw Error(`Unsupported AST value of type ${typeof ast.value}`);
14337
14155
  }
14338
- addParseSpanInfo(node, ast.sourceSpan);
14156
+ node.addParseSpanInfo(ast.sourceSpan);
14339
14157
  return node;
14340
14158
  }
14341
14159
  visitNonNullAssert(ast) {
14342
- const expr = wrapForDiagnostics(this.translate(ast.expression));
14343
- const node = ts63.factory.createNonNullExpression(expr);
14344
- addParseSpanInfo(node, ast.sourceSpan);
14345
- return node;
14160
+ const expr = this.translate(ast.expression).wrapForTypeChecker();
14161
+ return new TcbExpr(`${expr.print()}!`).addParseSpanInfo(ast.sourceSpan);
14346
14162
  }
14347
14163
  visitPipe(ast) {
14348
14164
  throw new Error("Method not implemented.");
14349
14165
  }
14350
14166
  visitPrefixNot(ast) {
14351
- const expression = wrapForDiagnostics(this.translate(ast.expression));
14352
- const node = ts63.factory.createLogicalNot(expression);
14353
- addParseSpanInfo(node, ast.sourceSpan);
14354
- return node;
14167
+ const expression = this.translate(ast.expression).wrapForTypeChecker();
14168
+ return new TcbExpr(`!${expression.print()}`).addParseSpanInfo(ast.sourceSpan);
14355
14169
  }
14356
14170
  visitTypeofExpression(ast) {
14357
- const expression = wrapForDiagnostics(this.translate(ast.expression));
14358
- const node = ts63.factory.createTypeOfExpression(expression);
14359
- addParseSpanInfo(node, ast.sourceSpan);
14360
- return node;
14171
+ const expression = this.translate(ast.expression).wrapForTypeChecker();
14172
+ return new TcbExpr(`typeof ${expression.print()}`).addParseSpanInfo(ast.sourceSpan);
14361
14173
  }
14362
14174
  visitVoidExpression(ast) {
14363
- const expression = wrapForDiagnostics(this.translate(ast.expression));
14364
- const node = ts63.factory.createVoidExpression(expression);
14365
- addParseSpanInfo(node, ast.sourceSpan);
14366
- return node;
14175
+ const expression = this.translate(ast.expression).wrapForTypeChecker();
14176
+ return new TcbExpr(`void ${expression.print()}`).addParseSpanInfo(ast.sourceSpan);
14367
14177
  }
14368
14178
  visitPropertyRead(ast) {
14369
- const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14370
- const name = ts63.factory.createPropertyAccessExpression(receiver, ast.name);
14371
- addParseSpanInfo(name, ast.nameSpan);
14372
- const node = wrapForDiagnostics(name);
14373
- addParseSpanInfo(node, ast.sourceSpan);
14374
- return node;
14179
+ const receiver = this.translate(ast.receiver).wrapForTypeChecker();
14180
+ return new TcbExpr(`${receiver.print()}.${ast.name}`).addParseSpanInfo(ast.nameSpan).wrapForTypeChecker().addParseSpanInfo(ast.sourceSpan);
14375
14181
  }
14376
14182
  visitSafePropertyRead(ast) {
14377
14183
  let node;
14378
- const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14184
+ const receiver = this.translate(ast.receiver).wrapForTypeChecker();
14185
+ const name = new TcbExpr(ast.name).addParseSpanInfo(ast.nameSpan);
14379
14186
  if (this.config.strictSafeNavigationTypes) {
14380
- const expr = ts63.factory.createPropertyAccessExpression(ts63.factory.createNonNullExpression(receiver), ast.name);
14381
- addParseSpanInfo(expr, ast.nameSpan);
14382
- node = ts63.factory.createParenthesizedExpression(ts63.factory.createConditionalExpression(getAnyExpression(), void 0, expr, void 0, this.UNDEFINED));
14187
+ node = new TcbExpr(`(0 as any ? ${receiver.print()}!.${name.print()} : undefined)`);
14383
14188
  } else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
14384
- node = ts63.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
14189
+ node = new TcbExpr(`(${receiver.print()} as any).${name.print()}`);
14385
14190
  } else {
14386
- const expr = ts63.factory.createPropertyAccessExpression(ts63.factory.createNonNullExpression(receiver), ast.name);
14387
- addParseSpanInfo(expr, ast.nameSpan);
14388
- node = tsCastToAny(expr);
14191
+ node = new TcbExpr(`(${receiver.print()}!.${name.print()} as any)`);
14389
14192
  }
14390
- addParseSpanInfo(node, ast.sourceSpan);
14391
- return node;
14193
+ return node.addParseSpanInfo(ast.sourceSpan);
14392
14194
  }
14393
14195
  visitSafeKeyedRead(ast) {
14394
- const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14196
+ const receiver = this.translate(ast.receiver).wrapForTypeChecker();
14395
14197
  const key = this.translate(ast.key);
14396
14198
  let node;
14397
14199
  if (this.config.strictSafeNavigationTypes) {
14398
- const expr = ts63.factory.createElementAccessExpression(ts63.factory.createNonNullExpression(receiver), key);
14399
- addParseSpanInfo(expr, ast.sourceSpan);
14400
- node = ts63.factory.createParenthesizedExpression(ts63.factory.createConditionalExpression(getAnyExpression(), void 0, expr, void 0, this.UNDEFINED));
14200
+ const elementAccess = new TcbExpr(`${receiver.print()}![${key.print()}]`).addParseSpanInfo(ast.sourceSpan);
14201
+ node = new TcbExpr(`(0 as any ? ${elementAccess.print()} : undefined)`);
14401
14202
  } else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
14402
- node = ts63.factory.createElementAccessExpression(tsCastToAny(receiver), key);
14203
+ node = new TcbExpr(`(${receiver.print()} as any)[${key.print()}]`);
14403
14204
  } else {
14404
- const expr = ts63.factory.createElementAccessExpression(ts63.factory.createNonNullExpression(receiver), key);
14405
- addParseSpanInfo(expr, ast.sourceSpan);
14406
- node = tsCastToAny(expr);
14205
+ const elementAccess = new TcbExpr(`${receiver.print()}![${key.print()}]`).addParseSpanInfo(ast.sourceSpan);
14206
+ node = new TcbExpr(`(${elementAccess.print()} as any)`);
14407
14207
  }
14408
- addParseSpanInfo(node, ast.sourceSpan);
14409
- return node;
14208
+ return node.addParseSpanInfo(ast.sourceSpan);
14410
14209
  }
14411
14210
  visitCall(ast) {
14412
14211
  const args = ast.args.map((expr2) => this.translate(expr2));
14413
- let expr;
14414
14212
  const receiver = ast.receiver;
14213
+ let expr;
14415
14214
  if (receiver instanceof PropertyRead3) {
14416
14215
  const resolved = this.maybeResolve(receiver);
14417
14216
  if (resolved !== null) {
14418
14217
  expr = resolved;
14419
14218
  } else {
14420
- const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
14421
- expr = ts63.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
14422
- addParseSpanInfo(expr, receiver.nameSpan);
14219
+ const propertyReceiver = this.translate(receiver.receiver).wrapForTypeChecker();
14220
+ expr = new TcbExpr(`${propertyReceiver.print()}.${receiver.name}`).addParseSpanInfo(receiver.nameSpan);
14423
14221
  }
14424
14222
  } else {
14425
14223
  expr = this.translate(receiver);
@@ -14428,87 +14226,84 @@ var AstTranslator = class {
14428
14226
  if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
14429
14227
  node = this.convertToSafeCall(ast, expr, args);
14430
14228
  } else {
14431
- node = ts63.factory.createCallExpression(expr, void 0, args);
14229
+ node = new TcbExpr(`${expr.print()}(${args.map((arg) => arg.print()).join(", ")})`);
14432
14230
  }
14433
- addParseSpanInfo(node, ast.sourceSpan);
14434
- return node;
14231
+ return node.addParseSpanInfo(ast.sourceSpan);
14435
14232
  }
14436
14233
  visitSafeCall(ast) {
14437
14234
  const args = ast.args.map((expr2) => this.translate(expr2));
14438
- const expr = wrapForDiagnostics(this.translate(ast.receiver));
14439
- const node = this.convertToSafeCall(ast, expr, args);
14440
- addParseSpanInfo(node, ast.sourceSpan);
14441
- return node;
14235
+ const expr = this.translate(ast.receiver).wrapForTypeChecker();
14236
+ return this.convertToSafeCall(ast, expr, args).addParseSpanInfo(ast.sourceSpan);
14442
14237
  }
14443
14238
  visitTemplateLiteral(ast) {
14444
14239
  const length = ast.elements.length;
14445
14240
  const head = ast.elements[0];
14446
14241
  let result;
14447
14242
  if (length === 1) {
14448
- result = ts63.factory.createNoSubstitutionTemplateLiteral(head.text);
14243
+ result = `\`${head.text}\``;
14449
14244
  } else {
14450
- const spans = [];
14245
+ let parts = [`\`${head.text}`];
14451
14246
  const tailIndex = length - 1;
14452
14247
  for (let i = 1; i < tailIndex; i++) {
14453
- const middle = ts63.factory.createTemplateMiddle(ast.elements[i].text);
14454
- spans.push(ts63.factory.createTemplateSpan(this.translate(ast.expressions[i - 1]), middle));
14248
+ const expr = this.translate(ast.expressions[i - 1]);
14249
+ parts.push(`\${${expr.print()}}${ast.elements[i].text}`);
14455
14250
  }
14456
14251
  const resolvedExpression = this.translate(ast.expressions[tailIndex - 1]);
14457
- const templateTail = ts63.factory.createTemplateTail(ast.elements[tailIndex].text);
14458
- spans.push(ts63.factory.createTemplateSpan(resolvedExpression, templateTail));
14459
- result = ts63.factory.createTemplateExpression(ts63.factory.createTemplateHead(head.text), spans);
14252
+ parts.push(`\${${resolvedExpression.print()}}${ast.elements[tailIndex].text}\``);
14253
+ result = parts.join("");
14460
14254
  }
14461
- return result;
14255
+ return new TcbExpr(result);
14462
14256
  }
14463
- visitTemplateLiteralElement(ast, context) {
14257
+ visitTemplateLiteralElement() {
14464
14258
  throw new Error("Method not implemented");
14465
14259
  }
14466
14260
  visitTaggedTemplateLiteral(ast) {
14467
- return ts63.factory.createTaggedTemplateExpression(this.translate(ast.tag), void 0, this.visitTemplateLiteral(ast.template));
14261
+ const tag = this.translate(ast.tag);
14262
+ const template = this.visitTemplateLiteral(ast.template);
14263
+ return new TcbExpr(`${tag.print()}${template.print()}`);
14468
14264
  }
14469
14265
  visitParenthesizedExpression(ast) {
14470
- return ts63.factory.createParenthesizedExpression(this.translate(ast.expression));
14266
+ const expr = this.translate(ast.expression);
14267
+ return new TcbExpr(`(${expr.print()})`);
14471
14268
  }
14472
14269
  visitSpreadElement(ast) {
14473
- const expression = wrapForDiagnostics(this.translate(ast.expression));
14474
- const node = ts63.factory.createSpreadElement(expression);
14475
- addParseSpanInfo(node, ast.sourceSpan);
14270
+ const expression = this.translate(ast.expression);
14271
+ expression.wrapForTypeChecker();
14272
+ const node = new TcbExpr(`...${expression.print()}`);
14273
+ node.addParseSpanInfo(ast.sourceSpan);
14476
14274
  return node;
14477
14275
  }
14478
- visitEmptyExpr(ast, context) {
14479
- const node = ts63.factory.createIdentifier("undefined");
14480
- addParseSpanInfo(node, ast.sourceSpan);
14276
+ visitEmptyExpr(ast) {
14277
+ const node = new TcbExpr("undefined");
14278
+ node.addParseSpanInfo(ast.sourceSpan);
14481
14279
  return node;
14482
14280
  }
14483
14281
  visitArrowFunction(ast) {
14484
- const params = ast.parameters.map((param) => {
14485
- const paramNode = ts63.factory.createParameterDeclaration(void 0, void 0, param.name);
14486
- markIgnoreDiagnostics(paramNode);
14487
- return paramNode;
14488
- });
14489
- const body = astToTypescript(ast.body, (innerAst) => {
14282
+ const params = ast.parameters.map((param) => new TcbExpr(param.name).markIgnoreDiagnostics().print()).join(", ");
14283
+ const body = astToTcbExpr(ast.body, (innerAst) => {
14490
14284
  if (!(innerAst instanceof PropertyRead3) || innerAst.receiver instanceof ThisReceiver3 || !(innerAst.receiver instanceof ImplicitReceiver3)) {
14491
14285
  return this.maybeResolve(innerAst);
14492
14286
  }
14493
14287
  const correspondingParam = ast.parameters.find((arg) => arg.name === innerAst.name);
14494
14288
  if (correspondingParam) {
14495
- const node = ts63.factory.createIdentifier(innerAst.name);
14496
- addParseSpanInfo(node, innerAst.sourceSpan);
14289
+ const node = new TcbExpr(innerAst.name);
14290
+ node.addParseSpanInfo(innerAst.sourceSpan);
14497
14291
  return node;
14498
14292
  }
14499
14293
  return this.maybeResolve(innerAst);
14500
14294
  }, this.config);
14501
- return ts63.factory.createArrowFunction(void 0, void 0, params, void 0, void 0, body);
14295
+ return new TcbExpr(`${ast.parameters.length === 1 ? params : `(${params})`} => ${body.print()}`);
14502
14296
  }
14503
- convertToSafeCall(ast, expr, args) {
14297
+ convertToSafeCall(ast, exprNode, argNodes) {
14298
+ const expr = exprNode.print();
14299
+ const args = argNodes.map((node) => node.print()).join(", ");
14504
14300
  if (this.config.strictSafeNavigationTypes) {
14505
- const call = ts63.factory.createCallExpression(ts63.factory.createNonNullExpression(expr), void 0, args);
14506
- return ts63.factory.createParenthesizedExpression(ts63.factory.createConditionalExpression(getAnyExpression(), void 0, call, void 0, this.UNDEFINED));
14301
+ return new TcbExpr(`(0 as any ? ${expr}!(${args}) : undefined)`);
14507
14302
  }
14508
14303
  if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
14509
- return ts63.factory.createCallExpression(tsCastToAny(expr), void 0, args);
14304
+ return new TcbExpr(`(${expr} as any)(${args})`);
14510
14305
  }
14511
- return tsCastToAny(ts63.factory.createCallExpression(ts63.factory.createNonNullExpression(expr), void 0, args));
14306
+ return new TcbExpr(`(${expr}!(${args}) as any)`);
14512
14307
  }
14513
14308
  };
14514
14309
  var VeSafeLhsInferenceBugDetector = class _VeSafeLhsInferenceBugDetector {
@@ -14610,7 +14405,7 @@ function tcbExpression(ast, tcb, scope) {
14610
14405
  }
14611
14406
  function unwrapWritableSignal(expression, tcb) {
14612
14407
  const unwrapRef = tcb.env.referenceExternalSymbol(R3Identifiers4.unwrapWritableSignal.moduleName, R3Identifiers4.unwrapWritableSignal.name);
14613
- return ts64.factory.createCallExpression(unwrapRef, void 0, [expression]);
14408
+ return new TcbExpr(`${unwrapRef.print()}(${expression.print()})`);
14614
14409
  }
14615
14410
  var TcbExpressionOp = class extends TcbOp {
14616
14411
  tcb;
@@ -14627,7 +14422,7 @@ var TcbExpressionOp = class extends TcbOp {
14627
14422
  }
14628
14423
  execute() {
14629
14424
  const expr = tcbExpression(this.expression, this.tcb, this.scope);
14630
- this.scope.addStatement(ts64.factory.createExpressionStatement(expr));
14425
+ this.scope.addStatement(expr);
14631
14426
  return null;
14632
14427
  }
14633
14428
  };
@@ -14646,7 +14441,7 @@ var TcbConditionOp = class extends TcbOp {
14646
14441
  }
14647
14442
  execute() {
14648
14443
  const expr = tcbExpression(this.expression, this.tcb, this.scope);
14649
- this.scope.addStatement(ts64.factory.createIfStatement(expr, ts64.factory.createBlock([])));
14444
+ this.scope.addStatement(new TcbExpr(`if (${expr.print()}) {}`));
14650
14445
  return null;
14651
14446
  }
14652
14447
  };
@@ -14658,7 +14453,7 @@ var TcbExpressionTranslator = class {
14658
14453
  this.scope = scope;
14659
14454
  }
14660
14455
  translate(ast) {
14661
- return astToTypescript(ast, (ast2) => this.resolve(ast2), this.tcb.env.config);
14456
+ return astToTcbExpr(ast, (ast2) => this.resolve(ast2), this.tcb.env.config);
14662
14457
  }
14663
14458
  /**
14664
14459
  * Resolve an `AST` expression within the given scope.
@@ -14673,7 +14468,7 @@ var TcbExpressionTranslator = class {
14673
14468
  if (target instanceof TmplAstLetDeclaration2 && !this.isValidLetDeclarationAccess(target, ast)) {
14674
14469
  this.tcb.oobRecorder.letUsedBeforeDefinition(this.tcb.id, ast, target);
14675
14470
  if (targetExpression !== null) {
14676
- return ts64.factory.createAsExpression(targetExpression, ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
14471
+ return new TcbExpr(`${targetExpression.print()} as any`);
14677
14472
  }
14678
14473
  }
14679
14474
  return targetExpression;
@@ -14685,62 +14480,51 @@ var TcbExpressionTranslator = class {
14685
14480
  }
14686
14481
  const targetExpression = this.getTargetNodeExpression(target, read);
14687
14482
  const expr = this.translate(ast.right);
14688
- const result = ts64.factory.createParenthesizedExpression(ts64.factory.createBinaryExpression(targetExpression, ts64.SyntaxKind.EqualsToken, expr));
14689
- addParseSpanInfo(result, read.sourceSpan);
14483
+ const result = new TcbExpr(`(${targetExpression.print()} = ${expr.print()})`);
14484
+ result.addParseSpanInfo(read.sourceSpan);
14690
14485
  if (target instanceof TmplAstLetDeclaration2) {
14691
- markIgnoreDiagnostics(result);
14486
+ result.markIgnoreDiagnostics();
14692
14487
  this.tcb.oobRecorder.illegalWriteToLetDeclaration(this.tcb.id, read, target);
14693
14488
  }
14694
14489
  return result;
14695
14490
  } else if (ast instanceof ImplicitReceiver4 || ast instanceof ThisReceiver4) {
14696
- return ts64.factory.createThis();
14491
+ return new TcbExpr("this");
14697
14492
  } else if (ast instanceof BindingPipe) {
14698
14493
  const expr = this.translate(ast.exp);
14699
14494
  const pipeMeta = this.tcb.getPipeByName(ast.name);
14700
14495
  let pipe;
14701
14496
  if (pipeMeta === null) {
14702
14497
  this.tcb.oobRecorder.missingPipe(this.tcb.id, ast, this.tcb.hostIsStandalone);
14703
- pipe = getAnyExpression();
14498
+ pipe = new TcbExpr("(0 as any)");
14704
14499
  } else if (pipeMeta.isExplicitlyDeferred && this.tcb.boundTarget.getEagerlyUsedPipes().includes(ast.name)) {
14705
14500
  this.tcb.oobRecorder.deferredPipeUsedEagerly(this.tcb.id, ast);
14706
- pipe = getAnyExpression();
14501
+ pipe = new TcbExpr("(0 as any)");
14707
14502
  } else {
14708
14503
  pipe = this.tcb.env.pipeInst(pipeMeta.ref);
14709
14504
  }
14710
- const args = ast.args.map((arg) => this.translate(arg));
14711
- let methodAccess = ts64.factory.createPropertyAccessExpression(pipe, "transform");
14712
- addParseSpanInfo(methodAccess, ast.nameSpan);
14505
+ const args = ast.args.map((arg) => this.translate(arg).print());
14506
+ let methodAccess = new TcbExpr(`${pipe.print()}.transform`).addParseSpanInfo(ast.nameSpan);
14713
14507
  if (!this.tcb.env.config.checkTypeOfPipes) {
14714
- methodAccess = ts64.factory.createAsExpression(methodAccess, ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
14508
+ methodAccess = new TcbExpr(`(${methodAccess.print()} as any)`);
14715
14509
  }
14716
- const result = ts64.factory.createCallExpression(
14717
- /* expression */
14718
- methodAccess,
14719
- /* typeArguments */
14720
- void 0,
14721
- /* argumentsArray */
14722
- [expr, ...args]
14723
- );
14724
- addParseSpanInfo(result, ast.sourceSpan);
14725
- return result;
14510
+ const result = new TcbExpr(`${methodAccess.print()}(${[expr.print(), ...args].join(", ")})`);
14511
+ return result.addParseSpanInfo(ast.sourceSpan);
14726
14512
  } else if ((ast instanceof Call3 || ast instanceof SafeCall2) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
14727
14513
  if (ast.receiver.receiver instanceof ImplicitReceiver4 && ast.receiver.name === "$any" && ast.args.length === 1) {
14728
14514
  const expr = this.translate(ast.args[0]);
14729
- const exprAsAny = ts64.factory.createAsExpression(expr, ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
14730
- const result = ts64.factory.createParenthesizedExpression(exprAsAny);
14731
- addParseSpanInfo(result, ast.sourceSpan);
14515
+ const result = new TcbExpr(`(${expr.print()} as any)`);
14516
+ result.addParseSpanInfo(ast.sourceSpan);
14732
14517
  return result;
14733
14518
  }
14734
14519
  const target = this.tcb.boundTarget.getExpressionTarget(ast);
14735
14520
  if (target === null) {
14736
14521
  return null;
14737
14522
  }
14738
- const receiver = this.getTargetNodeExpression(target, ast);
14739
- const method = wrapForDiagnostics(receiver);
14740
- addParseSpanInfo(method, ast.receiver.nameSpan);
14741
- const args = ast.args.map((arg) => this.translate(arg));
14742
- const node = ts64.factory.createCallExpression(method, void 0, args);
14743
- addParseSpanInfo(node, ast.sourceSpan);
14523
+ const method = this.getTargetNodeExpression(target, ast);
14524
+ method.addParseSpanInfo(ast.receiver.nameSpan).wrapForTypeChecker();
14525
+ const args = ast.args.map((arg) => this.translate(arg).print());
14526
+ const node = new TcbExpr(`${method.print()}(${args.join(", ")})`);
14527
+ node.addParseSpanInfo(ast.sourceSpan);
14744
14528
  return node;
14745
14529
  } else {
14746
14530
  return null;
@@ -14748,7 +14532,7 @@ var TcbExpressionTranslator = class {
14748
14532
  }
14749
14533
  getTargetNodeExpression(targetNode, expressionNode) {
14750
14534
  const expr = this.scope.resolve(targetNode);
14751
- addParseSpanInfo(expr, expressionNode.sourceSpan);
14535
+ expr.addParseSpanInfo(expressionNode.sourceSpan);
14752
14536
  return expr;
14753
14537
  }
14754
14538
  isValidLetDeclarationAccess(target, ast) {
@@ -14771,9 +14555,8 @@ var TcbTemplateContextOp = class extends TcbOp {
14771
14555
  // The declaration of the context variable is only needed when the context is actually referenced.
14772
14556
  optional = true;
14773
14557
  execute() {
14774
- const ctx = this.tcb.allocateId();
14775
- const type = ts65.factory.createKeywordTypeNode(ts65.SyntaxKind.AnyKeyword);
14776
- this.scope.addStatement(tsDeclareVariable(ctx, type));
14558
+ const ctx = new TcbExpr(this.tcb.allocateId());
14559
+ this.scope.addStatement(declareVariable(ctx, new TcbExpr("any")));
14777
14560
  return ctx;
14778
14561
  }
14779
14562
  };
@@ -14798,23 +14581,19 @@ var TcbTemplateBodyOp = class extends TcbOp {
14798
14581
  this.addDirectiveGuards(directiveGuards, directive, this.tcb.boundTarget.getDirectivesOfNode(directive));
14799
14582
  }
14800
14583
  if (directiveGuards.length > 0) {
14801
- guard = directiveGuards.reduce((expr, dirGuard) => ts65.factory.createBinaryExpression(expr, ts65.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
14584
+ guard = directiveGuards.reduce((expr, dirGuard) => new TcbExpr(`${expr.print()} && ${dirGuard.print()}`), directiveGuards.pop());
14802
14585
  }
14803
14586
  const tmplScope = this.scope.createChildScope(this.scope, this.template, this.template.children, guard);
14804
14587
  const statements = tmplScope.render();
14805
14588
  if (statements.length === 0) {
14806
14589
  return null;
14807
14590
  }
14808
- let tmplBlock = ts65.factory.createBlock(statements);
14591
+ let tmplBlock = `{
14592
+ ${getStatementsBlock(statements)}}`;
14809
14593
  if (guard !== null) {
14810
- tmplBlock = ts65.factory.createIfStatement(
14811
- /* expression */
14812
- guard,
14813
- /* thenStatement */
14814
- tmplBlock
14815
- );
14594
+ tmplBlock = `if (${guard.print()}) ${tmplBlock}`;
14816
14595
  }
14817
- this.scope.addStatement(tmplBlock);
14596
+ this.scope.addStatement(new TcbExpr(tmplBlock));
14818
14597
  return null;
14819
14598
  }
14820
14599
  addDirectiveGuards(guards, hostNode, directives) {
@@ -14831,15 +14610,12 @@ var TcbTemplateBodyOp = class extends TcbOp {
14831
14610
  }) : void 0);
14832
14611
  if (boundInput !== void 0) {
14833
14612
  const expr = tcbExpression(boundInput.value, this.tcb, this.scope);
14834
- markIgnoreDiagnostics(expr);
14613
+ expr.markIgnoreDiagnostics();
14835
14614
  if (guard.type === "binding") {
14836
14615
  guards.push(expr);
14837
14616
  } else {
14838
- const guardInvoke = tsCallMethod(dirId, `ngTemplateGuard_${guard.inputName}`, [
14839
- dirInstId,
14840
- expr
14841
- ]);
14842
- addParseSpanInfo(guardInvoke, boundInput.value.sourceSpan);
14617
+ const guardInvoke = new TcbExpr(`${dirId.print()}.ngTemplateGuard_${guard.inputName}(${dirInstId.print()}, ${expr.print()})`);
14618
+ guardInvoke.addParseSpanInfo(boundInput.value.sourceSpan);
14843
14619
  guards.push(guardInvoke);
14844
14620
  }
14845
14621
  }
@@ -14847,9 +14623,9 @@ var TcbTemplateBodyOp = class extends TcbOp {
14847
14623
  if (dir.hasNgTemplateContextGuard) {
14848
14624
  if (this.tcb.env.config.applyTemplateContextGuards) {
14849
14625
  const ctx = this.scope.resolve(hostNode);
14850
- const guardInvoke = tsCallMethod(dirId, "ngTemplateContextGuard", [dirInstId, ctx]);
14851
- markIgnoreDiagnostics(guardInvoke);
14852
- addParseSpanInfo(guardInvoke, hostNode.sourceSpan);
14626
+ const guardInvoke = new TcbExpr(`${dirId.print()}.ngTemplateContextGuard(${dirInstId.print()}, ${ctx.print()})`);
14627
+ guardInvoke.markIgnoreDiagnostics();
14628
+ guardInvoke.addParseSpanInfo(hostNode.sourceSpan);
14853
14629
  guards.push(guardInvoke);
14854
14630
  } else if (isTemplate && hostNode.variables.length > 0 && this.tcb.env.config.suggestionsForSuboptimalTypeInference) {
14855
14631
  this.tcb.oobRecorder.suboptimalTypeInference(this.tcb.id, hostNode.variables);
@@ -14875,15 +14651,18 @@ var TcbElementOp = class extends TcbOp {
14875
14651
  }
14876
14652
  execute() {
14877
14653
  const id = this.tcb.allocateId();
14878
- const initializer = tsCreateElement(this.element.name);
14879
- addParseSpanInfo(initializer, this.element.startSourceSpan || this.element.sourceSpan);
14880
- this.scope.addStatement(tsCreateVariable(id, initializer));
14881
- return id;
14654
+ const idNode = new TcbExpr(id);
14655
+ idNode.addParseSpanInfo(this.element.startSourceSpan || this.element.sourceSpan);
14656
+ const initializer = new TcbExpr(`document.createElement("${this.element.name}")`);
14657
+ initializer.addParseSpanInfo(this.element.startSourceSpan || this.element.sourceSpan);
14658
+ const stmt = new TcbExpr(`var ${idNode.print()} = ${initializer.print()}`);
14659
+ stmt.addParseSpanInfo(this.element.startSourceSpan || this.element.sourceSpan);
14660
+ this.scope.addStatement(stmt);
14661
+ return idNode;
14882
14662
  }
14883
14663
  };
14884
14664
 
14885
14665
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/variables.js
14886
- import ts66 from "typescript";
14887
14666
  var TcbBlockImplicitVariableOp = class extends TcbOp {
14888
14667
  tcb;
14889
14668
  scope;
@@ -14898,10 +14677,10 @@ var TcbBlockImplicitVariableOp = class extends TcbOp {
14898
14677
  }
14899
14678
  optional = true;
14900
14679
  execute() {
14901
- const id = this.tcb.allocateId();
14902
- addParseSpanInfo(id, this.variable.keySpan);
14903
- const variable = tsDeclareVariable(id, this.type);
14904
- addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
14680
+ const id = new TcbExpr(this.tcb.allocateId());
14681
+ id.addParseSpanInfo(this.variable.keySpan);
14682
+ const variable = declareVariable(id, this.type);
14683
+ variable.addParseSpanInfo(this.variable.sourceSpan);
14905
14684
  this.scope.addStatement(variable);
14906
14685
  return id;
14907
14686
  }
@@ -14923,22 +14702,15 @@ var TcbTemplateVariableOp = class extends TcbOp {
14923
14702
  }
14924
14703
  execute() {
14925
14704
  const ctx = this.scope.resolve(this.template);
14926
- const id = this.tcb.allocateId();
14927
- const initializer = ts66.factory.createPropertyAccessExpression(
14928
- /* expression */
14929
- ctx,
14930
- /* name */
14931
- this.variable.value || "$implicit"
14932
- );
14933
- addParseSpanInfo(id, this.variable.keySpan);
14934
- let variable;
14705
+ const id = new TcbExpr(this.tcb.allocateId());
14706
+ const initializer = new TcbExpr(`${ctx.print()}.${this.variable.value || "$implicit"}`);
14707
+ id.addParseSpanInfo(this.variable.keySpan);
14935
14708
  if (this.variable.valueSpan !== void 0) {
14936
- addParseSpanInfo(initializer, this.variable.valueSpan);
14937
- variable = tsCreateVariable(id, wrapForTypeChecker(initializer));
14709
+ initializer.addParseSpanInfo(this.variable.valueSpan).wrapForTypeChecker();
14938
14710
  } else {
14939
- variable = tsCreateVariable(id, initializer);
14940
14711
  }
14941
- addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
14712
+ const variable = new TcbExpr(`var ${id.print()} = ${initializer.print()}`);
14713
+ variable.addParseSpanInfo(this.variable.sourceSpan);
14942
14714
  this.scope.addStatement(variable);
14943
14715
  return id;
14944
14716
  }
@@ -14959,17 +14731,17 @@ var TcbBlockVariableOp = class extends TcbOp {
14959
14731
  return false;
14960
14732
  }
14961
14733
  execute() {
14962
- const id = this.tcb.allocateId();
14963
- addParseSpanInfo(id, this.variable.keySpan);
14964
- const variable = tsCreateVariable(id, wrapForTypeChecker(this.initializer));
14965
- addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
14734
+ const id = new TcbExpr(this.tcb.allocateId());
14735
+ id.addParseSpanInfo(this.variable.keySpan);
14736
+ this.initializer.wrapForTypeChecker();
14737
+ const variable = new TcbExpr(`var ${id.print()} = ${this.initializer.print()}`);
14738
+ variable.addParseSpanInfo(this.variable.sourceSpan);
14966
14739
  this.scope.addStatement(variable);
14967
14740
  return id;
14968
14741
  }
14969
14742
  };
14970
14743
 
14971
14744
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/completions.js
14972
- import ts67 from "typescript";
14973
14745
  var TcbComponentContextCompletionOp = class extends TcbOp {
14974
14746
  scope;
14975
14747
  constructor(scope) {
@@ -14978,18 +14750,16 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
14978
14750
  }
14979
14751
  optional = false;
14980
14752
  execute() {
14981
- const ctx = ts67.factory.createThis();
14982
- const ctxDot = ts67.factory.createPropertyAccessExpression(ctx, "");
14983
- markIgnoreDiagnostics(ctxDot);
14984
- addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
14985
- this.scope.addStatement(ts67.factory.createExpressionStatement(ctxDot));
14753
+ const ctx = new TcbExpr("this.");
14754
+ ctx.markIgnoreDiagnostics();
14755
+ ctx.addExpressionIdentifier(ExpressionIdentifier.COMPONENT_COMPLETION);
14756
+ this.scope.addStatement(ctx);
14986
14757
  return null;
14987
14758
  }
14988
14759
  };
14989
14760
 
14990
14761
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/references.js
14991
- import { DYNAMIC_TYPE, TmplAstElement as TmplAstElement2, TmplAstTemplate as TmplAstTemplate2 } from "@angular/compiler";
14992
- import ts68 from "typescript";
14762
+ import { TmplAstElement as TmplAstElement2, TmplAstTemplate as TmplAstTemplate2 } from "@angular/compiler";
14993
14763
  var TcbReferenceOp = class extends TcbOp {
14994
14764
  tcb;
14995
14765
  scope;
@@ -15008,18 +14778,17 @@ var TcbReferenceOp = class extends TcbOp {
15008
14778
  // so it can map a reference variable in the template directly to a node in the TCB.
15009
14779
  optional = true;
15010
14780
  execute() {
15011
- const id = this.tcb.allocateId();
14781
+ const id = new TcbExpr(this.tcb.allocateId());
15012
14782
  let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement2 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
15013
14783
  if (this.target instanceof TmplAstElement2 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
15014
- initializer = ts68.factory.createAsExpression(initializer, ts68.factory.createKeywordTypeNode(ts68.SyntaxKind.AnyKeyword));
14784
+ initializer = new TcbExpr(`${initializer.print()} as any`);
15015
14785
  } else if (this.target instanceof TmplAstTemplate2) {
15016
- initializer = ts68.factory.createAsExpression(initializer, ts68.factory.createKeywordTypeNode(ts68.SyntaxKind.AnyKeyword));
15017
- initializer = ts68.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
15018
- initializer = ts68.factory.createParenthesizedExpression(initializer);
14786
+ const templateRef = this.tcb.env.referenceExternalSymbol("@angular/core", "TemplateRef");
14787
+ initializer = new TcbExpr(`(${initializer.print()} as any as ${templateRef.print()}<any>)`);
15019
14788
  }
15020
- addParseSpanInfo(initializer, this.node.sourceSpan);
15021
- addParseSpanInfo(id, this.node.keySpan);
15022
- this.scope.addStatement(tsCreateVariable(id, initializer));
14789
+ initializer.addParseSpanInfo(this.node.sourceSpan);
14790
+ id.addParseSpanInfo(this.node.keySpan);
14791
+ this.scope.addStatement(new TcbExpr(`var ${id.print()} = ${initializer.print()}`));
15023
14792
  return id;
15024
14793
  }
15025
14794
  };
@@ -15034,14 +14803,13 @@ var TcbInvalidReferenceOp = class extends TcbOp {
15034
14803
  // The declaration of a missing reference is only needed when the reference is resolved.
15035
14804
  optional = true;
15036
14805
  execute() {
15037
- const id = this.tcb.allocateId();
15038
- this.scope.addStatement(tsCreateVariable(id, getAnyExpression()));
14806
+ const id = new TcbExpr(this.tcb.allocateId());
14807
+ this.scope.addStatement(new TcbExpr(`var ${id.print()} = any`));
15039
14808
  return id;
15040
14809
  }
15041
14810
  };
15042
14811
 
15043
14812
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/if_block.js
15044
- import ts69 from "typescript";
15045
14813
  var TcbIfOp = class extends TcbOp {
15046
14814
  tcb;
15047
14815
  scope;
@@ -15068,17 +14836,21 @@ var TcbIfOp = class extends TcbOp {
15068
14836
  }
15069
14837
  if (branch.expression === null) {
15070
14838
  const branchScope = this.getBranchScope(this.scope, branch, index);
15071
- return ts69.factory.createBlock(branchScope.render());
14839
+ return new TcbExpr(`{
14840
+ ${getStatementsBlock(branchScope.render())}}`);
15072
14841
  }
15073
14842
  const outerScope = this.scope.createChildScope(this.scope, branch, [], null);
15074
14843
  outerScope.render().forEach((stmt) => this.scope.addStatement(stmt));
15075
14844
  this.expressionScopes.set(branch, outerScope);
15076
14845
  let expression = tcbExpression(branch.expression, this.tcb, this.scope);
15077
14846
  if (branch.expressionAlias !== null) {
15078
- expression = ts69.factory.createBinaryExpression(ts69.factory.createParenthesizedExpression(expression), ts69.SyntaxKind.AmpersandAmpersandToken, outerScope.resolve(branch.expressionAlias));
14847
+ expression = new TcbExpr(`(${expression.print()}) && ${outerScope.resolve(branch.expressionAlias).print()}`);
15079
14848
  }
15080
14849
  const bodyScope = this.getBranchScope(outerScope, branch, index);
15081
- return ts69.factory.createIfStatement(expression, ts69.factory.createBlock(bodyScope.render()), this.generateBranch(index + 1));
14850
+ const ifStatement = `if (${expression.print()}) {
14851
+ ${getStatementsBlock(bodyScope.render())}}`;
14852
+ const elseBranch = this.generateBranch(index + 1);
14853
+ return new TcbExpr(ifStatement + (elseBranch ? " else " + elseBranch.print() : ""));
15082
14854
  }
15083
14855
  getBranchScope(parentScope, branch, index) {
15084
14856
  const checkBody = this.tcb.env.config.checkControlFlowBodies;
@@ -15098,18 +14870,17 @@ var TcbIfOp = class extends TcbOp {
15098
14870
  let expression;
15099
14871
  expression = tcbExpression(branch.expression, this.tcb, expressionScope);
15100
14872
  if (branch.expressionAlias !== null) {
15101
- expression = ts69.factory.createBinaryExpression(ts69.factory.createParenthesizedExpression(expression), ts69.SyntaxKind.AmpersandAmpersandToken, expressionScope.resolve(branch.expressionAlias));
14873
+ expression = new TcbExpr(`(${expression.print()}) && ${expressionScope.resolve(branch.expressionAlias).print()}`);
15102
14874
  }
15103
- markIgnoreDiagnostics(expression);
15104
- const comparisonExpression = i === index ? expression : ts69.factory.createPrefixUnaryExpression(ts69.SyntaxKind.ExclamationToken, ts69.factory.createParenthesizedExpression(expression));
15105
- guard = guard === null ? comparisonExpression : ts69.factory.createBinaryExpression(guard, ts69.SyntaxKind.AmpersandAmpersandToken, comparisonExpression);
14875
+ expression.markIgnoreDiagnostics();
14876
+ const comparisonExpression = i === index ? expression : new TcbExpr(`!(${expression.print()})`);
14877
+ guard = guard === null ? comparisonExpression : new TcbExpr(`(${guard.print()}) && (${comparisonExpression.print()})`);
15106
14878
  }
15107
14879
  return guard;
15108
14880
  }
15109
14881
  };
15110
14882
 
15111
14883
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/switch_block.js
15112
- import ts70 from "typescript";
15113
14884
  var TcbSwitchOp = class extends TcbOp {
15114
14885
  tcb;
15115
14886
  scope;
@@ -15128,21 +14899,23 @@ var TcbSwitchOp = class extends TcbOp {
15128
14899
  const clauses = this.block.groups.flatMap((current) => {
15129
14900
  const checkBody = this.tcb.env.config.checkControlFlowBodies;
15130
14901
  const clauseScope = this.scope.createChildScope(this.scope, null, checkBody ? current.children : [], checkBody ? this.generateGuard(current, switchExpression) : null);
15131
- const statements = [...clauseScope.render(), ts70.factory.createBreakStatement()];
14902
+ const statements = [...clauseScope.render(), new TcbExpr("break")];
15132
14903
  return current.cases.map((switchCase, index) => {
15133
- const statementsForCase = index === current.cases.length - 1 ? statements : [];
15134
- return switchCase.expression === null ? ts70.factory.createDefaultClause(statementsForCase) : ts70.factory.createCaseClause(tcbExpression(switchCase.expression, this.tcb, this.scope), statementsForCase);
14904
+ const statementsStr = getStatementsBlock(
14905
+ index === current.cases.length - 1 ? statements : [],
14906
+ true
14907
+ /* singleLine */
14908
+ );
14909
+ const source = switchCase.expression === null ? `default: ${statementsStr}` : `case ${tcbExpression(switchCase.expression, this.tcb, this.scope).print()}: ${statementsStr}`;
14910
+ return new TcbExpr(source);
15135
14911
  });
15136
14912
  });
15137
14913
  if (this.block.exhaustiveCheck) {
15138
14914
  const switchValue = tcbExpression(this.block.expression, this.tcb, this.scope);
15139
- clauses.push(ts70.factory.createDefaultClause([
15140
- ts70.factory.createVariableStatement(void 0, ts70.factory.createVariableDeclarationList([
15141
- ts70.factory.createVariableDeclaration(ts70.factory.createUniqueName("tcbExhaustive"), void 0, ts70.factory.createKeywordTypeNode(ts70.SyntaxKind.NeverKeyword), switchValue)
15142
- ], ts70.NodeFlags.Const))
15143
- ]));
14915
+ const exhaustiveId = this.tcb.allocateId();
14916
+ clauses.push(new TcbExpr(`default: const tcbExhaustive${exhaustiveId}: never = ${switchValue.print()};`));
15144
14917
  }
15145
- this.scope.addStatement(ts70.factory.createSwitchStatement(switchExpression, ts70.factory.createCaseBlock(clauses)));
14918
+ this.scope.addStatement(new TcbExpr(`switch (${switchExpression.print()}) { ${clauses.map((c) => c.print()).join("\n")} }`));
15146
14919
  return null;
15147
14920
  }
15148
14921
  generateGuard(group, switchValue) {
@@ -15152,12 +14925,12 @@ var TcbSwitchOp = class extends TcbOp {
15152
14925
  for (const switchCase of group.cases) {
15153
14926
  if (switchCase.expression !== null) {
15154
14927
  const expression = tcbExpression(switchCase.expression, this.tcb, this.scope);
15155
- markIgnoreDiagnostics(expression);
15156
- const comparison = ts70.factory.createBinaryExpression(switchValue, ts70.SyntaxKind.EqualsEqualsEqualsToken, expression);
14928
+ expression.markIgnoreDiagnostics();
14929
+ const comparison = new TcbExpr(`${switchValue.print()} === ${expression.print()}`);
15157
14930
  if (guard2 === null) {
15158
14931
  guard2 = comparison;
15159
14932
  } else {
15160
- guard2 = ts70.factory.createBinaryExpression(guard2, ts70.SyntaxKind.BarBarToken, comparison);
14933
+ guard2 = new TcbExpr(`(${guard2.print()}) || (${comparison.print()})`);
15161
14934
  }
15162
14935
  }
15163
14936
  }
@@ -15173,12 +14946,12 @@ var TcbSwitchOp = class extends TcbOp {
15173
14946
  continue;
15174
14947
  }
15175
14948
  const expression = tcbExpression(switchCase.expression, this.tcb, this.scope);
15176
- markIgnoreDiagnostics(expression);
15177
- const comparison = ts70.factory.createBinaryExpression(switchValue, ts70.SyntaxKind.ExclamationEqualsEqualsToken, expression);
14949
+ expression.markIgnoreDiagnostics();
14950
+ const comparison = new TcbExpr(`${switchValue.print()} !== ${expression.print()}`);
15178
14951
  if (guard === null) {
15179
14952
  guard = comparison;
15180
14953
  } else {
15181
- guard = ts70.factory.createBinaryExpression(guard, ts70.SyntaxKind.AmpersandAmpersandToken, comparison);
14954
+ guard = new TcbExpr(`(${guard.print()}) && (${comparison.print()})`);
15182
14955
  }
15183
14956
  }
15184
14957
  }
@@ -15188,7 +14961,6 @@ var TcbSwitchOp = class extends TcbOp {
15188
14961
 
15189
14962
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/for_block.js
15190
14963
  import { ImplicitReceiver as ImplicitReceiver5, PropertyRead as PropertyRead5, ThisReceiver as ThisReceiver5, TmplAstVariable } from "@angular/compiler";
15191
- import ts71 from "typescript";
15192
14964
  var TcbForOfOp = class extends TcbOp {
15193
14965
  tcb;
15194
14966
  scope;
@@ -15205,19 +14977,14 @@ var TcbForOfOp = class extends TcbOp {
15205
14977
  execute() {
15206
14978
  const loopScope = this.scope.createChildScope(this.scope, this.block, this.tcb.env.config.checkControlFlowBodies ? this.block.children : [], null);
15207
14979
  const initializerId = loopScope.resolve(this.block.item);
15208
- if (!ts71.isIdentifier(initializerId)) {
15209
- throw new Error(`Could not resolve for loop variable ${this.block.item.name} to an identifier`);
15210
- }
15211
- const initializer = ts71.factory.createVariableDeclarationList([ts71.factory.createVariableDeclaration(initializerId)], ts71.NodeFlags.Const);
15212
- addParseSpanInfo(initializer, this.block.item.keySpan);
15213
- const expression = ts71.factory.createNonNullExpression(tcbExpression(this.block.expression, this.tcb, this.scope));
14980
+ const initializer = new TcbExpr(`const ${initializerId.print()}`);
14981
+ initializer.addParseSpanInfo(this.block.item.keySpan);
14982
+ const expression = new TcbExpr(`${tcbExpression(this.block.expression, this.tcb, this.scope).print()}!`);
15214
14983
  const trackTranslator = new TcbForLoopTrackTranslator(this.tcb, loopScope, this.block);
15215
14984
  const trackExpression = trackTranslator.translate(this.block.trackBy);
15216
- const statements = [
15217
- ...loopScope.render(),
15218
- ts71.factory.createExpressionStatement(trackExpression)
15219
- ];
15220
- this.scope.addStatement(ts71.factory.createForOfStatement(void 0, initializer, expression, ts71.factory.createBlock(statements)));
14985
+ const block = getStatementsBlock([...loopScope.render(), trackExpression]);
14986
+ this.scope.addStatement(new TcbExpr(`for (${initializer.print()} of ${expression.print()}) {
14987
+ ${block} }`));
15221
14988
  return null;
15222
14989
  }
15223
14990
  };
@@ -15246,7 +15013,6 @@ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
15246
15013
  };
15247
15014
 
15248
15015
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/let.js
15249
- import ts72 from "typescript";
15250
15016
  var TcbLetDeclarationOp = class extends TcbOp {
15251
15017
  tcb;
15252
15018
  scope;
@@ -15263,11 +15029,10 @@ var TcbLetDeclarationOp = class extends TcbOp {
15263
15029
  */
15264
15030
  optional = false;
15265
15031
  execute() {
15266
- const id = this.tcb.allocateId();
15267
- addParseSpanInfo(id, this.node.nameSpan);
15268
- const value = tcbExpression(this.node.value, this.tcb, this.scope);
15269
- const varStatement = tsCreateVariable(id, wrapForTypeChecker(value), ts72.NodeFlags.Const);
15270
- addParseSpanInfo(varStatement.declarationList.declarations[0], this.node.sourceSpan);
15032
+ const id = new TcbExpr(this.tcb.allocateId()).addParseSpanInfo(this.node.nameSpan);
15033
+ const value = tcbExpression(this.node.value, this.tcb, this.scope).wrapForTypeChecker();
15034
+ const varStatement = new TcbExpr(`const ${id.print()} = ${value.print()}`);
15035
+ varStatement.addParseSpanInfo(this.node.sourceSpan);
15271
15036
  this.scope.addStatement(varStatement);
15272
15037
  return id;
15273
15038
  }
@@ -15275,11 +15040,11 @@ var TcbLetDeclarationOp = class extends TcbOp {
15275
15040
 
15276
15041
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/inputs.js
15277
15042
  import { BindingType as BindingType5, R3Identifiers as R3Identifiers5, TransplantedType } from "@angular/compiler";
15278
- import ts75 from "typescript";
15043
+ import ts63 from "typescript";
15279
15044
 
15280
15045
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/signal_forms.js
15281
15046
  import { BindingType as BindingType3, Call as Call4, PropertyRead as PropertyRead6, SafeCall as SafeCall3, TmplAstElement as TmplAstElement3, TmplAstHostElement as TmplAstHostElement2 } from "@angular/compiler";
15282
- import ts73 from "typescript";
15047
+ import ts62 from "typescript";
15283
15048
  var formControlInputFields = [
15284
15049
  // Should be kept in sync with the `FormUiControl` bindings,
15285
15050
  // defined in `packages/forms/signals/src/api/control.ts`.
@@ -15343,58 +15108,43 @@ var TcbNativeFieldOp = class extends TcbOp {
15343
15108
  return null;
15344
15109
  }
15345
15110
  checkUnsupportedFieldBindings(this.node, this.unsupportedBindingFields, this.tcb);
15346
- const expectedType = this.getExpectedTypeFromDomNode(this.node);
15111
+ const expectedType = new TcbExpr(this.getExpectedTypeFromDomNode(this.node));
15347
15112
  const value = extractFieldValue(fieldBinding.value, this.tcb, this.scope);
15348
- const id = this.tcb.allocateId();
15349
- const assignment = ts73.factory.createBinaryExpression(id, ts73.SyntaxKind.EqualsToken, value);
15350
- addParseSpanInfo(assignment, fieldBinding.valueSpan ?? fieldBinding.sourceSpan);
15351
- this.scope.addStatement(tsDeclareVariable(id, expectedType));
15352
- this.scope.addStatement(ts73.factory.createExpressionStatement(assignment));
15113
+ const id = new TcbExpr(this.tcb.allocateId());
15114
+ const assignment = new TcbExpr(`${id.print()} = ${value.print()}`);
15115
+ assignment.addParseSpanInfo(fieldBinding.valueSpan ?? fieldBinding.sourceSpan);
15116
+ this.scope.addStatement(declareVariable(id, expectedType));
15117
+ this.scope.addStatement(assignment);
15353
15118
  return null;
15354
15119
  }
15355
15120
  getExpectedTypeFromDomNode(node) {
15356
15121
  if (node.name === "textarea" || node.name === "select") {
15357
- return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword);
15122
+ return "string";
15358
15123
  }
15359
15124
  if (node.name !== "input") {
15360
15125
  return this.getUnsupportedType();
15361
15126
  }
15362
15127
  switch (this.inputType) {
15363
15128
  case "checkbox":
15364
- return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.BooleanKeyword);
15129
+ return "boolean";
15365
15130
  case "number":
15366
15131
  case "range":
15367
15132
  case "datetime-local":
15368
- return ts73.factory.createUnionTypeNode([
15369
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword),
15370
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NumberKeyword),
15371
- ts73.factory.createLiteralTypeNode(ts73.factory.createNull())
15372
- ]);
15133
+ return "string | number | null";
15373
15134
  case "date":
15374
15135
  case "month":
15375
15136
  case "time":
15376
15137
  case "week":
15377
- return ts73.factory.createUnionTypeNode([
15378
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword),
15379
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NumberKeyword),
15380
- ts73.factory.createTypeReferenceNode("Date"),
15381
- ts73.factory.createLiteralTypeNode(ts73.factory.createNull())
15382
- ]);
15138
+ return "string | number | Date | null";
15383
15139
  }
15384
15140
  const hasDynamicType = this.inputType === null && this.node.inputs.some((input) => (input.type === BindingType3.Property || input.type === BindingType3.Attribute) && input.name === "type");
15385
15141
  if (hasDynamicType) {
15386
- return ts73.factory.createUnionTypeNode([
15387
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword),
15388
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NumberKeyword),
15389
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.BooleanKeyword),
15390
- ts73.factory.createTypeReferenceNode("Date"),
15391
- ts73.factory.createLiteralTypeNode(ts73.factory.createNull())
15392
- ]);
15142
+ return "string | number | boolean | Date | null";
15393
15143
  }
15394
- return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword);
15144
+ return "string";
15395
15145
  }
15396
15146
  getUnsupportedType() {
15397
- return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NeverKeyword);
15147
+ return "never";
15398
15148
  }
15399
15149
  };
15400
15150
  var TcbNativeRadioButtonFieldOp = class extends TcbNativeFieldOp {
@@ -15408,12 +15158,12 @@ var TcbNativeRadioButtonFieldOp = class extends TcbNativeFieldOp {
15408
15158
  return attr.type === BindingType3.Property && attr.name === "value";
15409
15159
  });
15410
15160
  if (valueBinding !== void 0) {
15411
- const id = this.tcb.allocateId();
15161
+ const id = new TcbExpr(this.tcb.allocateId());
15412
15162
  const value = tcbExpression(valueBinding.value, this.tcb, this.scope);
15413
- const assignment = ts73.factory.createBinaryExpression(id, ts73.SyntaxKind.EqualsToken, value);
15414
- addParseSpanInfo(assignment, valueBinding.sourceSpan);
15415
- this.scope.addStatement(tsDeclareVariable(id, ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword)));
15416
- this.scope.addStatement(ts73.factory.createExpressionStatement(assignment));
15163
+ const assignment = new TcbExpr(`${id.print()} = ${value.print()}`);
15164
+ assignment.addParseSpanInfo(valueBinding.sourceSpan);
15165
+ this.scope.addStatement(declareVariable(id, new TcbExpr("string")));
15166
+ this.scope.addStatement(assignment);
15417
15167
  }
15418
15168
  return null;
15419
15169
  }
@@ -15452,7 +15202,7 @@ function isFieldDirective(meta) {
15452
15202
  if (meta.ref.bestGuessOwningModule?.specifier === "@angular/forms/signals") {
15453
15203
  return true;
15454
15204
  }
15455
- return ts73.isClassDeclaration(meta.ref.node) && meta.ref.node.members.some((member) => ts73.isPropertyDeclaration(member) && ts73.isComputedPropertyName(member.name) && ts73.isIdentifier(member.name.expression) && member.name.expression.text === "\u0275NgFieldDirective");
15205
+ return ts62.isClassDeclaration(meta.ref.node) && meta.ref.node.members.some((member) => ts62.isPropertyDeclaration(member) && ts62.isComputedPropertyName(member.name) && ts62.isIdentifier(member.name.expression) && member.name.expression.text === "\u0275NgFieldDirective");
15456
15206
  }
15457
15207
  function getSyntheticFieldBoundInput(dir, inputName, fieldPropertyName, fieldBinding, customFieldType) {
15458
15208
  const inputs = dir.inputs.getByBindingPropertyName(inputName);
@@ -15524,9 +15274,9 @@ function checkUnsupportedFieldBindings(node, unsupportedBindingFields, tcb) {
15524
15274
  }
15525
15275
  }
15526
15276
  function extractFieldValue(expression, tcb, scope) {
15527
- const innerCall = ts73.factory.createCallExpression(tcbExpression(expression, tcb, scope), void 0, void 0);
15528
- markIgnoreDiagnostics(innerCall);
15529
- return ts73.factory.createCallExpression(ts73.factory.createPropertyAccessExpression(innerCall, "value"), void 0, void 0);
15277
+ const innerCall = new TcbExpr(tcbExpression(expression, tcb, scope).print() + "()");
15278
+ innerCall.markIgnoreDiagnostics();
15279
+ return new TcbExpr(`${innerCall.print()}.value()`);
15530
15280
  }
15531
15281
  function hasModelInput(name, meta) {
15532
15282
  return meta.inputs.hasBindingPropertyName(name) && meta.outputs.hasBindingPropertyName(name + "Change");
@@ -15545,8 +15295,7 @@ function isFormControl(allDirectiveMatches) {
15545
15295
  }
15546
15296
 
15547
15297
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/bindings.js
15548
- import { BindingType as BindingType4, TmplAstBoundAttribute as TmplAstBoundAttribute4, TmplAstElement as TmplAstElement4, TmplAstTemplate as TmplAstTemplate3 } from "@angular/compiler";
15549
- import ts74 from "typescript";
15298
+ import { BindingType as BindingType4, LiteralArray, LiteralMap, TmplAstBoundAttribute as TmplAstBoundAttribute4, TmplAstElement as TmplAstElement4, TmplAstTemplate as TmplAstTemplate3 } from "@angular/compiler";
15550
15299
  function getBoundAttributes(directive, node) {
15551
15300
  const boundInputs = [];
15552
15301
  const processAttribute = (attr) => {
@@ -15602,14 +15351,14 @@ function checkSplitTwoWayBinding(inputName, output, inputs, tcb) {
15602
15351
  }
15603
15352
  return false;
15604
15353
  }
15605
- function widenBinding(expr, tcb) {
15354
+ function widenBinding(expr, tcb, originalValue) {
15606
15355
  if (!tcb.env.config.checkTypeOfInputBindings) {
15607
- return tsCastToAny(expr);
15356
+ return new TcbExpr(`((${expr.print()}) as any)`);
15608
15357
  } else if (!tcb.env.config.strictNullInputBindings) {
15609
- if (ts74.isObjectLiteralExpression(expr) || ts74.isArrayLiteralExpression(expr)) {
15358
+ if (originalValue instanceof LiteralMap || originalValue instanceof LiteralArray) {
15610
15359
  return expr;
15611
15360
  } else {
15612
- return ts74.factory.createNonNullExpression(expr);
15361
+ return new TcbExpr(`(${expr.print()})!`);
15613
15362
  }
15614
15363
  } else {
15615
15364
  return expr;
@@ -15619,7 +15368,7 @@ function widenBinding(expr, tcb) {
15619
15368
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/inputs.js
15620
15369
  function translateInput(value, tcb, scope) {
15621
15370
  if (typeof value === "string") {
15622
- return ts75.factory.createStringLiteral(value);
15371
+ return new TcbExpr(quoteAndEscape(value));
15623
15372
  } else {
15624
15373
  return tcbExpression(value, tcb, scope);
15625
15374
  }
@@ -15657,8 +15406,8 @@ var TcbDirectiveInputsOp = class extends TcbOp {
15657
15406
  }
15658
15407
  }
15659
15408
  for (const attr of boundAttrs) {
15660
- const expr = widenBinding(translateInput(attr.value, this.tcb, this.scope), this.tcb);
15661
- let assignment = wrapForDiagnostics(expr);
15409
+ let assignment = widenBinding(translateInput(attr.value, this.tcb, this.scope), this.tcb, attr.value);
15410
+ assignment.wrapForTypeChecker();
15662
15411
  for (const { fieldName, required, transformType, isSignal, isTwoWayBinding } of attr.inputs) {
15663
15412
  let target;
15664
15413
  if (required) {
@@ -15667,16 +15416,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
15667
15416
  if (this.dir.coercedInputFields.has(fieldName)) {
15668
15417
  let type;
15669
15418
  if (transformType !== null) {
15670
- type = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
15419
+ const tsType = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
15420
+ type = new TcbExpr(tempPrint(tsType, transformType.node.getSourceFile()));
15671
15421
  } else {
15672
15422
  const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
15673
- if (!ts75.isTypeReferenceNode(dirTypeRef)) {
15423
+ if (!ts63.isTypeReferenceNode(dirTypeRef)) {
15674
15424
  throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
15675
15425
  }
15676
- type = tsCreateTypeQueryForCoercedInput(dirTypeRef.typeName, fieldName);
15426
+ const typeName = ts63.isIdentifier(dirTypeRef.typeName) ? dirTypeRef.typeName.text : tempPrint(dirTypeRef.typeName, dirTypeRef.typeName.getSourceFile());
15427
+ type = new TcbExpr(`typeof ${typeName}.ngAcceptInputType_${fieldName}`);
15677
15428
  }
15678
- const id = this.tcb.allocateId();
15679
- this.scope.addStatement(tsDeclareVariable(id, type));
15429
+ const id = new TcbExpr(this.tcb.allocateId());
15430
+ this.scope.addStatement(declareVariable(id, type));
15680
15431
  target = id;
15681
15432
  } else if (this.dir.undeclaredInputFields.has(fieldName)) {
15682
15433
  continue;
@@ -15684,41 +15435,38 @@ var TcbDirectiveInputsOp = class extends TcbOp {
15684
15435
  if (dirId === null) {
15685
15436
  dirId = this.scope.resolve(this.node, this.dir);
15686
15437
  }
15687
- const id = this.tcb.allocateId();
15438
+ const id = new TcbExpr(this.tcb.allocateId());
15688
15439
  const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
15689
- if (!ts75.isTypeReferenceNode(dirTypeRef)) {
15440
+ if (!ts63.isTypeReferenceNode(dirTypeRef)) {
15690
15441
  throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
15691
15442
  }
15692
- const type = ts75.factory.createIndexedAccessTypeNode(ts75.factory.createTypeQueryNode(dirId), ts75.factory.createLiteralTypeNode(ts75.factory.createStringLiteral(fieldName)));
15693
- const temp = tsDeclareVariable(id, type);
15443
+ const type = new TcbExpr(`(typeof ${dirId.print()})[${quoteAndEscape(fieldName)}]`);
15444
+ const temp = declareVariable(id, type);
15694
15445
  this.scope.addStatement(temp);
15695
15446
  target = id;
15696
15447
  } else {
15697
15448
  if (dirId === null) {
15698
15449
  dirId = this.scope.resolve(this.node, this.dir);
15699
15450
  }
15700
- target = this.dir.stringLiteralInputFields.has(fieldName) ? ts75.factory.createElementAccessExpression(dirId, ts75.factory.createStringLiteral(fieldName)) : ts75.factory.createPropertyAccessExpression(dirId, ts75.factory.createIdentifier(fieldName));
15451
+ target = this.dir.stringLiteralInputFields.has(fieldName) ? new TcbExpr(`${dirId.print()}[${quoteAndEscape(fieldName)}]`) : new TcbExpr(`${dirId.print()}.${fieldName}`);
15701
15452
  }
15702
15453
  if (isSignal) {
15703
15454
  const inputSignalBrandWriteSymbol = this.tcb.env.referenceExternalSymbol(R3Identifiers5.InputSignalBrandWriteType.moduleName, R3Identifiers5.InputSignalBrandWriteType.name);
15704
- if (!ts75.isIdentifier(inputSignalBrandWriteSymbol) && !ts75.isPropertyAccessExpression(inputSignalBrandWriteSymbol)) {
15705
- throw new Error(`Expected identifier or property access for reference to ${R3Identifiers5.InputSignalBrandWriteType.name}`);
15706
- }
15707
- target = ts75.factory.createElementAccessExpression(target, inputSignalBrandWriteSymbol);
15455
+ target = new TcbExpr(`${target.print()}[${inputSignalBrandWriteSymbol.print()}]`);
15708
15456
  }
15709
15457
  if (attr.keySpan !== null) {
15710
- addParseSpanInfo(target, attr.keySpan);
15458
+ target.addParseSpanInfo(attr.keySpan);
15711
15459
  }
15712
15460
  if (isTwoWayBinding && this.tcb.env.config.allowSignalsInTwoWayBindings) {
15713
15461
  assignment = unwrapWritableSignal(assignment, this.tcb);
15714
15462
  }
15715
- assignment = ts75.factory.createBinaryExpression(target, ts75.SyntaxKind.EqualsToken, assignment);
15463
+ assignment = new TcbExpr(`${target.print()} = ${assignment.print()}`);
15716
15464
  }
15717
- addParseSpanInfo(assignment, attr.sourceSpan);
15465
+ assignment.addParseSpanInfo(attr.sourceSpan);
15718
15466
  if (!this.tcb.env.config.checkTypeOfAttributes && typeof attr.value === "string") {
15719
- markIgnoreDiagnostics(assignment);
15467
+ assignment.markIgnoreDiagnostics();
15720
15468
  }
15721
- this.scope.addStatement(ts75.factory.createExpressionStatement(assignment));
15469
+ this.scope.addStatement(assignment);
15722
15470
  }
15723
15471
  this.checkRequiredInputs(seenRequiredInputs);
15724
15472
  return null;
@@ -15759,22 +15507,20 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
15759
15507
  if (isPropertyBinding && this.claimedInputs?.has(binding.name)) {
15760
15508
  continue;
15761
15509
  }
15762
- const expr = widenBinding(tcbExpression(binding.value, this.tcb, this.scope), this.tcb);
15510
+ const expr = widenBinding(tcbExpression(binding.value, this.tcb, this.scope), this.tcb, binding.value);
15763
15511
  if (this.tcb.env.config.checkTypeOfDomBindings && isPropertyBinding) {
15764
15512
  if (binding.name !== "style" && binding.name !== "class") {
15765
15513
  if (elId === null) {
15766
15514
  elId = this.scope.resolve(this.target);
15767
15515
  }
15768
15516
  const propertyName = REGISTRY.getMappedPropName(binding.name);
15769
- const prop = ts75.factory.createElementAccessExpression(elId, ts75.factory.createStringLiteral(propertyName));
15770
- const stmt = ts75.factory.createBinaryExpression(prop, ts75.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
15771
- addParseSpanInfo(stmt, binding.sourceSpan);
15772
- this.scope.addStatement(ts75.factory.createExpressionStatement(stmt));
15517
+ const stmt = new TcbExpr(`${elId.print()}[${quoteAndEscape(propertyName)}] = ${expr.wrapForTypeChecker().print()}`).addParseSpanInfo(binding.sourceSpan);
15518
+ this.scope.addStatement(stmt);
15773
15519
  } else {
15774
- this.scope.addStatement(ts75.factory.createExpressionStatement(expr));
15520
+ this.scope.addStatement(expr);
15775
15521
  }
15776
15522
  } else {
15777
- this.scope.addStatement(ts75.factory.createExpressionStatement(expr));
15523
+ this.scope.addStatement(expr);
15778
15524
  }
15779
15525
  }
15780
15526
  return null;
@@ -15801,10 +15547,10 @@ var TcbComponentNodeOp = class extends TcbOp {
15801
15547
  }
15802
15548
  execute() {
15803
15549
  const id = this.tcb.allocateId();
15804
- const initializer = tsCreateElement(getComponentTagName(this.component));
15805
- addParseSpanInfo(initializer, this.component.startSourceSpan || this.component.sourceSpan);
15806
- this.scope.addStatement(tsCreateVariable(id, initializer));
15807
- return id;
15550
+ const initializer = new TcbExpr(`document.createElement("${getComponentTagName(this.component)}")`);
15551
+ initializer.addParseSpanInfo(this.component.startSourceSpan || this.component.sourceSpan);
15552
+ this.scope.addStatement(new TcbExpr(`var ${id} = ${initializer.print()}`));
15553
+ return new TcbExpr(id);
15808
15554
  }
15809
15555
  };
15810
15556
 
@@ -15854,7 +15600,6 @@ var TcbDomSchemaCheckerOp = class extends TcbOp {
15854
15600
 
15855
15601
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/events.js
15856
15602
  import { ImplicitReceiver as ImplicitReceiver6, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead7, TmplAstElement as TmplAstElement6 } from "@angular/compiler";
15857
- import ts76 from "typescript";
15858
15603
  var EVENT_PARAMETER = "$event";
15859
15604
  function tcbEventHandlerExpression(ast, tcb, scope) {
15860
15605
  const translator = new TcbEventHandlerTranslator(tcb, scope);
@@ -15894,8 +15639,8 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15894
15639
  if (dirId === null) {
15895
15640
  dirId = this.scope.resolve(this.node, this.dir);
15896
15641
  }
15897
- const outputField = ts76.factory.createElementAccessExpression(dirId, ts76.factory.createStringLiteral(field));
15898
- addParseSpanInfo(outputField, output.keySpan);
15642
+ const outputField = new TcbExpr(`${dirId.print()}[${quoteAndEscape(field)}]`);
15643
+ outputField.addParseSpanInfo(output.keySpan);
15899
15644
  if (this.tcb.env.config.checkTypeOfOutputEvents) {
15900
15645
  const handler = tcbCreateEventHandler(
15901
15646
  output,
@@ -15904,19 +15649,11 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15904
15649
  0
15905
15650
  /* EventParamType.Infer */
15906
15651
  );
15907
- const subscribeFn = ts76.factory.createPropertyAccessExpression(outputField, "subscribe");
15908
- const call = ts76.factory.createCallExpression(
15909
- subscribeFn,
15910
- /* typeArguments */
15911
- void 0,
15912
- [
15913
- handler
15914
- ]
15915
- );
15916
- addParseSpanInfo(call, output.sourceSpan);
15917
- this.scope.addStatement(ts76.factory.createExpressionStatement(call));
15652
+ const call = new TcbExpr(`${outputField.print()}.subscribe(${handler.print()})`);
15653
+ call.addParseSpanInfo(output.sourceSpan);
15654
+ this.scope.addStatement(call);
15918
15655
  } else {
15919
- this.scope.addStatement(ts76.factory.createExpressionStatement(outputField));
15656
+ this.scope.addStatement(outputField);
15920
15657
  const handler = tcbCreateEventHandler(
15921
15658
  output,
15922
15659
  this.tcb,
@@ -15924,7 +15661,7 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15924
15661
  1
15925
15662
  /* EventParamType.Any */
15926
15663
  );
15927
- this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15664
+ this.scope.addStatement(handler);
15928
15665
  }
15929
15666
  }
15930
15667
  return null;
@@ -15962,41 +15699,32 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
15962
15699
  }
15963
15700
  }
15964
15701
  if (output.type === ParsedEventType2.LegacyAnimation) {
15965
- const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
15702
+ const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalSymbol("@angular/animations", "AnimationEvent").print() : 1;
15966
15703
  const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
15967
- this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15704
+ this.scope.addStatement(handler);
15968
15705
  } else if (output.type === ParsedEventType2.Animation) {
15969
- const eventType = this.tcb.env.referenceExternalType("@angular/core", "AnimationCallbackEvent");
15970
- const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
15971
- this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15706
+ const eventType = this.tcb.env.referenceExternalSymbol("@angular/core", "AnimationCallbackEvent");
15707
+ const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType.print());
15708
+ this.scope.addStatement(handler);
15972
15709
  } else if (this.tcb.env.config.checkTypeOfDomEvents) {
15973
15710
  let target;
15974
15711
  let domEventAssertion;
15975
15712
  if (output.target === "window" || output.target === "document") {
15976
- target = ts76.factory.createIdentifier(output.target);
15713
+ target = new TcbExpr(output.target);
15977
15714
  } else if (elId === null) {
15978
15715
  target = elId = this.scope.resolve(this.target);
15979
15716
  } else {
15980
15717
  target = elId;
15981
15718
  }
15982
- if (this.target instanceof TmplAstElement6 && this.target.isVoid && ts76.isIdentifier(target) && this.tcb.env.config.allowDomEventAssertion) {
15983
- domEventAssertion = ts76.factory.createCallExpression(this.tcb.env.referenceExternalSymbol("@angular/core", "\u0275assertType"), [ts76.factory.createTypeQueryNode(target)], [
15984
- ts76.factory.createPropertyAccessExpression(ts76.factory.createIdentifier(EVENT_PARAMETER), "target")
15985
- ]);
15719
+ if (this.target instanceof TmplAstElement6 && this.target.isVoid && this.tcb.env.config.allowDomEventAssertion) {
15720
+ const assertUtil = this.tcb.env.referenceExternalSymbol("@angular/core", "\u0275assertType");
15721
+ domEventAssertion = new TcbExpr(`${assertUtil.print()}<typeof ${target.print()}>(${EVENT_PARAMETER}.target)`);
15986
15722
  }
15987
- const propertyAccess = ts76.factory.createPropertyAccessExpression(target, "addEventListener");
15988
- addParseSpanInfo(propertyAccess, output.keySpan);
15723
+ const propertyAccess = new TcbExpr(`${target.print()}.addEventListener`).addParseSpanInfo(output.keySpan);
15989
15724
  const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0, domEventAssertion);
15990
- const call = ts76.factory.createCallExpression(
15991
- /* expression */
15992
- propertyAccess,
15993
- /* typeArguments */
15994
- void 0,
15995
- /* arguments */
15996
- [ts76.factory.createStringLiteral(output.name), handler]
15997
- );
15998
- addParseSpanInfo(call, output.sourceSpan);
15999
- this.scope.addStatement(ts76.factory.createExpressionStatement(call));
15725
+ const call = new TcbExpr(`${propertyAccess.print()}(${quoteAndEscape(output.name)}, ${handler.print()})`);
15726
+ call.addParseSpanInfo(output.sourceSpan);
15727
+ this.scope.addStatement(call);
16000
15728
  } else {
16001
15729
  const handler = tcbCreateEventHandler(
16002
15730
  output,
@@ -16005,7 +15733,7 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
16005
15733
  1
16006
15734
  /* EventParamType.Any */
16007
15735
  );
16008
- this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15736
+ this.scope.addStatement(handler);
16009
15737
  }
16010
15738
  }
16011
15739
  return null;
@@ -16014,9 +15742,7 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
16014
15742
  var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
16015
15743
  resolve(ast) {
16016
15744
  if (ast instanceof PropertyRead7 && ast.receiver instanceof ImplicitReceiver6 && ast.name === EVENT_PARAMETER) {
16017
- const event = ts76.factory.createIdentifier(EVENT_PARAMETER);
16018
- addParseSpanInfo(event, ast.nameSpan);
16019
- return event;
15745
+ return new TcbExpr(EVENT_PARAMETER).addParseSpanInfo(ast.nameSpan);
16020
15746
  }
16021
15747
  return super.resolve(ast);
16022
15748
  }
@@ -16028,60 +15754,37 @@ function tcbCreateEventHandler(event, tcb, scope, eventType, assertionExpression
16028
15754
  const handler = tcbEventHandlerExpression(event.handler, tcb, scope);
16029
15755
  const statements = [];
16030
15756
  if (assertionExpression !== void 0) {
16031
- statements.push(ts76.factory.createExpressionStatement(assertionExpression));
15757
+ statements.push(assertionExpression);
16032
15758
  }
16033
15759
  if (event.type === ParsedEventType2.TwoWay && tcb.env.config.checkTwoWayBoundEvents) {
16034
15760
  const target = tcb.allocateId();
16035
- const assignment = ts76.factory.createBinaryExpression(target, ts76.SyntaxKind.EqualsToken, ts76.factory.createIdentifier(EVENT_PARAMETER));
16036
- statements.push(tsCreateVariable(target, tcb.env.config.allowSignalsInTwoWayBindings ? unwrapWritableSignal(handler, tcb) : handler), ts76.factory.createExpressionStatement(assignment));
15761
+ const initializer = tcb.env.config.allowSignalsInTwoWayBindings ? unwrapWritableSignal(handler, tcb) : handler;
15762
+ statements.push(new TcbExpr(`var ${target} = ${initializer.print()}`), new TcbExpr(`${target} = ${EVENT_PARAMETER}`));
16037
15763
  } else {
16038
- statements.push(ts76.factory.createExpressionStatement(handler));
15764
+ statements.push(handler);
16039
15765
  }
16040
15766
  let eventParamType;
16041
15767
  if (eventType === 0) {
16042
15768
  eventParamType = void 0;
16043
15769
  } else if (eventType === 1) {
16044
- eventParamType = ts76.factory.createKeywordTypeNode(ts76.SyntaxKind.AnyKeyword);
15770
+ eventParamType = "any";
16045
15771
  } else {
16046
15772
  eventParamType = eventType;
16047
15773
  }
16048
15774
  const guards = scope.guards();
16049
- let body = ts76.factory.createBlock(statements);
15775
+ let body = `{
15776
+ ${getStatementsBlock(statements)} }`;
16050
15777
  if (guards !== null) {
16051
- body = ts76.factory.createBlock([ts76.factory.createIfStatement(guards, body)]);
15778
+ body = `{ if (${guards.print()}) ${body} }`;
16052
15779
  }
16053
- const eventParam = ts76.factory.createParameterDeclaration(
16054
- /* modifiers */
16055
- void 0,
16056
- /* dotDotDotToken */
16057
- void 0,
16058
- /* name */
16059
- EVENT_PARAMETER,
16060
- /* questionToken */
16061
- void 0,
16062
- /* type */
16063
- eventParamType
16064
- );
16065
- addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
16066
- return ts76.factory.createArrowFunction(
16067
- /* modifiers */
16068
- void 0,
16069
- /* typeParameters */
16070
- void 0,
16071
- /* parameters */
16072
- [eventParam],
16073
- /* type */
16074
- ts76.factory.createKeywordTypeNode(ts76.SyntaxKind.AnyKeyword),
16075
- /* equalsGreaterThanToken */
16076
- void 0,
16077
- /* body */
16078
- body
16079
- );
15780
+ const eventParam = new TcbExpr(`${EVENT_PARAMETER}${eventParamType === void 0 ? "" : ": " + eventParamType}`);
15781
+ eventParam.addExpressionIdentifier(ExpressionIdentifier.EVENT_PARAMETER);
15782
+ return new TcbExpr(`(${eventParam.print()}): any => ${body}`);
16080
15783
  }
16081
15784
 
16082
15785
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/directive_type.js
16083
15786
  import { TmplAstHostElement as TmplAstHostElement3 } from "@angular/compiler";
16084
- import ts77 from "typescript";
15787
+ import ts64 from "typescript";
16085
15788
  var TcbDirectiveTypeOpBase = class extends TcbOp {
16086
15789
  tcb;
16087
15790
  scope;
@@ -16103,23 +15806,21 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
16103
15806
  let type;
16104
15807
  let span;
16105
15808
  if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
16106
- type = rawType;
15809
+ type = new TcbExpr(tempPrint(rawType, dirRef.node.getSourceFile()));
16107
15810
  } else {
16108
- if (!ts77.isTypeReferenceNode(rawType)) {
15811
+ if (!ts64.isTypeReferenceNode(rawType)) {
16109
15812
  throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
16110
15813
  }
16111
- const typeArguments = dirRef.node.typeParameters.map(() => ts77.factory.createKeywordTypeNode(ts77.SyntaxKind.AnyKeyword));
16112
- type = ts77.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
15814
+ const typeArguments = dirRef.node.typeParameters.map(() => ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
15815
+ type = new TcbExpr(tempPrint(ts64.factory.createTypeReferenceNode(rawType.typeName, typeArguments), dirRef.node.getSourceFile()));
16113
15816
  }
16114
15817
  if (this.node instanceof TmplAstHostElement3) {
16115
15818
  span = this.node.sourceSpan;
16116
15819
  } else {
16117
15820
  span = this.node.startSourceSpan || this.node.sourceSpan;
16118
15821
  }
16119
- const id = this.tcb.allocateId();
16120
- addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
16121
- addParseSpanInfo(id, span);
16122
- this.scope.addStatement(tsDeclareVariable(id, type));
15822
+ const id = new TcbExpr(this.tcb.allocateId()).addExpressionIdentifier(ExpressionIdentifier.DIRECTIVE).addParseSpanInfo(span);
15823
+ this.scope.addStatement(declareVariable(id, type));
16123
15824
  return id;
16124
15825
  }
16125
15826
  };
@@ -16148,7 +15849,6 @@ var TcbGenericDirectiveTypeWithAnyParamsOp = class extends TcbDirectiveTypeOpBas
16148
15849
 
16149
15850
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/directive_constructor.js
16150
15851
  import { TmplAstHostElement as TmplAstHostElement4 } from "@angular/compiler";
16151
- import ts78 from "typescript";
16152
15852
  var TcbDirectiveCtorOp = class extends TcbOp {
16153
15853
  tcb;
16154
15854
  scope;
@@ -16168,7 +15868,7 @@ var TcbDirectiveCtorOp = class extends TcbOp {
16168
15868
  }
16169
15869
  execute() {
16170
15870
  const genericInputs = /* @__PURE__ */ new Map();
16171
- const id = this.tcb.allocateId();
15871
+ const id = new TcbExpr(this.tcb.allocateId());
16172
15872
  let boundAttrs;
16173
15873
  let span;
16174
15874
  if (this.node instanceof TmplAstHostElement4) {
@@ -16184,8 +15884,7 @@ var TcbDirectiveCtorOp = class extends TcbOp {
16184
15884
  }
16185
15885
  }
16186
15886
  }
16187
- addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
16188
- addParseSpanInfo(id, span);
15887
+ id.addExpressionIdentifier(ExpressionIdentifier.DIRECTIVE).addParseSpanInfo(span);
16189
15888
  for (const attr of boundAttrs) {
16190
15889
  if (!this.tcb.env.config.checkTypeOfAttributes && typeof attr.value === "string") {
16191
15890
  continue;
@@ -16199,6 +15898,7 @@ var TcbDirectiveCtorOp = class extends TcbOp {
16199
15898
  type: "binding",
16200
15899
  field: fieldName,
16201
15900
  expression,
15901
+ originalExpression: attr.value,
16202
15902
  sourceSpan: attr.sourceSpan,
16203
15903
  isTwoWayBinding
16204
15904
  });
@@ -16210,8 +15910,8 @@ var TcbDirectiveCtorOp = class extends TcbOp {
16210
15910
  }
16211
15911
  }
16212
15912
  const typeCtor = tcbCallTypeCtor(this.dir, this.tcb, Array.from(genericInputs.values()));
16213
- markIgnoreDiagnostics(typeCtor);
16214
- this.scope.addStatement(tsCreateVariable(id, typeCtor));
15913
+ typeCtor.markIgnoreDiagnostics();
15914
+ this.scope.addStatement(new TcbExpr(`var ${id.print()} = ${typeCtor.print()}`));
16215
15915
  return id;
16216
15916
  }
16217
15917
  circularFallback() {
@@ -16234,45 +15934,37 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
16234
15934
  execute() {
16235
15935
  const id = this.tcb.allocateId();
16236
15936
  const typeCtor = this.tcb.env.typeCtorFor(this.dir);
16237
- const circularPlaceholder = ts78.factory.createCallExpression(
16238
- typeCtor,
16239
- /* typeArguments */
16240
- void 0,
16241
- [ts78.factory.createNonNullExpression(ts78.factory.createNull())]
16242
- );
16243
- this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
16244
- return id;
15937
+ this.scope.addStatement(new TcbExpr(`var ${id} = ${typeCtor.print()}(null!)`));
15938
+ return new TcbExpr(id);
16245
15939
  }
16246
15940
  };
16247
15941
  function tcbCallTypeCtor(dir, tcb, inputs) {
16248
15942
  const typeCtor = tcb.env.typeCtorFor(dir);
16249
- const members = inputs.map((input) => {
16250
- const propertyName = ts78.factory.createStringLiteral(input.field);
15943
+ let literal4 = "{ ";
15944
+ for (let i = 0; i < inputs.length; i++) {
15945
+ const input = inputs[i];
15946
+ const propertyName = quoteAndEscape(input.field);
15947
+ const isLast = i === inputs.length - 1;
16251
15948
  if (input.type === "binding") {
16252
- let expr = widenBinding(input.expression, tcb);
15949
+ let expr = widenBinding(input.expression, tcb, input.originalExpression);
16253
15950
  if (input.isTwoWayBinding && tcb.env.config.allowSignalsInTwoWayBindings) {
16254
15951
  expr = unwrapWritableSignal(expr, tcb);
16255
15952
  }
16256
- const assignment = ts78.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
16257
- addParseSpanInfo(assignment, input.sourceSpan);
16258
- return assignment;
15953
+ const assignment = new TcbExpr(`${propertyName}: ${expr.wrapForTypeChecker().print()}`);
15954
+ assignment.addParseSpanInfo(input.sourceSpan);
15955
+ literal4 += assignment.print();
16259
15956
  } else {
16260
- return ts78.factory.createPropertyAssignment(propertyName, getAnyExpression());
15957
+ literal4 += `${propertyName}: 0 as any`;
16261
15958
  }
16262
- });
16263
- return ts78.factory.createCallExpression(
16264
- /* expression */
16265
- typeCtor,
16266
- /* typeArguments */
16267
- void 0,
16268
- /* argumentsArray */
16269
- [ts78.factory.createObjectLiteralExpression(members)]
16270
- );
15959
+ literal4 += `${isLast ? "" : ","} `;
15960
+ }
15961
+ literal4 += "}";
15962
+ return new TcbExpr(`${typeCtor.print()}(${literal4})`);
16271
15963
  }
16272
15964
 
16273
15965
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/content_projection.js
16274
15966
  import { createCssSelectorFromNode, CssSelector as CssSelector3, SelectorMatcher as SelectorMatcher2, TmplAstElement as TmplAstElement7, TmplAstForLoopBlock, TmplAstIfBlock, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate4, TmplAstText } from "@angular/compiler";
16275
- import ts79 from "typescript";
15967
+ import ts65 from "typescript";
16276
15968
  var TcbControlFlowContentProjectionOp = class extends TcbOp {
16277
15969
  tcb;
16278
15970
  element;
@@ -16285,7 +15977,7 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
16285
15977
  this.element = element;
16286
15978
  this.ngContentSelectors = ngContentSelectors;
16287
15979
  this.componentName = componentName;
16288
- this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ? ts79.DiagnosticCategory.Error : ts79.DiagnosticCategory.Warning;
15980
+ this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ? ts65.DiagnosticCategory.Error : ts65.DiagnosticCategory.Warning;
16289
15981
  }
16290
15982
  optional = false;
16291
15983
  execute() {
@@ -16353,7 +16045,6 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
16353
16045
  };
16354
16046
 
16355
16047
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/intersection_observer.js
16356
- import ts80 from "typescript";
16357
16048
  var TcbIntersectionObserverOp = class extends TcbOp {
16358
16049
  tcb;
16359
16050
  scope;
@@ -16367,9 +16058,7 @@ var TcbIntersectionObserverOp = class extends TcbOp {
16367
16058
  optional = false;
16368
16059
  execute() {
16369
16060
  const options = tcbExpression(this.options, this.tcb, this.scope);
16370
- const callback = ts80.factory.createNonNullExpression(ts80.factory.createNull());
16371
- const expression = ts80.factory.createNewExpression(ts80.factory.createIdentifier("IntersectionObserver"), void 0, [callback, options]);
16372
- this.scope.addStatement(ts80.factory.createExpressionStatement(expression));
16061
+ this.scope.addStatement(new TcbExpr(`new IntersectionObserver(null!, ${options.print()})`));
16373
16062
  return null;
16374
16063
  }
16375
16064
  };
@@ -16388,10 +16077,16 @@ var TcbHostElementOp = class extends TcbOp {
16388
16077
  }
16389
16078
  execute() {
16390
16079
  const id = this.tcb.allocateId();
16391
- const initializer = tsCreateElement(...this.element.tagNames);
16392
- addParseSpanInfo(initializer, this.element.sourceSpan);
16393
- this.scope.addStatement(tsCreateVariable(id, initializer));
16394
- return id;
16080
+ let tagNames;
16081
+ if (this.element.tagNames.length === 1) {
16082
+ tagNames = `"${this.element.tagNames[0]}"`;
16083
+ } else {
16084
+ tagNames = `null! as ${this.element.tagNames.map((t) => `"${t}"`).join(" | ")}`;
16085
+ }
16086
+ const initializer = new TcbExpr(`document.createElement(${tagNames})`);
16087
+ initializer.addParseSpanInfo(this.element.sourceSpan);
16088
+ this.scope.addStatement(new TcbExpr(`var ${id} = ${initializer.print()}`));
16089
+ return new TcbExpr(id);
16395
16090
  }
16396
16091
  };
16397
16092
 
@@ -16403,7 +16098,7 @@ var Scope = class _Scope {
16403
16098
  /**
16404
16099
  * A queue of operations which need to be performed to generate the TCB code for this scope.
16405
16100
  *
16406
- * This array can contain either a `TcbOp` which has yet to be executed, or a `ts.Expression|null`
16101
+ * This array can contain either a `TcbOp` which has yet to be executed, or a `TcbExpr|null`
16407
16102
  * representing the memoized result of executing the operation. As operations are executed, their
16408
16103
  * results are written into the `opQueue`, overwriting the original operation.
16409
16104
  *
@@ -16463,12 +16158,12 @@ var Scope = class _Scope {
16463
16158
  */
16464
16159
  static getForLoopContextVariableTypes() {
16465
16160
  return /* @__PURE__ */ new Map([
16466
- ["$first", ts81.SyntaxKind.BooleanKeyword],
16467
- ["$last", ts81.SyntaxKind.BooleanKeyword],
16468
- ["$even", ts81.SyntaxKind.BooleanKeyword],
16469
- ["$odd", ts81.SyntaxKind.BooleanKeyword],
16470
- ["$index", ts81.SyntaxKind.NumberKeyword],
16471
- ["$count", ts81.SyntaxKind.NumberKeyword]
16161
+ ["$first", "boolean"],
16162
+ ["$last", "boolean"],
16163
+ ["$even", "boolean"],
16164
+ ["$odd", "boolean"],
16165
+ ["$index", "number"],
16166
+ ["$count", "number"]
16472
16167
  ]);
16473
16168
  }
16474
16169
  constructor(tcb, parent = null, guard = null) {
@@ -16509,15 +16204,15 @@ var Scope = class _Scope {
16509
16204
  _Scope.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
16510
16205
  }
16511
16206
  } else if (scopedNode instanceof TmplAstForLoopBlock2) {
16512
- const loopInitializer = tcb.allocateId();
16513
- addParseSpanInfo(loopInitializer, scopedNode.item.sourceSpan);
16207
+ const loopInitializer = new TcbExpr(tcb.allocateId());
16208
+ loopInitializer.addParseSpanInfo(scopedNode.item.sourceSpan);
16514
16209
  scope.varMap.set(scopedNode.item, loopInitializer);
16515
16210
  const forLoopContextVariableTypes = _Scope.getForLoopContextVariableTypes();
16516
16211
  for (const variable of scopedNode.contextVariables) {
16517
16212
  if (!forLoopContextVariableTypes.has(variable.value)) {
16518
16213
  throw new Error(`Unrecognized for loop context variable ${variable.name}`);
16519
16214
  }
16520
- const type = ts81.factory.createKeywordTypeNode(forLoopContextVariableTypes.get(variable.value));
16215
+ const type = new TcbExpr(forLoopContextVariableTypes.get(variable.value));
16521
16216
  _Scope.registerVariable(scope, variable, new TcbBlockImplicitVariableOp(tcb, scope, type, variable));
16522
16217
  }
16523
16218
  } else if (scopedNode instanceof TmplAstHostElement5) {
@@ -16563,17 +16258,7 @@ var Scope = class _Scope {
16563
16258
  resolve(node, directive) {
16564
16259
  const res = this.resolveLocal(node, directive);
16565
16260
  if (res !== null) {
16566
- let clone;
16567
- if (ts81.isIdentifier(res)) {
16568
- clone = ts81.factory.createIdentifier(res.text);
16569
- } else if (ts81.isNonNullExpression(res)) {
16570
- clone = ts81.factory.createNonNullExpression(res.expression);
16571
- } else {
16572
- throw new Error(`Could not resolve ${node} to an Identifier or a NonNullExpression`);
16573
- }
16574
- ts81.setOriginalNode(clone, res);
16575
- clone.parent = clone.parent;
16576
- return ts81.setSyntheticTrailingComments(clone, []);
16261
+ return res;
16577
16262
  } else if (this.parent !== null) {
16578
16263
  return this.parent.resolve(node, directive);
16579
16264
  } else {
@@ -16608,9 +16293,10 @@ var Scope = class _Scope {
16608
16293
  if (this.guard === null) {
16609
16294
  return parentGuards;
16610
16295
  } else if (parentGuards === null) {
16611
- return this.guard;
16296
+ return typeof this.guard === "string" ? new TcbExpr(this.guard) : this.guard;
16612
16297
  } else {
16613
- return ts81.factory.createBinaryExpression(parentGuards, ts81.SyntaxKind.AmpersandAmpersandToken, this.guard);
16298
+ const guard = typeof this.guard === "string" ? this.guard : this.guard.print();
16299
+ return new TcbExpr(`(${parentGuards.print()}) && (${guard})`);
16614
16300
  }
16615
16301
  }
16616
16302
  /** Returns whether a template symbol is defined locally within the current scope. */
@@ -16644,7 +16330,10 @@ var Scope = class _Scope {
16644
16330
  return this.resolveOp(this.letDeclOpMap.get(ref.name).opIndex);
16645
16331
  } else if (ref instanceof TmplAstVariable2 && this.varMap.has(ref)) {
16646
16332
  const opIndexOrNode = this.varMap.get(ref);
16647
- return typeof opIndexOrNode === "number" ? this.resolveOp(opIndexOrNode) : opIndexOrNode;
16333
+ return typeof opIndexOrNode === "number" ? this.resolveOp(opIndexOrNode) : new TcbExpr(opIndexOrNode.print(
16334
+ true
16335
+ /* ignoreComments */
16336
+ ));
16648
16337
  } else if (ref instanceof TmplAstTemplate5 && directive === void 0 && this.templateCtxOpMap.has(ref)) {
16649
16338
  return this.resolveOp(this.templateCtxOpMap.get(ref));
16650
16339
  } else if ((ref instanceof TmplAstElement8 || ref instanceof TmplAstTemplate5 || ref instanceof TmplAstComponent3 || ref instanceof TmplAstDirective2 || ref instanceof TmplAstHostElement5) && directive !== void 0 && this.directiveOpMap.has(ref)) {
@@ -16661,7 +16350,7 @@ var Scope = class _Scope {
16661
16350
  }
16662
16351
  }
16663
16352
  /**
16664
- * Like `executeOp`, but assert that the operation actually returned `ts.Expression`.
16353
+ * Like `executeOp`, but assert that the operation actually returned `TcbExpr`.
16665
16354
  */
16666
16355
  resolveOp(opIndex) {
16667
16356
  const res = this.executeOp(
@@ -16684,13 +16373,22 @@ var Scope = class _Scope {
16684
16373
  executeOp(opIndex, skipOptional) {
16685
16374
  const op = this.opQueue[opIndex];
16686
16375
  if (!(op instanceof TcbOp)) {
16687
- return op;
16376
+ return op === null ? null : new TcbExpr(op.print(
16377
+ true
16378
+ /* ignoreComments */
16379
+ ));
16688
16380
  }
16689
16381
  if (skipOptional && op.optional) {
16690
16382
  return null;
16691
16383
  }
16692
16384
  this.opQueue[opIndex] = op.circularFallback();
16693
- const res = op.execute();
16385
+ let res = op.execute();
16386
+ if (res !== null) {
16387
+ res = new TcbExpr(res.print(
16388
+ true
16389
+ /* ignoreComments */
16390
+ ));
16391
+ }
16694
16392
  this.opQueue[opIndex] = res;
16695
16393
  return res;
16696
16394
  }
@@ -17070,7 +16768,7 @@ var Scope = class _Scope {
17070
16768
  function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
17071
16769
  const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone, meta.preserveWhitespaces);
17072
16770
  const ctxRawType = env.referenceType(ref);
17073
- if (!ts82.isTypeReferenceNode(ctxRawType)) {
16771
+ if (!ts66.isTypeReferenceNode(ctxRawType)) {
17074
16772
  throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
17075
16773
  }
17076
16774
  let typeParameters = void 0;
@@ -17081,19 +16779,23 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
17081
16779
  }
17082
16780
  switch (genericContextBehavior) {
17083
16781
  case TcbGenericContextBehavior.UseEmitter:
17084
- typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
17085
- typeArguments = typeParameters.map((param) => ts82.factory.createTypeReferenceNode(param.name));
16782
+ typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef2) => env.referenceType(typeRef2));
16783
+ typeArguments = typeParameters.map((param) => ts66.factory.createTypeReferenceNode(param.name));
17086
16784
  break;
17087
16785
  case TcbGenericContextBehavior.CopyClassNodes:
17088
16786
  typeParameters = [...ref.node.typeParameters];
17089
- typeArguments = typeParameters.map((param) => ts82.factory.createTypeReferenceNode(param.name));
16787
+ typeArguments = typeParameters.map((param) => ts66.factory.createTypeReferenceNode(param.name));
17090
16788
  break;
17091
16789
  case TcbGenericContextBehavior.FallbackToAny:
17092
- typeArguments = ref.node.typeParameters.map(() => ts82.factory.createKeywordTypeNode(ts82.SyntaxKind.AnyKeyword));
16790
+ typeArguments = ref.node.typeParameters.map(() => ts66.factory.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
17093
16791
  break;
17094
16792
  }
17095
16793
  }
17096
- const paramList = [tcbThisParam(ctxRawType.typeName, typeArguments)];
16794
+ const sourceFile = env.contextFile;
16795
+ const typeParamsStr = typeParameters === void 0 || typeParameters.length === 0 ? "" : `<${typeParameters.map((p) => tempPrint(p, sourceFile)).join(", ")}>`;
16796
+ const typeArgsStr = typeArguments === void 0 || typeArguments.length === 0 ? "" : `<${typeArguments.map((p) => tempPrint(p, sourceFile)).join(", ")}>`;
16797
+ const typeRef = ts66.isIdentifier(ctxRawType.typeName) ? ctxRawType.typeName.text : tempPrint(ctxRawType.typeName, sourceFile);
16798
+ const thisParamStr = `this: ${typeRef}${typeArgsStr}`;
17097
16799
  const statements = [];
17098
16800
  if (tcb.boundTarget.target.template !== void 0) {
17099
16801
  const templateScope = Scope.forNodes(
@@ -17104,56 +16806,29 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
17104
16806
  /* guard */
17105
16807
  null
17106
16808
  );
17107
- statements.push(renderBlockStatements(env, templateScope, ts82.factory.createTrue()));
16809
+ statements.push(renderBlockStatements(env, templateScope, "true"));
17108
16810
  }
17109
16811
  if (tcb.boundTarget.target.host !== void 0) {
17110
16812
  const hostScope = Scope.forNodes(tcb, null, tcb.boundTarget.target.host.node, null, null);
17111
16813
  statements.push(renderBlockStatements(env, hostScope, createHostBindingsBlockGuard()));
17112
16814
  }
17113
- const body = ts82.factory.createBlock(statements);
17114
- const fnDecl = ts82.factory.createFunctionDeclaration(
17115
- /* modifiers */
17116
- void 0,
17117
- /* asteriskToken */
17118
- void 0,
17119
- /* name */
17120
- name,
17121
- /* typeParameters */
17122
- env.config.useContextGenericType ? typeParameters : void 0,
17123
- /* parameters */
17124
- paramList,
17125
- /* type */
17126
- void 0,
17127
- /* body */
17128
- body
17129
- );
17130
- addTypeCheckId(fnDecl, meta.id);
17131
- return fnDecl;
16815
+ const bodyStr = `{
16816
+ ${statements.join("\n")}
16817
+ }`;
16818
+ const funcDeclStr = `function ${name.text}${typeParamsStr}(${thisParamStr}) ${bodyStr}`;
16819
+ return `/*${meta.id}*/
16820
+ ${funcDeclStr}`;
17132
16821
  }
17133
16822
  function renderBlockStatements(env, scope, wrapperExpression) {
17134
16823
  const scopeStatements = scope.render();
17135
- const innerBody = ts82.factory.createBlock([...env.getPreludeStatements(), ...scopeStatements]);
17136
- return ts82.factory.createIfStatement(wrapperExpression, innerBody);
17137
- }
17138
- function tcbThisParam(name, typeArguments) {
17139
- return ts82.factory.createParameterDeclaration(
17140
- /* modifiers */
17141
- void 0,
17142
- /* dotDotDotToken */
17143
- void 0,
17144
- /* name */
17145
- "this",
17146
- /* questionToken */
17147
- void 0,
17148
- /* type */
17149
- ts82.factory.createTypeReferenceNode(name, typeArguments),
17150
- /* initializer */
17151
- void 0
17152
- );
16824
+ const statements = getStatementsBlock([...env.getPreludeStatements(), ...scopeStatements]);
16825
+ return `if (${wrapperExpression}) {
16826
+ ${statements}
16827
+ }`;
17153
16828
  }
17154
16829
 
17155
16830
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.js
17156
- import ts83 from "typescript";
16831
+ import ts67 from "typescript";
17157
16832
  var TypeCheckFile = class extends Environment {
17158
16833
  fileName;
17159
16834
  nextTcbId = 1;
@@ -17165,36 +16840,32 @@ var TypeCheckFile = class extends Environment {
17165
16840
  // Type check block code affects code completion and fix suggestions.
17166
16841
  // We want to encourage single quotes for now, like we always did.
17167
16842
  shouldUseSingleQuotes: () => true
17168
- }), refEmitter, reflector, ts83.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts83.ScriptTarget.Latest, true));
16843
+ }), refEmitter, reflector, ts67.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts67.ScriptTarget.Latest, true));
17169
16844
  this.fileName = fileName;
17170
16845
  }
17171
16846
  addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
17172
- const fnId = ts83.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
16847
+ const fnId = ts67.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
17173
16848
  const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
17174
16849
  this.tcbStatements.push(fn);
17175
16850
  }
17176
- render(removeComments) {
16851
+ render() {
17177
16852
  ensureTypeCheckFilePreparationImports(this);
17178
16853
  const importChanges = this.importManager.finalize();
17179
16854
  if (importChanges.updatedImports.size > 0) {
17180
16855
  throw new Error("AssertionError: Expected no imports to be updated for a new type check file.");
17181
16856
  }
17182
- const printer = ts83.createPrinter({ removeComments });
16857
+ const printer = ts67.createPrinter();
17183
16858
  let source = "";
17184
16859
  const newImports = importChanges.newImports.get(this.contextFile.fileName);
17185
16860
  if (newImports !== void 0) {
17186
- source += newImports.map((i) => printer.printNode(ts83.EmitHint.Unspecified, i, this.contextFile)).join("\n");
16861
+ source += newImports.map((i) => printer.printNode(ts67.EmitHint.Unspecified, i, this.contextFile)).join("\n");
17187
16862
  }
17188
16863
  source += "\n";
17189
- for (const stmt of this.pipeInstStatements) {
17190
- source += printer.printNode(ts83.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
17191
- }
17192
- for (const stmt of this.typeCtorStatements) {
17193
- source += printer.printNode(ts83.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
17194
- }
16864
+ source += getStatementsBlock(this.pipeInstStatements);
16865
+ source += getStatementsBlock(this.typeCtorStatements);
17195
16866
  source += "\n";
17196
16867
  for (const stmt of this.tcbStatements) {
17197
- source += printer.printNode(ts83.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
16868
+ source += stmt + "\n";
17198
16869
  }
17199
16870
  source += "\nexport const IS_A_MODULE = true;\n";
17200
16871
  return source;
@@ -17360,7 +17031,7 @@ var TypeCheckContextImpl = class {
17360
17031
  if (!this.opMap.has(sf)) {
17361
17032
  return null;
17362
17033
  }
17363
- const printer = ts84.createPrinter({ omitTrailingSemicolon: true });
17034
+ const printer = ts68.createPrinter({ omitTrailingSemicolon: true });
17364
17035
  const importManager = new ImportManager({
17365
17036
  // This minimizes noticeable changes with older versions of `ImportManager`.
17366
17037
  forceGenerateNamespacesForNewImports: true,
@@ -17371,7 +17042,7 @@ var TypeCheckContextImpl = class {
17371
17042
  const updates = this.opMap.get(sf).map((op) => {
17372
17043
  return {
17373
17044
  pos: op.splitPoint,
17374
- text: op.execute(importManager, sf, this.refEmitter, printer)
17045
+ text: op.execute(importManager, sf, this.refEmitter)
17375
17046
  };
17376
17047
  });
17377
17048
  const { newImports, updatedImports } = importManager.finalize();
@@ -17379,7 +17050,7 @@ var TypeCheckContextImpl = class {
17379
17050
  newImports.get(sf.fileName).forEach((newImport) => {
17380
17051
  updates.push({
17381
17052
  pos: 0,
17382
- text: printer.printNode(ts84.EmitHint.Unspecified, newImport, sf)
17053
+ text: printer.printNode(ts68.EmitHint.Unspecified, newImport, sf)
17383
17054
  });
17384
17055
  });
17385
17056
  }
@@ -17390,7 +17061,7 @@ var TypeCheckContextImpl = class {
17390
17061
  updates.push({
17391
17062
  pos: oldBindings.getStart(),
17392
17063
  deletePos: oldBindings.getEnd(),
17393
- text: printer.printNode(ts84.EmitHint.Unspecified, newBindings, sf)
17064
+ text: printer.printNode(ts68.EmitHint.Unspecified, newBindings, sf)
17394
17065
  });
17395
17066
  }
17396
17067
  const result = new MagicString(sf.text, { filename: sf.fileName });
@@ -17424,10 +17095,7 @@ var TypeCheckContextImpl = class {
17424
17095
  path: pendingShimData.file.fileName,
17425
17096
  data: pendingShimData.data
17426
17097
  });
17427
- const sfText = pendingShimData.file.render(
17428
- false
17429
- /* removeComments */
17430
- );
17098
+ const sfText = pendingShimData.file.render();
17431
17099
  updates.set(pendingShimData.file.fileName, {
17432
17100
  newText: sfText,
17433
17101
  // Shim files do not have an associated original file.
@@ -17478,7 +17146,7 @@ function getTemplateDiagnostics(parseErrors, templateId, sourceMapping) {
17478
17146
  if (span.start.offset === span.end.offset) {
17479
17147
  span.end.offset++;
17480
17148
  }
17481
- return makeTemplateDiagnostic(templateId, sourceMapping, span, ts84.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
17149
+ return makeTemplateDiagnostic(templateId, sourceMapping, span, ts68.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
17482
17150
  });
17483
17151
  }
17484
17152
  var InlineTcbOp = class {
@@ -17502,11 +17170,11 @@ var InlineTcbOp = class {
17502
17170
  get splitPoint() {
17503
17171
  return this.ref.node.end + 1;
17504
17172
  }
17505
- execute(im, sf, refEmitter, printer) {
17173
+ execute(im, sf, refEmitter) {
17506
17174
  const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
17507
- const fnName = ts84.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
17175
+ const fnName = ts68.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
17508
17176
  const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
17509
- return printer.printNode(ts84.EmitHint.Unspecified, fn, sf);
17177
+ return fn;
17510
17178
  }
17511
17179
  };
17512
17180
  var TypeCtorOp = class {
@@ -17524,13 +17192,49 @@ var TypeCtorOp = class {
17524
17192
  get splitPoint() {
17525
17193
  return this.ref.node.end - 1;
17526
17194
  }
17527
- execute(im, sf, refEmitter, printer) {
17195
+ execute(im, sf, refEmitter) {
17528
17196
  const emitEnv = new ReferenceEmitEnvironment(im, refEmitter, this.reflector, sf);
17529
- const tcb = generateInlineTypeCtor(emitEnv, this.ref.node, this.meta);
17530
- return printer.printNode(ts84.EmitHint.Unspecified, tcb, sf);
17197
+ return generateInlineTypeCtor(emitEnv, this.ref.node, this.meta);
17531
17198
  }
17532
17199
  };
17533
17200
 
17201
+ // packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.js
17202
+ import { AbsoluteSourceSpan as AbsoluteSourceSpan5 } from "@angular/compiler";
17203
+ import ts69 from "typescript";
17204
+ function shouldReportDiagnostic(diagnostic) {
17205
+ const { code } = diagnostic;
17206
+ if (code === 6133) {
17207
+ return false;
17208
+ } else if (code === 6199) {
17209
+ return false;
17210
+ } else if (code === 2695) {
17211
+ return false;
17212
+ } else if (code === 7006) {
17213
+ return false;
17214
+ }
17215
+ return true;
17216
+ }
17217
+ function translateDiagnostic(diagnostic, resolver) {
17218
+ if (diagnostic.file === void 0 || diagnostic.start === void 0) {
17219
+ return null;
17220
+ }
17221
+ const fullMapping = getSourceMapping(
17222
+ diagnostic.file,
17223
+ diagnostic.start,
17224
+ resolver,
17225
+ /*isDiagnosticsRequest*/
17226
+ true
17227
+ );
17228
+ if (fullMapping === null) {
17229
+ return null;
17230
+ }
17231
+ const { sourceLocation, sourceMapping: templateSourceMapping, span } = fullMapping;
17232
+ return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText, void 0, diagnostic.reportsDeprecated !== void 0 ? {
17233
+ reportsDeprecated: diagnostic.reportsDeprecated,
17234
+ relatedMessages: diagnostic.relatedInformation
17235
+ } : void 0);
17236
+ }
17237
+
17534
17238
  // packages/compiler-cli/src/ngtsc/typecheck/src/source.js
17535
17239
  import { ParseLocation as ParseLocation2, ParseSourceSpan as ParseSourceSpan3 } from "@angular/compiler";
17536
17240
 
@@ -17649,7 +17353,7 @@ var DirectiveSourceManager = class {
17649
17353
 
17650
17354
  // packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.js
17651
17355
  import { AST, ASTWithName as ASTWithName2, ASTWithSource as ASTWithSource2, Binary as Binary2, BindingPipe as BindingPipe2, PropertyRead as PropertyRead8, R3Identifiers as R3Identifiers6, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute5, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstComponent as TmplAstComponent4, TmplAstDirective as TmplAstDirective3, TmplAstElement as TmplAstElement9, TmplAstLetDeclaration as TmplAstLetDeclaration4, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate6, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
17652
- import ts85 from "typescript";
17356
+ import ts70 from "typescript";
17653
17357
  var SymbolBuilder = class {
17654
17358
  tcbPath;
17655
17359
  tcbIsShim;
@@ -17706,7 +17410,7 @@ var SymbolBuilder = class {
17706
17410
  const elementSourceSpan = element.startSourceSpan ?? element.sourceSpan;
17707
17411
  const node = findFirstMatchingNode(this.typeCheckBlock, {
17708
17412
  withSpan: elementSourceSpan,
17709
- filter: ts85.isVariableDeclaration
17413
+ filter: ts70.isVariableDeclaration
17710
17414
  });
17711
17415
  if (node === null) {
17712
17416
  return null;
@@ -17763,7 +17467,7 @@ var SymbolBuilder = class {
17763
17467
  const seenDirectives = /* @__PURE__ */ new Set();
17764
17468
  for (const node of nodes) {
17765
17469
  const symbol = this.getSymbolOfTsNode(node.parent);
17766
- if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts85.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17470
+ if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts70.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17767
17471
  continue;
17768
17472
  }
17769
17473
  const declaration = symbol.tsSymbol.valueDeclaration;
@@ -17798,7 +17502,7 @@ var SymbolBuilder = class {
17798
17502
  throw new Error("Impossible state: typecheck code path in local compilation mode.");
17799
17503
  }
17800
17504
  const node = current.directive.node;
17801
- if (!ts85.isClassDeclaration(node) || seenDirectives.has(node)) {
17505
+ if (!ts70.isClassDeclaration(node) || seenDirectives.has(node)) {
17802
17506
  continue;
17803
17507
  }
17804
17508
  const symbol = this.getSymbolOfTsNode(node);
@@ -17888,10 +17592,10 @@ var SymbolBuilder = class {
17888
17592
  if (!isAccessExpression(n2)) {
17889
17593
  return false;
17890
17594
  }
17891
- if (ts85.isPropertyAccessExpression(n2)) {
17595
+ if (ts70.isPropertyAccessExpression(n2)) {
17892
17596
  return n2.name.getText() === expectedAccess;
17893
17597
  } else {
17894
- return ts85.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
17598
+ return ts70.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
17895
17599
  }
17896
17600
  }
17897
17601
  const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, {
@@ -17901,7 +17605,7 @@ var SymbolBuilder = class {
17901
17605
  const bindings = [];
17902
17606
  for (const outputFieldAccess of outputFieldAccesses) {
17903
17607
  if (consumer instanceof TmplAstTemplate6 || consumer instanceof TmplAstElement9) {
17904
- if (!ts85.isPropertyAccessExpression(outputFieldAccess)) {
17608
+ if (!ts70.isPropertyAccessExpression(outputFieldAccess)) {
17905
17609
  continue;
17906
17610
  }
17907
17611
  const addEventListener = outputFieldAccess.name;
@@ -17924,7 +17628,7 @@ var SymbolBuilder = class {
17924
17628
  }
17925
17629
  });
17926
17630
  } else {
17927
- if (!ts85.isElementAccessExpression(outputFieldAccess)) {
17631
+ if (!ts70.isElementAccessExpression(outputFieldAccess)) {
17928
17632
  continue;
17929
17633
  }
17930
17634
  const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
@@ -17977,7 +17681,7 @@ var SymbolBuilder = class {
17977
17681
  let fieldAccessExpr;
17978
17682
  let symbolInfo = null;
17979
17683
  if (signalInputAssignment !== null) {
17980
- if (ts85.isIdentifier(signalInputAssignment.fieldExpr)) {
17684
+ if (ts70.isIdentifier(signalInputAssignment.fieldExpr)) {
17981
17685
  continue;
17982
17686
  }
17983
17687
  const fieldSymbol = this.getSymbolOfTsNode(signalInputAssignment.fieldExpr);
@@ -18017,7 +17721,7 @@ var SymbolBuilder = class {
18017
17721
  return null;
18018
17722
  }
18019
17723
  const [declaration] = tsSymbol.declarations;
18020
- if (!ts85.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
17724
+ if (!ts70.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
18021
17725
  // The expression identifier could be on the type (for regular directives) or the name
18022
17726
  // (for generic directives and the ctor op).
18023
17727
  declaration.getSourceFile(),
@@ -18027,7 +17731,7 @@ var SymbolBuilder = class {
18027
17731
  return null;
18028
17732
  }
18029
17733
  const symbol = this.getSymbolOfTsNode(declaration);
18030
- if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts85.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17734
+ if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts70.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
18031
17735
  return null;
18032
17736
  }
18033
17737
  const ref = new Reference(symbol.tsSymbol.valueDeclaration);
@@ -18051,13 +17755,13 @@ var SymbolBuilder = class {
18051
17755
  getSymbolOfVariable(variable) {
18052
17756
  const node = findFirstMatchingNode(this.typeCheckBlock, {
18053
17757
  withSpan: variable.sourceSpan,
18054
- filter: ts85.isVariableDeclaration
17758
+ filter: ts70.isVariableDeclaration
18055
17759
  });
18056
17760
  if (node === null) {
18057
17761
  return null;
18058
17762
  }
18059
17763
  let nodeValueSymbol = null;
18060
- if (ts85.isForOfStatement(node.parent.parent)) {
17764
+ if (ts70.isForOfStatement(node.parent.parent)) {
18061
17765
  nodeValueSymbol = this.getSymbolOfTsNode(node);
18062
17766
  } else if (node.initializer !== void 0) {
18063
17767
  nodeValueSymbol = this.getSymbolOfTsNode(node.initializer);
@@ -18082,12 +17786,12 @@ var SymbolBuilder = class {
18082
17786
  const target = this.typeCheckData.boundTarget.getReferenceTarget(ref);
18083
17787
  let node = findFirstMatchingNode(this.typeCheckBlock, {
18084
17788
  withSpan: ref.sourceSpan,
18085
- filter: ts85.isVariableDeclaration
17789
+ filter: ts70.isVariableDeclaration
18086
17790
  });
18087
17791
  if (node === null || target === null || node.initializer === void 0) {
18088
17792
  return null;
18089
17793
  }
18090
- const originalDeclaration = ts85.isParenthesizedExpression(node.initializer) && ts85.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
17794
+ const originalDeclaration = ts70.isParenthesizedExpression(node.initializer) && ts70.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
18091
17795
  if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
18092
17796
  return null;
18093
17797
  }
@@ -18111,7 +17815,7 @@ var SymbolBuilder = class {
18111
17815
  referenceVarLocation: referenceVarTcbLocation
18112
17816
  };
18113
17817
  } else {
18114
- if (!ts85.isClassDeclaration(target.directive.ref.node)) {
17818
+ if (!ts70.isClassDeclaration(target.directive.ref.node)) {
18115
17819
  return null;
18116
17820
  }
18117
17821
  return {
@@ -18128,7 +17832,7 @@ var SymbolBuilder = class {
18128
17832
  getSymbolOfLetDeclaration(decl) {
18129
17833
  const node = findFirstMatchingNode(this.typeCheckBlock, {
18130
17834
  withSpan: decl.sourceSpan,
18131
- filter: ts85.isVariableDeclaration
17835
+ filter: ts70.isVariableDeclaration
18132
17836
  });
18133
17837
  if (node === null) {
18134
17838
  return null;
@@ -18153,7 +17857,7 @@ var SymbolBuilder = class {
18153
17857
  getSymbolOfPipe(expression) {
18154
17858
  const methodAccess = findFirstMatchingNode(this.typeCheckBlock, {
18155
17859
  withSpan: expression.nameSpan,
18156
- filter: ts85.isPropertyAccessExpression
17860
+ filter: ts70.isPropertyAccessExpression
18157
17861
  });
18158
17862
  if (methodAccess === null) {
18159
17863
  return null;
@@ -18198,7 +17902,7 @@ var SymbolBuilder = class {
18198
17902
  if (expression instanceof PropertyRead8) {
18199
17903
  node = findFirstMatchingNode(this.typeCheckBlock, {
18200
17904
  withSpan,
18201
- filter: ts85.isPropertyAccessExpression
17905
+ filter: ts70.isPropertyAccessExpression
18202
17906
  });
18203
17907
  }
18204
17908
  if (node === null) {
@@ -18207,10 +17911,10 @@ var SymbolBuilder = class {
18207
17911
  if (node === null) {
18208
17912
  return null;
18209
17913
  }
18210
- while (ts85.isParenthesizedExpression(node)) {
17914
+ while (ts70.isParenthesizedExpression(node)) {
18211
17915
  node = node.expression;
18212
17916
  }
18213
- if (expression instanceof SafePropertyRead4 && ts85.isConditionalExpression(node)) {
17917
+ if (expression instanceof SafePropertyRead4 && ts70.isConditionalExpression(node)) {
18214
17918
  const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
18215
17919
  if (whenTrueSymbol === null) {
18216
17920
  return null;
@@ -18228,13 +17932,13 @@ var SymbolBuilder = class {
18228
17932
  }
18229
17933
  }
18230
17934
  getSymbolOfTsNode(node) {
18231
- while (ts85.isParenthesizedExpression(node)) {
17935
+ while (ts70.isParenthesizedExpression(node)) {
18232
17936
  node = node.expression;
18233
17937
  }
18234
17938
  let tsSymbol;
18235
- if (ts85.isPropertyAccessExpression(node)) {
17939
+ if (ts70.isPropertyAccessExpression(node)) {
18236
17940
  tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
18237
- } else if (ts85.isCallExpression(node)) {
17941
+ } else if (ts70.isCallExpression(node)) {
18238
17942
  tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.expression);
18239
17943
  } else {
18240
17944
  tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
@@ -18255,13 +17959,13 @@ var SymbolBuilder = class {
18255
17959
  };
18256
17960
  }
18257
17961
  getTcbPositionForNode(node) {
18258
- if (ts85.isTypeReferenceNode(node)) {
17962
+ if (ts70.isTypeReferenceNode(node)) {
18259
17963
  return this.getTcbPositionForNode(node.typeName);
18260
- } else if (ts85.isQualifiedName(node)) {
17964
+ } else if (ts70.isQualifiedName(node)) {
18261
17965
  return node.right.getStart();
18262
- } else if (ts85.isPropertyAccessExpression(node)) {
17966
+ } else if (ts70.isPropertyAccessExpression(node)) {
18263
17967
  return node.name.getStart();
18264
- } else if (ts85.isElementAccessExpression(node)) {
17968
+ } else if (ts70.isElementAccessExpression(node)) {
18265
17969
  return node.argumentExpression.getStart();
18266
17970
  } else {
18267
17971
  return node.getStart();
@@ -18275,13 +17979,13 @@ function sourceSpanEqual(a, b) {
18275
17979
  return a.start.offset === b.start.offset && a.end.offset === b.end.offset;
18276
17980
  }
18277
17981
  function unwrapSignalInputWriteTAccessor(expr) {
18278
- if (!ts85.isElementAccessExpression(expr) || !ts85.isPropertyAccessExpression(expr.argumentExpression)) {
17982
+ if (!ts70.isElementAccessExpression(expr) || !ts70.isPropertyAccessExpression(expr.argumentExpression)) {
18279
17983
  return null;
18280
17984
  }
18281
- if (!ts85.isIdentifier(expr.argumentExpression.name) || expr.argumentExpression.name.text !== R3Identifiers6.InputSignalBrandWriteType.name) {
17985
+ if (!ts70.isIdentifier(expr.argumentExpression.name) || expr.argumentExpression.name.text !== R3Identifiers6.InputSignalBrandWriteType.name) {
18282
17986
  return null;
18283
17987
  }
18284
- if (!ts85.isPropertyAccessExpression(expr.expression) && !ts85.isElementAccessExpression(expr.expression) && !ts85.isIdentifier(expr.expression)) {
17988
+ if (!ts70.isPropertyAccessExpression(expr.expression) && !ts70.isElementAccessExpression(expr.expression) && !ts70.isIdentifier(expr.expression)) {
18285
17989
  throw new Error("Unexpected expression for signal input write type.");
18286
17990
  }
18287
17991
  return {
@@ -18298,10 +18002,10 @@ function findMatchingDirective(originalSourceFile, directiveDeclarationInTypeChe
18298
18002
  function collectClassesWithName(sourceFile, className) {
18299
18003
  const classes = [];
18300
18004
  function visit2(node) {
18301
- if (ts85.isClassDeclaration(node) && node.name?.text === className) {
18005
+ if (ts70.isClassDeclaration(node) && node.name?.text === className) {
18302
18006
  classes.push(node);
18303
18007
  }
18304
- ts85.forEachChild(node, visit2);
18008
+ ts70.forEachChild(node, visit2);
18305
18009
  }
18306
18010
  sourceFile.forEachChild(visit2);
18307
18011
  return classes;
@@ -19101,7 +18805,7 @@ var TemplateTypeCheckerImpl = class {
19101
18805
  return null;
19102
18806
  }
19103
18807
  const emitted = emittedRef.expression;
19104
- if (emitted instanceof WrappedNodeExpr8) {
18808
+ if (emitted instanceof WrappedNodeExpr7) {
19105
18809
  if (refTo.node === inContext) {
19106
18810
  return null;
19107
18811
  }
@@ -19330,11 +19034,11 @@ function getClassDeclFromSymbol(symbol, checker) {
19330
19034
  if (decl === void 0) {
19331
19035
  return null;
19332
19036
  }
19333
- if (ts86.isExportAssignment(decl)) {
19037
+ if (ts71.isExportAssignment(decl)) {
19334
19038
  const symbol2 = checker.getTypeAtLocation(decl.expression).getSymbol();
19335
19039
  return getClassDeclFromSymbol(symbol2, checker);
19336
19040
  }
19337
- if (ts86.isExportSpecifier(decl)) {
19041
+ if (ts71.isExportSpecifier(decl)) {
19338
19042
  const symbol2 = checker.getTypeAtLocation(decl).getSymbol();
19339
19043
  return getClassDeclFromSymbol(symbol2, checker);
19340
19044
  }
@@ -19367,7 +19071,7 @@ function getTheElementTagDeprecatedSuggestionDiagnostics(shimPath, program, file
19367
19071
  const nodeType = typeChecker.getTypeAtLocation(diagNode);
19368
19072
  const nodeSymbolDeclarations = nodeType.getSymbol()?.declarations;
19369
19073
  const decl = nodeSymbolDeclarations !== void 0 && nodeSymbolDeclarations.length > 0 ? nodeSymbolDeclarations[0] : void 0;
19370
- if (decl === void 0 || !ts86.isClassDeclaration(decl)) {
19074
+ if (decl === void 0 || !ts71.isClassDeclaration(decl)) {
19371
19075
  continue;
19372
19076
  }
19373
19077
  const directiveForDiagnostic = templateTypeChecker.getDirectiveMetadata(decl);
@@ -19387,7 +19091,7 @@ function getTheElementTagDeprecatedSuggestionDiagnostics(shimPath, program, file
19387
19091
  if (decl === void 0) {
19388
19092
  continue;
19389
19093
  }
19390
- if (!ts86.isClassDeclaration(decl)) {
19094
+ if (!ts71.isClassDeclaration(decl)) {
19391
19095
  continue;
19392
19096
  }
19393
19097
  const diagnostic = nodeToDiag.get(decl);
@@ -19666,7 +19370,7 @@ var DirectiveDecoratorHandler = class {
19666
19370
  if (!this.typeCheckHostBindings) {
19667
19371
  return;
19668
19372
  }
19669
- if (!ts87.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
19373
+ if (!ts72.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
19670
19374
  return;
19671
19375
  }
19672
19376
  const ref = new Reference(node);
@@ -19693,7 +19397,7 @@ var DirectiveDecoratorHandler = class {
19693
19397
  symbol.baseClass = this.semanticDepGraphUpdater.getSymbol(analysis.baseClass.node);
19694
19398
  }
19695
19399
  const diagnostics = [];
19696
- if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr9) {
19400
+ if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr8) {
19697
19401
  const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
19698
19402
  diagnostics.push(...providerDiagnostics);
19699
19403
  }
@@ -19775,17 +19479,17 @@ var DirectiveDecoratorHandler = class {
19775
19479
  };
19776
19480
 
19777
19481
  // packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.js
19778
- import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as ExternalExpr9, FactoryTarget as FactoryTarget2, FunctionExpr, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr3, R3Identifiers as R3Identifiers7, R3NgModuleMetadataKind, R3SelectorScopeMode, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr10 } from "@angular/compiler";
19779
- import ts89 from "typescript";
19482
+ import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as ExternalExpr9, FactoryTarget as FactoryTarget2, FunctionExpr, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr3, R3Identifiers as R3Identifiers7, R3NgModuleMetadataKind, R3SelectorScopeMode, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr9 } from "@angular/compiler";
19483
+ import ts74 from "typescript";
19780
19484
 
19781
19485
  // packages/compiler-cli/src/ngtsc/annotations/ng_module/src/module_with_providers.js
19782
- import ts88 from "typescript";
19486
+ import ts73 from "typescript";
19783
19487
  function createModuleWithProvidersResolver(reflector, isCore) {
19784
19488
  function _reflectModuleFromTypeParam(type, node) {
19785
- if (!ts88.isTypeReferenceNode(type)) {
19489
+ if (!ts73.isTypeReferenceNode(type)) {
19786
19490
  return null;
19787
19491
  }
19788
- const typeName = type && (ts88.isIdentifier(type.typeName) && type.typeName || ts88.isQualifiedName(type.typeName) && type.typeName.right) || null;
19492
+ const typeName = type && (ts73.isIdentifier(type.typeName) && type.typeName || ts73.isQualifiedName(type.typeName) && type.typeName.right) || null;
19789
19493
  if (typeName === null) {
19790
19494
  return null;
19791
19495
  }
@@ -19797,7 +19501,7 @@ function createModuleWithProvidersResolver(reflector, isCore) {
19797
19501
  return null;
19798
19502
  }
19799
19503
  if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
19800
- const parent = ts88.isMethodDeclaration(node) && ts88.isClassDeclaration(node.parent) ? node.parent : null;
19504
+ const parent = ts73.isMethodDeclaration(node) && ts73.isClassDeclaration(node.parent) ? node.parent : null;
19801
19505
  const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
19802
19506
  throw new FatalDiagnosticError(ErrorCode.NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC, type, `${symbolName} returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.`);
19803
19507
  }
@@ -19805,15 +19509,15 @@ function createModuleWithProvidersResolver(reflector, isCore) {
19805
19509
  return typeNodeToValueExpr(arg);
19806
19510
  }
19807
19511
  function _reflectModuleFromLiteralType(type) {
19808
- if (!ts88.isIntersectionTypeNode(type)) {
19512
+ if (!ts73.isIntersectionTypeNode(type)) {
19809
19513
  return null;
19810
19514
  }
19811
19515
  for (const t of type.types) {
19812
- if (ts88.isTypeLiteralNode(t)) {
19516
+ if (ts73.isTypeLiteralNode(t)) {
19813
19517
  for (const m of t.members) {
19814
- const ngModuleType = ts88.isPropertySignature(m) && ts88.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
19518
+ const ngModuleType = ts73.isPropertySignature(m) && ts73.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
19815
19519
  let ngModuleExpression = null;
19816
- if (ngModuleType !== null && ts88.isTypeQueryNode(ngModuleType)) {
19520
+ if (ngModuleType !== null && ts73.isTypeQueryNode(ngModuleType)) {
19817
19521
  ngModuleExpression = entityNameToValue(ngModuleType.exprName);
19818
19522
  } else if (ngModuleType !== null) {
19819
19523
  ngModuleExpression = typeNodeToValueExpr(ngModuleType);
@@ -19991,8 +19695,8 @@ var NgModuleDecoratorHandler = class {
19991
19695
  if (decorator.args === null || decorator.args.length > 1) {
19992
19696
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @NgModule decorator`);
19993
19697
  }
19994
- const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts89.factory.createObjectLiteralExpression([]);
19995
- if (!ts89.isObjectLiteralExpression(meta)) {
19698
+ const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts74.factory.createObjectLiteralExpression([]);
19699
+ if (!ts74.isObjectLiteralExpression(meta)) {
19996
19700
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@NgModule argument must be an object literal");
19997
19701
  }
19998
19702
  const ngModule = reflectObjectLiteral(meta);
@@ -20076,10 +19780,10 @@ var NgModuleDecoratorHandler = class {
20076
19780
  if (ngModule.has("id")) {
20077
19781
  const idExpr = ngModule.get("id");
20078
19782
  if (!isModuleIdExpression(idExpr)) {
20079
- id = new WrappedNodeExpr10(idExpr);
19783
+ id = new WrappedNodeExpr9(idExpr);
20080
19784
  } else {
20081
19785
  const diag = makeDiagnostic(ErrorCode.WARN_NGMODULE_ID_UNNECESSARY, idExpr, `Using 'module.id' for NgModule.id is a common anti-pattern that is ignored by the Angular compiler.`);
20082
- diag.category = ts89.DiagnosticCategory.Warning;
19786
+ diag.category = ts74.DiagnosticCategory.Warning;
20083
19787
  diagnostics.push(diag);
20084
19788
  }
20085
19789
  }
@@ -20105,10 +19809,10 @@ var NgModuleDecoratorHandler = class {
20105
19809
  ngModuleMetadata = {
20106
19810
  kind: R3NgModuleMetadataKind.Local,
20107
19811
  type,
20108
- bootstrapExpression: rawBootstrap ? new WrappedNodeExpr10(rawBootstrap) : null,
20109
- declarationsExpression: rawDeclarations ? new WrappedNodeExpr10(rawDeclarations) : null,
20110
- exportsExpression: rawExports ? new WrappedNodeExpr10(rawExports) : null,
20111
- importsExpression: rawImports ? new WrappedNodeExpr10(rawImports) : null,
19812
+ bootstrapExpression: rawBootstrap ? new WrappedNodeExpr9(rawBootstrap) : null,
19813
+ declarationsExpression: rawDeclarations ? new WrappedNodeExpr9(rawDeclarations) : null,
19814
+ exportsExpression: rawExports ? new WrappedNodeExpr9(rawExports) : null,
19815
+ importsExpression: rawImports ? new WrappedNodeExpr9(rawImports) : null,
20112
19816
  id,
20113
19817
  // Use `ɵɵsetNgModuleScope` to patch selector scopes onto the generated definition in a
20114
19818
  // tree-shakeable way.
@@ -20139,16 +19843,16 @@ var NgModuleDecoratorHandler = class {
20139
19843
  }
20140
19844
  const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
20141
19845
  let wrappedProviders = null;
20142
- if (rawProviders !== null && (!ts89.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
20143
- wrappedProviders = new WrappedNodeExpr10(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders);
19846
+ if (rawProviders !== null && (!ts74.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
19847
+ wrappedProviders = new WrappedNodeExpr9(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders);
20144
19848
  }
20145
19849
  const topLevelImports = [];
20146
19850
  if (!allowUnresolvedReferences && ngModule.has("imports")) {
20147
19851
  const rawImports2 = unwrapExpression(ngModule.get("imports"));
20148
19852
  let topLevelExpressions = [];
20149
- if (ts89.isArrayLiteralExpression(rawImports2)) {
19853
+ if (ts74.isArrayLiteralExpression(rawImports2)) {
20150
19854
  for (const element of rawImports2.elements) {
20151
- if (ts89.isSpreadElement(element)) {
19855
+ if (ts74.isSpreadElement(element)) {
20152
19856
  topLevelExpressions.push(element.expression);
20153
19857
  continue;
20154
19858
  }
@@ -20188,12 +19892,12 @@ var NgModuleDecoratorHandler = class {
20188
19892
  if (exp === null) {
20189
19893
  continue;
20190
19894
  }
20191
- if (ts89.isArrayLiteralExpression(exp)) {
19895
+ if (ts74.isArrayLiteralExpression(exp)) {
20192
19896
  if (exp.elements) {
20193
- injectorMetadata.imports.push(...exp.elements.map((n2) => new WrappedNodeExpr10(n2)));
19897
+ injectorMetadata.imports.push(...exp.elements.map((n2) => new WrappedNodeExpr9(n2)));
20194
19898
  }
20195
19899
  } else {
20196
- injectorMetadata.imports.push(new WrappedNodeExpr10(exp));
19900
+ injectorMetadata.imports.push(new WrappedNodeExpr9(exp));
20197
19901
  }
20198
19902
  }
20199
19903
  }
@@ -20270,7 +19974,7 @@ var NgModuleDecoratorHandler = class {
20270
19974
  };
20271
19975
  for (const topLevelImport of analysis.imports) {
20272
19976
  if (topLevelImport.hasModuleWithProviders) {
20273
- data.injectorImports.push(new WrappedNodeExpr10(topLevelImport.expression));
19977
+ data.injectorImports.push(new WrappedNodeExpr9(topLevelImport.expression));
20274
19978
  continue;
20275
19979
  }
20276
19980
  const refsToEmit = [];
@@ -20304,7 +20008,7 @@ var NgModuleDecoratorHandler = class {
20304
20008
  refsToEmit.push(ref);
20305
20009
  }
20306
20010
  if (refsToEmit.length === topLevelImport.resolvedReferences.length) {
20307
- data.injectorImports.push(new WrappedNodeExpr10(topLevelImport.expression));
20011
+ data.injectorImports.push(new WrappedNodeExpr9(topLevelImport.expression));
20308
20012
  } else {
20309
20013
  const context = node.getSourceFile();
20310
20014
  for (const ref of refsToEmit) {
@@ -20519,7 +20223,7 @@ function isNgModule(node, compilation) {
20519
20223
  return !compilation.dependencies.some((dep) => dep.ref.node === node);
20520
20224
  }
20521
20225
  function isModuleIdExpression(expr) {
20522
- return ts89.isPropertyAccessExpression(expr) && ts89.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
20226
+ return ts74.isPropertyAccessExpression(expr) && ts74.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
20523
20227
  }
20524
20228
  function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef, rawBootstrapExpr) {
20525
20229
  const componentClassName = bootstrappedClassRef.node.name.text;
@@ -20592,7 +20296,7 @@ var ComponentSymbol = class _ComponentSymbol extends DirectiveSymbol {
20592
20296
  };
20593
20297
 
20594
20298
  // packages/compiler-cli/src/ngtsc/annotations/component/src/util.js
20595
- import ts90 from "typescript";
20299
+ import ts75 from "typescript";
20596
20300
  function collectLegacyAnimationNames(value, legacyAnimationTriggerNames) {
20597
20301
  if (value instanceof Map) {
20598
20302
  const name = value.get("name");
@@ -20639,7 +20343,7 @@ function validateAndFlattenComponentImports(imports, expr, isDeferred) {
20639
20343
  for (let i = 0; i < imports.length; i++) {
20640
20344
  const ref = imports[i];
20641
20345
  let refExpr = expr;
20642
- if (ts90.isArrayLiteralExpression(expr) && expr.elements.length === imports.length && !expr.elements.some(ts90.isSpreadAssignment)) {
20346
+ if (ts75.isArrayLiteralExpression(expr) && expr.elements.length === imports.length && !expr.elements.some(ts75.isSpreadAssignment)) {
20643
20347
  refExpr = expr.elements[i];
20644
20348
  }
20645
20349
  if (Array.isArray(ref)) {
@@ -20701,11 +20405,11 @@ import { outputAst as o4 } from "@angular/compiler";
20701
20405
 
20702
20406
  // packages/compiler-cli/src/ngtsc/hmr/src/extract_dependencies.js
20703
20407
  import { outputAst as o3 } from "@angular/compiler";
20704
- import ts91 from "typescript";
20408
+ import ts76 from "typescript";
20705
20409
  function extractHmrDependencies(node, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator) {
20706
- const name = ts91.isClassDeclaration(node) && node.name ? node.name.text : null;
20410
+ const name = ts76.isClassDeclaration(node) && node.name ? node.name.text : null;
20707
20411
  const visitor = new PotentialTopLevelReadsVisitor();
20708
- const sourceFile = ts91.getOriginalNode(node).getSourceFile();
20412
+ const sourceFile = ts76.getOriginalNode(node).getSourceFile();
20709
20413
  definition.expression.visitExpression(visitor, null);
20710
20414
  definition.statements.forEach((statement) => statement.visitStatement(visitor, null));
20711
20415
  factory.initializer?.visitExpression(visitor, null);
@@ -20766,21 +20470,21 @@ function getRuntimeRepresentation(node, reflection, evaluator) {
20766
20470
  function getTopLevelDeclarationNames(sourceFile) {
20767
20471
  const results = /* @__PURE__ */ new Set();
20768
20472
  for (const node of sourceFile.statements) {
20769
- if (ts91.isClassDeclaration(node) || ts91.isFunctionDeclaration(node) || ts91.isEnumDeclaration(node)) {
20473
+ if (ts76.isClassDeclaration(node) || ts76.isFunctionDeclaration(node) || ts76.isEnumDeclaration(node)) {
20770
20474
  if (node.name) {
20771
20475
  results.add(node.name.text);
20772
20476
  }
20773
20477
  continue;
20774
20478
  }
20775
- if (ts91.isVariableStatement(node)) {
20479
+ if (ts76.isVariableStatement(node)) {
20776
20480
  for (const decl of node.declarationList.declarations) {
20777
20481
  trackBindingName(decl.name, results);
20778
20482
  }
20779
20483
  continue;
20780
20484
  }
20781
- if (ts91.isImportDeclaration(node) && node.importClause) {
20485
+ if (ts76.isImportDeclaration(node) && node.importClause) {
20782
20486
  const importClause = node.importClause;
20783
- if (importClause.phaseModifier === ts91.SyntaxKind.TypeKeyword) {
20487
+ if (importClause.phaseModifier === ts76.SyntaxKind.TypeKeyword) {
20784
20488
  continue;
20785
20489
  }
20786
20490
  if (importClause.name) {
@@ -20788,7 +20492,7 @@ function getTopLevelDeclarationNames(sourceFile) {
20788
20492
  }
20789
20493
  if (importClause.namedBindings) {
20790
20494
  const namedBindings = importClause.namedBindings;
20791
- if (ts91.isNamespaceImport(namedBindings)) {
20495
+ if (ts76.isNamespaceImport(namedBindings)) {
20792
20496
  results.add(namedBindings.name.text);
20793
20497
  } else {
20794
20498
  namedBindings.elements.forEach((el) => {
@@ -20804,11 +20508,11 @@ function getTopLevelDeclarationNames(sourceFile) {
20804
20508
  return results;
20805
20509
  }
20806
20510
  function trackBindingName(node, results) {
20807
- if (ts91.isIdentifier(node)) {
20511
+ if (ts76.isIdentifier(node)) {
20808
20512
  results.add(node.text);
20809
20513
  } else {
20810
20514
  for (const el of node.elements) {
20811
- if (!ts91.isOmittedExpression(el)) {
20515
+ if (!ts76.isOmittedExpression(el)) {
20812
20516
  trackBindingName(el.name, results);
20813
20517
  }
20814
20518
  }
@@ -20838,10 +20542,10 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
20838
20542
  * @param node Node from which to start the traversal.
20839
20543
  */
20840
20544
  addAllTopLevelIdentifiers = (node) => {
20841
- if (ts91.isIdentifier(node) && this.isTopLevelIdentifierReference(node)) {
20545
+ if (ts76.isIdentifier(node) && this.isTopLevelIdentifierReference(node)) {
20842
20546
  this.allReads.add(node);
20843
20547
  } else {
20844
- ts91.forEachChild(node, this.addAllTopLevelIdentifiers);
20548
+ ts76.forEachChild(node, this.addAllTopLevelIdentifiers);
20845
20549
  }
20846
20550
  };
20847
20551
  /**
@@ -20856,52 +20560,52 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
20856
20560
  if (!parent) {
20857
20561
  return false;
20858
20562
  }
20859
- if (ts91.isParenthesizedExpression(parent) && parent.expression === node) {
20860
- while (parent && ts91.isParenthesizedExpression(parent)) {
20563
+ if (ts76.isParenthesizedExpression(parent) && parent.expression === node) {
20564
+ while (parent && ts76.isParenthesizedExpression(parent)) {
20861
20565
  node = parent;
20862
20566
  parent = parent.parent;
20863
20567
  }
20864
20568
  }
20865
- if (ts91.isSourceFile(parent)) {
20569
+ if (ts76.isSourceFile(parent)) {
20866
20570
  return true;
20867
20571
  }
20868
- if (ts91.isCallExpression(parent)) {
20572
+ if (ts76.isCallExpression(parent)) {
20869
20573
  return parent.expression === node || parent.arguments.includes(node);
20870
20574
  }
20871
- if (ts91.isExpressionStatement(parent) || ts91.isPropertyAccessExpression(parent) || ts91.isComputedPropertyName(parent) || ts91.isTemplateSpan(parent) || ts91.isSpreadAssignment(parent) || ts91.isSpreadElement(parent) || ts91.isAwaitExpression(parent) || ts91.isNonNullExpression(parent) || ts91.isIfStatement(parent) || ts91.isDoStatement(parent) || ts91.isWhileStatement(parent) || ts91.isSwitchStatement(parent) || ts91.isCaseClause(parent) || ts91.isThrowStatement(parent) || ts91.isNewExpression(parent) || ts91.isExpressionWithTypeArguments(parent)) {
20575
+ if (ts76.isExpressionStatement(parent) || ts76.isPropertyAccessExpression(parent) || ts76.isComputedPropertyName(parent) || ts76.isTemplateSpan(parent) || ts76.isSpreadAssignment(parent) || ts76.isSpreadElement(parent) || ts76.isAwaitExpression(parent) || ts76.isNonNullExpression(parent) || ts76.isIfStatement(parent) || ts76.isDoStatement(parent) || ts76.isWhileStatement(parent) || ts76.isSwitchStatement(parent) || ts76.isCaseClause(parent) || ts76.isThrowStatement(parent) || ts76.isNewExpression(parent) || ts76.isExpressionWithTypeArguments(parent)) {
20872
20576
  return parent.expression === node;
20873
20577
  }
20874
- if (ts91.isArrayLiteralExpression(parent)) {
20578
+ if (ts76.isArrayLiteralExpression(parent)) {
20875
20579
  return parent.elements.includes(node);
20876
20580
  }
20877
- if (ts91.isPropertyAssignment(parent) || ts91.isParameter(parent) || ts91.isBindingElement(parent) || ts91.isPropertyDeclaration(parent) || ts91.isEnumMember(parent)) {
20581
+ if (ts76.isPropertyAssignment(parent) || ts76.isParameter(parent) || ts76.isBindingElement(parent) || ts76.isPropertyDeclaration(parent) || ts76.isEnumMember(parent)) {
20878
20582
  return parent.initializer === node;
20879
20583
  }
20880
- if (ts91.isVariableDeclaration(parent)) {
20584
+ if (ts76.isVariableDeclaration(parent)) {
20881
20585
  return parent.name === node || parent.initializer === node;
20882
20586
  }
20883
- if (ts91.isClassDeclaration(parent) || ts91.isFunctionDeclaration(parent) || ts91.isShorthandPropertyAssignment(parent)) {
20587
+ if (ts76.isClassDeclaration(parent) || ts76.isFunctionDeclaration(parent) || ts76.isShorthandPropertyAssignment(parent)) {
20884
20588
  return parent.name === node;
20885
20589
  }
20886
- if (ts91.isElementAccessExpression(parent)) {
20590
+ if (ts76.isElementAccessExpression(parent)) {
20887
20591
  return parent.expression === node || parent.argumentExpression === node;
20888
20592
  }
20889
- if (ts91.isBinaryExpression(parent)) {
20593
+ if (ts76.isBinaryExpression(parent)) {
20890
20594
  return parent.left === node || parent.right === node;
20891
20595
  }
20892
- if (ts91.isForInStatement(parent) || ts91.isForOfStatement(parent)) {
20596
+ if (ts76.isForInStatement(parent) || ts76.isForOfStatement(parent)) {
20893
20597
  return parent.expression === node || parent.initializer === node;
20894
20598
  }
20895
- if (ts91.isForStatement(parent)) {
20599
+ if (ts76.isForStatement(parent)) {
20896
20600
  return parent.condition === node || parent.initializer === node || parent.incrementor === node;
20897
20601
  }
20898
- if (ts91.isArrowFunction(parent)) {
20602
+ if (ts76.isArrowFunction(parent)) {
20899
20603
  return parent.body === node;
20900
20604
  }
20901
- if (ts91.isImportSpecifier(parent) || ts91.isExportSpecifier(parent)) {
20605
+ if (ts76.isImportSpecifier(parent) || ts76.isExportSpecifier(parent)) {
20902
20606
  return (parent.propertyName || parent.name) === node;
20903
20607
  }
20904
- if (ts91.isConditionalExpression(parent)) {
20608
+ if (ts76.isConditionalExpression(parent)) {
20905
20609
  return parent.condition === node || parent.whenFalse === node || parent.whenTrue === node;
20906
20610
  }
20907
20611
  return false;
@@ -20913,20 +20617,20 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
20913
20617
  };
20914
20618
  function isConstEnumReference(node, reflection) {
20915
20619
  const parent = node.parent;
20916
- if (!parent || !ts91.isPropertyAccessExpression(parent) || parent.expression !== node || !ts91.isIdentifier(parent.name)) {
20620
+ if (!parent || !ts76.isPropertyAccessExpression(parent) || parent.expression !== node || !ts76.isIdentifier(parent.name)) {
20917
20621
  return false;
20918
20622
  }
20919
20623
  const declaration = reflection.getDeclarationOfIdentifier(node);
20920
- return declaration !== null && ts91.isEnumDeclaration(declaration.node) && !!declaration.node.modifiers?.some((m) => m.kind === ts91.SyntaxKind.ConstKeyword);
20624
+ return declaration !== null && ts76.isEnumDeclaration(declaration.node) && !!declaration.node.modifiers?.some((m) => m.kind === ts76.SyntaxKind.ConstKeyword);
20921
20625
  }
20922
20626
 
20923
20627
  // packages/compiler-cli/src/ngtsc/hmr/src/metadata.js
20924
- import ts92 from "typescript";
20628
+ import ts77 from "typescript";
20925
20629
  function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDirs, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
20926
20630
  if (!reflection.isClass(clazz)) {
20927
20631
  return null;
20928
20632
  }
20929
- const sourceFile = ts92.getOriginalNode(clazz).getSourceFile();
20633
+ const sourceFile = ts77.getOriginalNode(clazz).getSourceFile();
20930
20634
  const filePath = getProjectRelativePath(sourceFile.fileName, rootDirs, compilerHost) || compilerHost.getCanonicalFileName(sourceFile.fileName);
20931
20635
  const dependencies = extractHmrDependencies(clazz, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator);
20932
20636
  if (dependencies === null) {
@@ -20944,7 +20648,7 @@ function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDi
20944
20648
 
20945
20649
  // packages/compiler-cli/src/ngtsc/hmr/src/update_declaration.js
20946
20650
  import { compileHmrUpdateCallback } from "@angular/compiler";
20947
- import ts93 from "typescript";
20651
+ import ts78 from "typescript";
20948
20652
  function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, declaration) {
20949
20653
  const namespaceSpecifiers = meta.namespaceDependencies.reduce((result, current) => {
20950
20654
  result.set(current.moduleName, current.assignedName);
@@ -20956,11 +20660,11 @@ function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, d
20956
20660
  rewriter: importRewriter
20957
20661
  });
20958
20662
  const callback = compileHmrUpdateCallback(compilationResults, constantStatements, meta);
20959
- const sourceFile = ts93.getOriginalNode(declaration).getSourceFile();
20663
+ const sourceFile = ts78.getOriginalNode(declaration).getSourceFile();
20960
20664
  const node = translateStatement(sourceFile, callback, importManager);
20961
- return ts93.factory.updateFunctionDeclaration(node, [
20962
- ts93.factory.createToken(ts93.SyntaxKind.ExportKeyword),
20963
- ts93.factory.createToken(ts93.SyntaxKind.DefaultKeyword)
20665
+ return ts78.factory.updateFunctionDeclaration(node, [
20666
+ ts78.factory.createToken(ts78.SyntaxKind.ExportKeyword),
20667
+ ts78.factory.createToken(ts78.SyntaxKind.DefaultKeyword)
20964
20668
  ], node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body);
20965
20669
  }
20966
20670
  var HmrModuleImportRewriter = class {
@@ -21407,7 +21111,7 @@ var ComponentDecoratorHandler = class {
21407
21111
  path: absoluteFrom(template.declaration.resolvedTemplateUrl),
21408
21112
  node: template.sourceMapping.node
21409
21113
  };
21410
- const relativeTemplatePath = getProjectRelativePath(templateResource.path ?? ts94.getOriginalNode(node).getSourceFile().fileName, this.rootDirs, this.compilerHost);
21114
+ const relativeTemplatePath = getProjectRelativePath(templateResource.path ?? ts79.getOriginalNode(node).getSourceFile().fileName, this.rootDirs, this.compilerHost);
21411
21115
  let selectorlessEnabled = false;
21412
21116
  let localReferencedSymbols = null;
21413
21117
  if (this.enableSelectorless) {
@@ -21441,7 +21145,7 @@ var ComponentDecoratorHandler = class {
21441
21145
  externalStyles.push(resourceUrl);
21442
21146
  continue;
21443
21147
  }
21444
- if (styleUrl.source === 2 && ts94.isStringLiteralLike(styleUrl.expression)) {
21148
+ if (styleUrl.source === 2 && ts79.isStringLiteralLike(styleUrl.expression)) {
21445
21149
  styleResources.add({
21446
21150
  path: absoluteFrom(resourceUrl),
21447
21151
  node: styleUrl.expression
@@ -21649,7 +21353,7 @@ var ComponentDecoratorHandler = class {
21649
21353
  return null;
21650
21354
  }
21651
21355
  typeCheck(ctx, node, meta) {
21652
- if (!ts94.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
21356
+ if (!ts79.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
21653
21357
  return;
21654
21358
  }
21655
21359
  const ref = new Reference(node);
@@ -22180,12 +21884,12 @@ var ComponentDecoratorHandler = class {
22180
21884
  */
22181
21885
  collectExplicitlyDeferredSymbols(rawDeferredImports) {
22182
21886
  const deferredTypes = /* @__PURE__ */ new Map();
22183
- if (!ts94.isArrayLiteralExpression(rawDeferredImports)) {
21887
+ if (!ts79.isArrayLiteralExpression(rawDeferredImports)) {
22184
21888
  return deferredTypes;
22185
21889
  }
22186
21890
  for (const element of rawDeferredImports.elements) {
22187
21891
  const node = tryUnwrapForwardRef(element, this.reflector) || element;
22188
- if (!ts94.isIdentifier(node)) {
21892
+ if (!ts79.isIdentifier(node)) {
22189
21893
  continue;
22190
21894
  }
22191
21895
  const imp = this.reflector.getImportOfIdentifier(node);
@@ -22253,12 +21957,12 @@ var ComponentDecoratorHandler = class {
22253
21957
  }
22254
21958
  }
22255
21959
  if (analysisData.meta.isStandalone) {
22256
- if (analysisData.rawImports !== null && ts94.isArrayLiteralExpression(analysisData.rawImports)) {
21960
+ if (analysisData.rawImports !== null && ts79.isArrayLiteralExpression(analysisData.rawImports)) {
22257
21961
  for (const element of analysisData.rawImports.elements) {
22258
21962
  this.registerDeferrableCandidate(componentClassDecl, element, false, allDeferredDecls, eagerlyUsedDecls, resolutionData);
22259
21963
  }
22260
21964
  }
22261
- if (analysisData.rawDeferredImports !== null && ts94.isArrayLiteralExpression(analysisData.rawDeferredImports)) {
21965
+ if (analysisData.rawDeferredImports !== null && ts79.isArrayLiteralExpression(analysisData.rawDeferredImports)) {
22262
21966
  for (const element of analysisData.rawDeferredImports.elements) {
22263
21967
  this.registerDeferrableCandidate(componentClassDecl, element, false, allDeferredDecls, eagerlyUsedDecls, resolutionData);
22264
21968
  }
@@ -22277,7 +21981,7 @@ var ComponentDecoratorHandler = class {
22277
21981
  */
22278
21982
  registerDeferrableCandidate(componentClassDecl, element, isDeferredImport, allDeferredDecls, eagerlyUsedDecls, resolutionData) {
22279
21983
  const node = tryUnwrapForwardRef(element, this.reflector) || element;
22280
- if (!ts94.isIdentifier(node)) {
21984
+ if (!ts79.isIdentifier(node)) {
22281
21985
  return;
22282
21986
  }
22283
21987
  const imp = this.reflector.getImportOfIdentifier(node);
@@ -22411,8 +22115,8 @@ function isDefaultImport(node) {
22411
22115
  }
22412
22116
 
22413
22117
  // packages/compiler-cli/src/ngtsc/annotations/src/injectable.js
22414
- import { compileClassMetadata as compileClassMetadata3, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression3, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr11 } from "@angular/compiler";
22415
- import ts95 from "typescript";
22118
+ import { compileClassMetadata as compileClassMetadata3, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression3, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr10 } from "@angular/compiler";
22119
+ import ts80 from "typescript";
22416
22120
  var InjectableDecoratorHandler = class {
22417
22121
  reflector;
22418
22122
  evaluator;
@@ -22547,7 +22251,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
22547
22251
  };
22548
22252
  } else if (decorator.args.length === 1) {
22549
22253
  const metaNode = decorator.args[0];
22550
- if (!ts95.isObjectLiteralExpression(metaNode)) {
22254
+ if (!ts80.isObjectLiteralExpression(metaNode)) {
22551
22255
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
22552
22256
  }
22553
22257
  const meta = reflectObjectLiteral(metaNode);
@@ -22559,7 +22263,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
22559
22263
  let deps = void 0;
22560
22264
  if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
22561
22265
  const depsExpr = meta.get("deps");
22562
- if (!ts95.isArrayLiteralExpression(depsExpr)) {
22266
+ if (!ts80.isArrayLiteralExpression(depsExpr)) {
22563
22267
  throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
22564
22268
  }
22565
22269
  deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
@@ -22573,7 +22277,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
22573
22277
  result.useClass = getProviderExpression(meta.get("useClass"), reflector);
22574
22278
  result.deps = deps;
22575
22279
  } else if (meta.has("useFactory")) {
22576
- result.useFactory = new WrappedNodeExpr11(meta.get("useFactory"));
22280
+ result.useFactory = new WrappedNodeExpr10(meta.get("useFactory"));
22577
22281
  result.deps = deps;
22578
22282
  }
22579
22283
  return result;
@@ -22584,7 +22288,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
22584
22288
  function getProviderExpression(expression, reflector) {
22585
22289
  const forwardRefValue = tryUnwrapForwardRef(expression, reflector);
22586
22290
  return createMayBeForwardRefExpression3(
22587
- new WrappedNodeExpr11(forwardRefValue ?? expression),
22291
+ new WrappedNodeExpr10(forwardRefValue ?? expression),
22588
22292
  forwardRefValue !== null ? 2 : 0
22589
22293
  /* ForwardRefHandling.None */
22590
22294
  );
@@ -22616,7 +22320,7 @@ function requiresValidCtor(meta) {
22616
22320
  }
22617
22321
  function getDep(dep, reflector) {
22618
22322
  const meta = {
22619
- token: new WrappedNodeExpr11(dep),
22323
+ token: new WrappedNodeExpr10(dep),
22620
22324
  attributeNameType: null,
22621
22325
  host: false,
22622
22326
  optional: false,
@@ -22631,7 +22335,7 @@ function getDep(dep, reflector) {
22631
22335
  switch (source.name) {
22632
22336
  case "Inject":
22633
22337
  if (token !== void 0) {
22634
- meta.token = new WrappedNodeExpr11(token);
22338
+ meta.token = new WrappedNodeExpr10(token);
22635
22339
  }
22636
22340
  break;
22637
22341
  case "Optional":
@@ -22648,17 +22352,17 @@ function getDep(dep, reflector) {
22648
22352
  }
22649
22353
  return true;
22650
22354
  }
22651
- if (ts95.isArrayLiteralExpression(dep)) {
22355
+ if (ts80.isArrayLiteralExpression(dep)) {
22652
22356
  dep.elements.forEach((el) => {
22653
22357
  let isDecorator = false;
22654
- if (ts95.isIdentifier(el)) {
22358
+ if (ts80.isIdentifier(el)) {
22655
22359
  isDecorator = maybeUpdateDecorator(el, reflector);
22656
- } else if (ts95.isNewExpression(el) && ts95.isIdentifier(el.expression)) {
22360
+ } else if (ts80.isNewExpression(el) && ts80.isIdentifier(el.expression)) {
22657
22361
  const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
22658
22362
  isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
22659
22363
  }
22660
22364
  if (!isDecorator) {
22661
- meta.token = new WrappedNodeExpr11(el);
22365
+ meta.token = new WrappedNodeExpr10(el);
22662
22366
  }
22663
22367
  });
22664
22368
  }
@@ -22667,7 +22371,7 @@ function getDep(dep, reflector) {
22667
22371
 
22668
22372
  // packages/compiler-cli/src/ngtsc/annotations/src/pipe.js
22669
22373
  import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5 } from "@angular/compiler";
22670
- import ts96 from "typescript";
22374
+ import ts81 from "typescript";
22671
22375
  var PipeSymbol = class _PipeSymbol extends SemanticSymbol {
22672
22376
  name;
22673
22377
  constructor(decl, name) {
@@ -22737,13 +22441,13 @@ var PipeDecoratorHandler = class {
22737
22441
  }
22738
22442
  const meta = decorator.args.length === 0 || // TODO(crisbeto): temporary for testing until we've changed
22739
22443
  // the pipe public API not to require a name.
22740
- ts96.isNonNullExpression(decorator.args[0]) && decorator.args[0].expression.kind === ts96.SyntaxKind.NullKeyword ? null : unwrapExpression(decorator.args[0]);
22444
+ ts81.isNonNullExpression(decorator.args[0]) && decorator.args[0].expression.kind === ts81.SyntaxKind.NullKeyword ? null : unwrapExpression(decorator.args[0]);
22741
22445
  let pipeName = null;
22742
22446
  let pipeNameExpr = null;
22743
22447
  let pure = true;
22744
22448
  let isStandalone = this.implicitStandaloneValue;
22745
22449
  if (meta !== null) {
22746
- if (!ts96.isObjectLiteralExpression(meta)) {
22450
+ if (!ts81.isObjectLiteralExpression(meta)) {
22747
22451
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
22748
22452
  }
22749
22453
  const pipe = reflectObjectLiteral(meta);
@@ -22869,12 +22573,12 @@ var PipeDecoratorHandler = class {
22869
22573
  };
22870
22574
 
22871
22575
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform.js
22872
- import ts99 from "typescript";
22576
+ import ts84 from "typescript";
22873
22577
 
22874
22578
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform_api.js
22875
- import ts97 from "typescript";
22579
+ import ts82 from "typescript";
22876
22580
  function createSyntheticAngularCoreDecoratorAccess(factory, importManager, ngClassDecorator, sourceFile, decoratorName) {
22877
- const classDecoratorIdentifier = ts97.isIdentifier(ngClassDecorator.identifier) ? ngClassDecorator.identifier : ngClassDecorator.identifier.expression;
22581
+ const classDecoratorIdentifier = ts82.isIdentifier(ngClassDecorator.identifier) ? ngClassDecorator.identifier : ngClassDecorator.identifier.expression;
22878
22582
  return factory.createPropertyAccessExpression(
22879
22583
  importManager.addImport({
22880
22584
  exportModuleSpecifier: "@angular/core",
@@ -22884,11 +22588,11 @@ function createSyntheticAngularCoreDecoratorAccess(factory, importManager, ngCla
22884
22588
  // The synthetic identifier may be checked later by the downlevel decorators
22885
22589
  // transform to resolve to an Angular import using `getSymbolAtLocation`. We trick
22886
22590
  // the transform to think it's not synthetic and comes from Angular core.
22887
- ts97.setOriginalNode(factory.createIdentifier(decoratorName), classDecoratorIdentifier)
22591
+ ts82.setOriginalNode(factory.createIdentifier(decoratorName), classDecoratorIdentifier)
22888
22592
  );
22889
22593
  }
22890
22594
  function castAsAny(factory, expr) {
22891
- return factory.createAsExpression(expr, factory.createKeywordTypeNode(ts97.SyntaxKind.AnyKeyword));
22595
+ return factory.createAsExpression(expr, factory.createKeywordTypeNode(ts82.SyntaxKind.AnyKeyword));
22892
22596
  }
22893
22597
 
22894
22598
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/input_function.js
@@ -22919,7 +22623,7 @@ var signalInputsTransform = (member, sourceFile, host, factory, importTracker, i
22919
22623
  };
22920
22624
 
22921
22625
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/model_function.js
22922
- import ts98 from "typescript";
22626
+ import ts83 from "typescript";
22923
22627
  var signalModelTransform = (member, sourceFile, host, factory, importTracker, importManager, classDecorator, isCore) => {
22924
22628
  if (host.getDecoratorsOfDeclaration(member.node)?.some((d) => {
22925
22629
  return isAngularDecorator2(d, "Input", isCore) || isAngularDecorator2(d, "Output", isCore);
@@ -22940,7 +22644,7 @@ var signalModelTransform = (member, sourceFile, host, factory, importTracker, im
22940
22644
  // Config is cast to `any` because `isSignal` will be private, and in case this
22941
22645
  // transform is used directly as a pre-compilation step, the decorator should
22942
22646
  // not fail. It is already validated now due to us parsing the input metadata.
22943
- factory.createAsExpression(inputConfig, factory.createKeywordTypeNode(ts98.SyntaxKind.AnyKeyword)),
22647
+ factory.createAsExpression(inputConfig, factory.createKeywordTypeNode(ts83.SyntaxKind.AnyKeyword)),
22944
22648
  classDecorator,
22945
22649
  factory,
22946
22650
  sourceFile,
@@ -23015,21 +22719,21 @@ function getInitializerApiJitTransform(host, importTracker, isCore, shouldTransf
23015
22719
  return (ctx) => {
23016
22720
  return (sourceFile) => {
23017
22721
  const importManager = new ImportManager();
23018
- sourceFile = ts99.visitNode(sourceFile, createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass), ts99.isSourceFile);
22722
+ sourceFile = ts84.visitNode(sourceFile, createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass), ts84.isSourceFile);
23019
22723
  return importManager.transformTsFile(ctx, sourceFile);
23020
22724
  };
23021
22725
  };
23022
22726
  }
23023
22727
  function createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass) {
23024
22728
  const visitor = (node) => {
23025
- if (ts99.isClassDeclaration(node) && node.name !== void 0) {
23026
- const originalNode = ts99.getOriginalNode(node, ts99.isClassDeclaration);
22729
+ if (ts84.isClassDeclaration(node) && node.name !== void 0) {
22730
+ const originalNode = ts84.getOriginalNode(node, ts84.isClassDeclaration);
23027
22731
  const angularDecorator = host.getDecoratorsOfDeclaration(originalNode)?.find((d) => decoratorsWithInputs.some((name) => isAngularDecorator2(d, name, isCore)));
23028
22732
  if (angularDecorator !== void 0 && (shouldTransformClass === void 0 || shouldTransformClass(node))) {
23029
22733
  let hasChanged = false;
23030
22734
  const sourceFile = originalNode.getSourceFile();
23031
22735
  const members = node.members.map((memberNode) => {
23032
- if (!ts99.isPropertyDeclaration(memberNode)) {
22736
+ if (!ts84.isPropertyDeclaration(memberNode)) {
23033
22737
  return memberNode;
23034
22738
  }
23035
22739
  const member = reflectClassMember(memberNode);
@@ -23050,7 +22754,7 @@ function createTransformVisitor(ctx, host, importManager, importTracker, isCore,
23050
22754
  }
23051
22755
  }
23052
22756
  }
23053
- return ts99.visitEachChild(node, visitor, ctx);
22757
+ return ts84.visitEachChild(node, visitor, ctx);
23054
22758
  };
23055
22759
  return visitor;
23056
22760
  }