@angular/compiler-cli 21.2.1 → 21.2.3

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 (51) hide show
  1. package/bundles/{chunk-PW54LIP6.js → chunk-6JHVJEKD.js} +5 -5
  2. package/bundles/chunk-FLWAEX6T.js +1 -1
  3. package/bundles/{chunk-VO3Q626H.js → chunk-KJC7YNMY.js} +2 -2
  4. package/bundles/{chunk-IG22BDVK.js → chunk-L3PEIUBN.js} +1296 -1323
  5. package/bundles/{chunk-WBUBKNAO.js → chunk-NU2SXS64.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 +2 -2
  14. package/src/ngtsc/annotations/common/src/diagnostics.d.ts +7 -7
  15. package/src/ngtsc/core/api/src/adapter.d.ts +1 -1
  16. package/src/ngtsc/incremental/src/incremental.d.ts +1 -1
  17. package/src/ngtsc/typecheck/api/api.d.ts +80 -4
  18. package/src/ngtsc/typecheck/src/checker.d.ts +1 -1
  19. package/src/ngtsc/typecheck/src/comments.d.ts +0 -7
  20. package/src/ngtsc/typecheck/src/context.d.ts +1 -1
  21. package/src/ngtsc/typecheck/src/environment.d.ts +9 -7
  22. package/src/ngtsc/typecheck/src/expression.d.ts +3 -15
  23. package/src/ngtsc/typecheck/src/host_bindings.d.ts +1 -1
  24. package/src/ngtsc/typecheck/src/oob.d.ts +5 -4
  25. package/src/ngtsc/typecheck/src/ops/base.d.ts +3 -3
  26. package/src/ngtsc/typecheck/src/ops/bindings.d.ts +11 -8
  27. package/src/ngtsc/typecheck/src/ops/codegen.d.ts +74 -0
  28. package/src/ngtsc/typecheck/src/ops/context.d.ts +5 -7
  29. package/src/ngtsc/typecheck/src/ops/directive_constructor.d.ts +6 -6
  30. package/src/ngtsc/typecheck/src/ops/directive_type.d.ts +7 -7
  31. package/src/ngtsc/typecheck/src/ops/element.d.ts +2 -2
  32. package/src/ngtsc/typecheck/src/ops/events.d.ts +4 -4
  33. package/src/ngtsc/typecheck/src/ops/expression.d.ts +5 -5
  34. package/src/ngtsc/typecheck/src/ops/for_block.d.ts +2 -2
  35. package/src/ngtsc/typecheck/src/ops/host.d.ts +2 -2
  36. package/src/ngtsc/typecheck/src/ops/inputs.d.ts +4 -4
  37. package/src/ngtsc/typecheck/src/ops/let.d.ts +2 -2
  38. package/src/ngtsc/typecheck/src/ops/references.d.ts +5 -5
  39. package/src/ngtsc/typecheck/src/ops/schema.d.ts +2 -2
  40. package/src/ngtsc/typecheck/src/ops/scope.d.ts +10 -10
  41. package/src/ngtsc/typecheck/src/ops/selectorless.d.ts +2 -2
  42. package/src/ngtsc/typecheck/src/ops/signal_forms.d.ts +6 -6
  43. package/src/ngtsc/typecheck/src/ops/template.d.ts +2 -2
  44. package/src/ngtsc/typecheck/src/ops/variables.d.ts +6 -6
  45. package/src/ngtsc/typecheck/src/reference_emit_environment.d.ts +18 -4
  46. package/src/ngtsc/typecheck/src/tcb_adapter.d.ts +20 -0
  47. package/src/ngtsc/typecheck/src/tcb_util.d.ts +2 -1
  48. package/src/ngtsc/typecheck/src/ts_util.d.ts +0 -37
  49. package/src/ngtsc/typecheck/src/type_check_block.d.ts +2 -4
  50. package/src/ngtsc/typecheck/src/type_check_file.d.ts +4 -2
  51. package/src/ngtsc/typecheck/src/type_constructor.d.ts +4 -3
@@ -229,7 +229,7 @@ var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
229
229
  import { VERSION } from "@angular/compiler";
230
230
  var DOC_PAGE_BASE_URL = (() => {
231
231
  const full = VERSION.full;
232
- const isPreRelease = full.includes("-next") || full.includes("-rc") || full === "21.2.1";
232
+ const isPreRelease = full.includes("-next") || full.includes("-rc") || full === "21.2.3";
233
233
  const prefix = isPreRelease ? "next" : `v${VERSION.major}`;
234
234
  return `https://${prefix}.angular.dev`;
235
235
  })();
@@ -7013,6 +7013,7 @@ function insertDebugNameIntoCallExpression(node, debugName) {
7013
7013
  return ts32.factory.updateCallExpression(node, node.expression, node.typeArguments, newArgs);
7014
7014
  }
7015
7015
  function createNgDevModeConditional(devModeExpression, prodModeExpression) {
7016
+ ts32.addSyntheticLeadingComment(prodModeExpression, ts32.SyntaxKind.MultiLineCommentTrivia, " istanbul ignore next ", false);
7016
7017
  return ts32.factory.createParenthesizedExpression(ts32.factory.createConditionalExpression(ts32.factory.createIdentifier("ngDevMode"), void 0, devModeExpression, void 0, prodModeExpression));
7017
7018
  }
7018
7019
  function isVariableDeclarationCase(node) {
@@ -9835,8 +9836,8 @@ function _extractTemplateStyleUrls(template) {
9835
9836
  }
9836
9837
 
9837
9838
  // packages/compiler-cli/src/ngtsc/annotations/component/src/handler.js
9838
- 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";
9839
+ import { compileClassDebugInfo, compileHmrInitializer, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareComponentFromMetadata, compileDeferResolverFunction, ConstantPool as ConstantPool2, CssSelector as CssSelector5, DomElementSchemaRegistry as DomElementSchemaRegistry3, ExternalExpr as ExternalExpr11, 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";
9840
+ import ts79 from "typescript";
9840
9841
 
9841
9842
  // packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.js
9842
9843
  import ts43 from "typescript";
@@ -10955,7 +10956,7 @@ var TypeCheckScopeRegistry = class {
10955
10956
 
10956
10957
  // packages/compiler-cli/src/ngtsc/annotations/directive/src/handler.js
10957
10958
  import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, FactoryTarget, makeBindingParser as makeBindingParser2, R3TargetBinder, WrappedNodeExpr as WrappedNodeExpr9 } from "@angular/compiler";
10958
- import ts87 from "typescript";
10959
+ import ts72 from "typescript";
10959
10960
 
10960
10961
  // packages/compiler-cli/src/ngtsc/annotations/directive/src/symbol.js
10961
10962
  var DirectiveSymbol = class _DirectiveSymbol extends SemanticSymbol {
@@ -11044,7 +11045,7 @@ function isBaseClassEqual(current, previous) {
11044
11045
  }
11045
11046
 
11046
11047
  // 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";
11048
+ import { CssSelector as CssSelector4, DomElementSchemaRegistry as DomElementSchemaRegistry2, ExternalExpr as ExternalExpr9, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
11048
11049
 
11049
11050
  // packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.js
11050
11051
  import ts48 from "typescript";
@@ -11078,25 +11079,7 @@ var ExpressionIdentifier;
11078
11079
  ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
11079
11080
  ExpressionIdentifier2["VARIABLE_AS_EXPRESSION"] = "VAE";
11080
11081
  })(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
11082
  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
11083
  function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
11101
11084
  return ts47.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
11102
11085
  if (kind !== ts47.SyntaxKind.MultiLineCommentTrivia) {
@@ -11182,119 +11165,9 @@ function hasExpressionIdentifier(sourceFile, node, identifier) {
11182
11165
  }
11183
11166
 
11184
11167
  // 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
11168
  function isAccessExpression(node) {
11289
11169
  return ts48.isPropertyAccessExpression(node) || ts48.isElementAccessExpression(node);
11290
11170
  }
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
11171
  function isDirectiveDeclaration(node) {
11299
11172
  const sourceFile = node.getSourceFile();
11300
11173
  return (ts48.isTypeNode(node) || ts48.isIdentifier(node)) && ts48.isVariableDeclaration(node.parent) && hasExpressionIdentifier(sourceFile, node, ExpressionIdentifier.DIRECTIVE);
@@ -11316,7 +11189,7 @@ function isSymbolAliasOf(firstSymbol, lastSymbol, typeChecker) {
11316
11189
  }
11317
11190
 
11318
11191
  // packages/compiler-cli/src/ngtsc/typecheck/src/checker.js
11319
- import ts86 from "typescript";
11192
+ import ts71 from "typescript";
11320
11193
 
11321
11194
  // packages/compiler-cli/src/ngtsc/program_driver/src/api.js
11322
11195
  var NgOriginalFile = Symbol("NgOriginalFile");
@@ -12908,134 +12781,13 @@ var MagicString = class _MagicString {
12908
12781
  };
12909
12782
 
12910
12783
  // packages/compiler-cli/src/ngtsc/typecheck/src/context.js
12911
- import ts84 from "typescript";
12912
-
12913
- // packages/compiler-cli/src/ngtsc/typecheck/src/dom.js
12914
- import { DomElementSchemaRegistry } from "@angular/compiler";
12915
- import ts52 from "typescript";
12916
- var REGISTRY = new DomElementSchemaRegistry();
12917
- var REMOVE_XHTML_REGEX = /^:xhtml:/;
12918
- var RegistryDomSchemaChecker = class {
12919
- resolver;
12920
- _diagnostics = [];
12921
- get diagnostics() {
12922
- return this._diagnostics;
12923
- }
12924
- constructor(resolver) {
12925
- this.resolver = resolver;
12926
- }
12927
- checkElement(id, tagName, sourceSpanForDiagnostics, schemas, hostIsStandalone) {
12928
- const name = tagName.replace(REMOVE_XHTML_REGEX, "");
12929
- if (!REGISTRY.hasElement(name, schemas)) {
12930
- const mapping = this.resolver.getTemplateSourceMapping(id);
12931
- const schemas2 = `'${hostIsStandalone ? "@Component" : "@NgModule"}.schemas'`;
12932
- let errorMsg = `'${name}' is not a known element:
12933
- `;
12934
- errorMsg += `1. If '${name}' is an Angular component, then verify that it is ${hostIsStandalone ? "included in the '@Component.imports' of this component" : "part of this module"}.
12935
- `;
12936
- if (name.indexOf("-") > -1) {
12937
- errorMsg += `2. If '${name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.`;
12938
- } else {
12939
- errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
12940
- }
12941
- const diag = makeTemplateDiagnostic(id, mapping, sourceSpanForDiagnostics, ts52.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
12942
- this._diagnostics.push(diag);
12943
- }
12944
- }
12945
- checkTemplateElementProperty(id, tagName, name, span, schemas, hostIsStandalone) {
12946
- if (!REGISTRY.hasProperty(tagName, name, schemas)) {
12947
- const mapping = this.resolver.getTemplateSourceMapping(id);
12948
- const decorator = hostIsStandalone ? "@Component" : "@NgModule";
12949
- const schemas2 = `'${decorator}.schemas'`;
12950
- let errorMsg = `Can't bind to '${name}' since it isn't a known property of '${tagName}'.`;
12951
- if (tagName.startsWith("ng-")) {
12952
- errorMsg += `
12953
- 1. If '${name}' is an Angular directive, then add 'CommonModule' to the '${decorator}.imports' of this component.
12954
- 2. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
12955
- } else if (tagName.indexOf("-") > -1) {
12956
- errorMsg += `
12957
- 1. If '${tagName}' is an Angular component and it has '${name}' input, then verify that it is ${hostIsStandalone ? "included in the '@Component.imports' of this component" : "part of this module"}.
12958
- 2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.
12959
- 3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
12960
- }
12961
- const diag = makeTemplateDiagnostic(id, mapping, span, ts52.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
12962
- this._diagnostics.push(diag);
12963
- }
12964
- }
12965
- checkHostElementProperty(id, element, name, span, schemas) {
12966
- for (const tagName of element.tagNames) {
12967
- if (REGISTRY.hasProperty(tagName, name, schemas)) {
12968
- continue;
12969
- }
12970
- const errorMessage = `Can't bind to '${name}' since it isn't a known property of '${tagName}'.`;
12971
- const mapping = this.resolver.getHostBindingsMapping(id);
12972
- const diag = makeTemplateDiagnostic(id, mapping, span, ts52.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMessage);
12973
- this._diagnostics.push(diag);
12974
- break;
12975
- }
12976
- }
12977
- };
12978
-
12979
- // packages/compiler-cli/src/ngtsc/typecheck/src/environment.js
12980
- import ts57 from "typescript";
12784
+ import ts68 from "typescript";
12981
12785
 
12982
- // packages/compiler-cli/src/ngtsc/typecheck/src/reference_emit_environment.js
12983
- import { ExpressionType, ExternalExpr as ExternalExpr7, TypeModifier } from "@angular/compiler";
12984
- var ReferenceEmitEnvironment = class {
12985
- importManager;
12986
- refEmitter;
12987
- reflector;
12988
- contextFile;
12989
- constructor(importManager, refEmitter, reflector, contextFile) {
12990
- this.importManager = importManager;
12991
- this.refEmitter = refEmitter;
12992
- this.reflector = reflector;
12993
- this.contextFile = contextFile;
12994
- }
12995
- canReferenceType(ref, flags = ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports) {
12996
- const result = this.refEmitter.emit(ref, this.contextFile, flags);
12997
- return result.kind === ReferenceEmitKind.Success;
12998
- }
12999
- /**
13000
- * Generate a `ts.TypeNode` that references the given node as a type.
13001
- *
13002
- * This may involve importing the node into the file if it's not declared there already.
13003
- */
13004
- referenceType(ref, flags = ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports) {
13005
- const ngExpr = this.refEmitter.emit(ref, this.contextFile, flags);
13006
- assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "symbol");
13007
- return translateType(new ExpressionType(ngExpr.expression), this.contextFile, this.reflector, this.refEmitter, this.importManager);
13008
- }
13009
- /**
13010
- * Generate a `ts.Expression` that refers to the external symbol. This
13011
- * may result in new imports being generated.
13012
- */
13013
- referenceExternalSymbol(moduleName, name) {
13014
- const external = new ExternalExpr7({ moduleName, name });
13015
- return translateExpression(this.contextFile, external, this.importManager);
13016
- }
13017
- /**
13018
- * Generate a `ts.TypeNode` that references a given type from the provided module.
13019
- *
13020
- * This will involve importing the type into the file, and will also add type parameters if
13021
- * provided.
13022
- */
13023
- referenceExternalType(moduleName, name, typeParams) {
13024
- const external = new ExternalExpr7({ moduleName, name });
13025
- return translateType(new ExpressionType(external, TypeModifier.None, typeParams), this.contextFile, this.reflector, this.refEmitter, this.importManager);
13026
- }
13027
- /**
13028
- * Generates a `ts.TypeNode` representing a type that is being referenced from a different place
13029
- * in the program. Any type references inside the transplanted type will be rewritten so that
13030
- * they can be imported in the context file.
13031
- */
13032
- referenceTransplantedType(type) {
13033
- return translateType(type, this.contextFile, this.reflector, this.refEmitter, this.importManager);
13034
- }
13035
- };
12786
+ // packages/compiler-cli/src/ngtsc/typecheck/src/tcb_adapter.js
12787
+ import { AbsoluteSourceSpan as AbsoluteSourceSpan4, ExternalExpr as ExternalExpr7, TransplantedType, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
13036
12788
 
13037
12789
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.js
13038
- import { ExpressionType as ExpressionType2, R3Identifiers as R3Identifiers3, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
12790
+ import { R3Identifiers as R3Identifiers3 } from "@angular/compiler";
13039
12791
  import ts56 from "typescript";
13040
12792
 
13041
12793
  // packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.js
@@ -13043,7 +12795,7 @@ import { R3Identifiers as R3Identifiers2 } from "@angular/compiler";
13043
12795
  import ts55 from "typescript";
13044
12796
 
13045
12797
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.js
13046
- import ts53 from "typescript";
12798
+ import ts52 from "typescript";
13047
12799
  var TypeParameterEmitter = class {
13048
12800
  typeParameters;
13049
12801
  reflector;
@@ -13090,11 +12842,11 @@ var TypeParameterEmitter = class {
13090
12842
  return this.typeParameters.map((typeParam) => {
13091
12843
  const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
13092
12844
  const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
13093
- return ts53.factory.updateTypeParameterDeclaration(typeParam, typeParam.modifiers, typeParam.name, constraint, defaultType);
12845
+ return ts52.factory.updateTypeParameterDeclaration(typeParam, typeParam.modifiers, typeParam.name, constraint, defaultType);
13094
12846
  });
13095
12847
  }
13096
12848
  resolveTypeReference(type) {
13097
- const target = ts53.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
12849
+ const target = ts52.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
13098
12850
  const declaration = this.reflector.getDeclarationOfIdentifier(target);
13099
12851
  if (declaration === null || declaration.node === null) {
13100
12852
  return null;
@@ -13120,8 +12872,8 @@ var TypeParameterEmitter = class {
13120
12872
  if (typeNode === null) {
13121
12873
  return null;
13122
12874
  }
13123
- if (!ts53.isTypeReferenceNode(typeNode)) {
13124
- throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts53.SyntaxKind[typeNode.kind]}.`);
12875
+ if (!ts52.isTypeReferenceNode(typeNode)) {
12876
+ throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts52.SyntaxKind[typeNode.kind]}.`);
13125
12877
  }
13126
12878
  return typeNode;
13127
12879
  }
@@ -13132,7 +12884,7 @@ var TypeParameterEmitter = class {
13132
12884
 
13133
12885
  // packages/compiler-cli/src/ngtsc/typecheck/src/host_bindings.js
13134
12886
  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";
12887
+ import ts53 from "typescript";
13136
12888
  var GUARD_COMMENT_TEXT = "hostBindingsBlockGuard";
13137
12889
  function createHostElement(type, selector, sourceNode, literal4, bindingDecorators, listenerDecorators) {
13138
12890
  const bindings = [];
@@ -13140,7 +12892,7 @@ function createHostElement(type, selector, sourceNode, literal4, bindingDecorato
13140
12892
  let parser = null;
13141
12893
  if (literal4 !== null) {
13142
12894
  for (const prop of literal4.properties) {
13143
- if (ts54.isPropertyAssignment(prop) && ts54.isStringLiteralLike(prop.initializer) && isStaticName(prop.name)) {
12895
+ if (ts53.isPropertyAssignment(prop) && ts53.isStringLiteralLike(prop.initializer) && isStaticName(prop.name)) {
13144
12896
  parser ??= makeBindingParser();
13145
12897
  createNodeFromHostLiteralProperty(prop, parser, bindings, listeners);
13146
12898
  }
@@ -13171,19 +12923,18 @@ function createHostElement(type, selector, sourceNode, literal4, bindingDecorato
13171
12923
  return new TmplAstHostElement(tagNames, bindings, listeners, createSourceSpan(sourceNode.name));
13172
12924
  }
13173
12925
  function createHostBindingsBlockGuard() {
13174
- const trueExpr = ts54.addSyntheticTrailingComment(ts54.factory.createTrue(), ts54.SyntaxKind.MultiLineCommentTrivia, GUARD_COMMENT_TEXT);
13175
- return ts54.factory.createParenthesizedExpression(trueExpr);
12926
+ return `(true /*${GUARD_COMMENT_TEXT}*/)`;
13176
12927
  }
13177
12928
  function isHostBindingsBlockGuard(node) {
13178
- if (!ts54.isIfStatement(node)) {
12929
+ if (!ts53.isIfStatement(node)) {
13179
12930
  return false;
13180
12931
  }
13181
12932
  const expr = node.expression;
13182
- if (!ts54.isParenthesizedExpression(expr) || expr.expression.kind !== ts54.SyntaxKind.TrueKeyword) {
12933
+ if (!ts53.isParenthesizedExpression(expr) || expr.expression.kind !== ts53.SyntaxKind.TrueKeyword) {
13183
12934
  return false;
13184
12935
  }
13185
12936
  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;
12937
+ return ts53.forEachTrailingCommentRange(text, expr.expression.getEnd(), (pos, end, kind) => kind === ts53.SyntaxKind.MultiLineCommentTrivia && text.substring(pos + 2, end - 2) === GUARD_COMMENT_TEXT) || false;
13187
12938
  }
13188
12939
  function createNodeFromHostLiteralProperty(property, parser, bindings, listeners) {
13189
12940
  const { name, initializer } = property;
@@ -13207,19 +12958,19 @@ function createNodeFromHostLiteralProperty(property, parser, bindings, listeners
13207
12958
  }
13208
12959
  }
13209
12960
  function createNodeFromBindingDecorator(decorator, bindings) {
13210
- if (!ts54.isCallExpression(decorator.expression)) {
12961
+ if (!ts53.isCallExpression(decorator.expression)) {
13211
12962
  return;
13212
12963
  }
13213
12964
  const args = decorator.expression.arguments;
13214
12965
  const property = decorator.parent;
13215
12966
  let nameNode = null;
13216
12967
  let propertyName = null;
13217
- if (property && ts54.isPropertyDeclaration(property) && isStaticName(property.name)) {
12968
+ if (property && ts53.isPropertyDeclaration(property) && isStaticName(property.name)) {
13218
12969
  propertyName = property.name;
13219
12970
  }
13220
12971
  if (args.length === 0) {
13221
12972
  nameNode = propertyName;
13222
- } else if (ts54.isStringLiteralLike(args[0])) {
12973
+ } else if (ts53.isStringLiteralLike(args[0])) {
13223
12974
  nameNode = args[0];
13224
12975
  } else {
13225
12976
  return;
@@ -13231,17 +12982,17 @@ function createNodeFromBindingDecorator(decorator, bindings) {
13231
12982
  const propertyStart = property.getStart();
13232
12983
  const receiver = new ThisReceiver2(span, new AbsoluteSourceSpan2(propertyStart, propertyStart));
13233
12984
  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));
12985
+ const read = ts53.isIdentifier(propertyName) ? new PropertyRead2(span, nameSpan, nameSpan, receiver, propertyName.text) : new KeyedRead(span, nameSpan, receiver, new LiteralPrimitive(span, nameSpan, propertyName.text));
13235
12986
  const { attrName, type } = inferBoundAttribute(nameNode.text);
13236
12987
  bindings.push(new TmplAstBoundAttribute(attrName, type, 0, read, null, createSourceSpan(decorator), createStaticExpressionSpan(nameNode), createSourceSpan(decorator), void 0));
13237
12988
  }
13238
12989
  function createNodeFromListenerDecorator(decorator, parser, listeners) {
13239
- if (!ts54.isCallExpression(decorator.expression) || decorator.expression.arguments.length === 0) {
12990
+ if (!ts53.isCallExpression(decorator.expression) || decorator.expression.arguments.length === 0) {
13240
12991
  return;
13241
12992
  }
13242
12993
  const args = decorator.expression.arguments;
13243
12994
  const method = decorator.parent;
13244
- if (!method || !ts54.isMethodDeclaration(method) || !isStaticName(method.name) || !ts54.isStringLiteralLike(args[0])) {
12995
+ if (!method || !ts53.isMethodDeclaration(method) || !isStaticName(method.name) || !ts53.isStringLiteralLike(args[0])) {
13245
12996
  return;
13246
12997
  }
13247
12998
  const span = new ParseSpan(-1, -1);
@@ -13249,10 +13000,10 @@ function createNodeFromListenerDecorator(decorator, parser, listeners) {
13249
13000
  const methodStart = method.getStart();
13250
13001
  const methodReceiver = new ThisReceiver2(span, new AbsoluteSourceSpan2(methodStart, methodStart));
13251
13002
  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])) {
13003
+ const receiver = ts53.isIdentifier(method.name) ? new PropertyRead2(span, nameSpan, nameSpan, methodReceiver, method.name.text) : new KeyedRead(span, nameSpan, methodReceiver, new LiteralPrimitive(span, nameSpan, method.name.text));
13004
+ if (args.length > 1 && ts53.isArrayLiteralExpression(args[1])) {
13254
13005
  for (const expr of args[1].elements) {
13255
- if (ts54.isStringLiteralLike(expr)) {
13006
+ if (ts53.isStringLiteralLike(expr)) {
13256
13007
  const span2 = createStaticExpressionSpan(expr);
13257
13008
  const ast = parser.parseBinding(expr.text, true, span2, span2.start.offset);
13258
13009
  fixupSpans(ast, expr);
@@ -13316,11 +13067,11 @@ function inferBoundAttribute(name) {
13316
13067
  return { attrName, type };
13317
13068
  }
13318
13069
  function isStaticName(node) {
13319
- return ts54.isIdentifier(node) || ts54.isStringLiteralLike(node);
13070
+ return ts53.isIdentifier(node) || ts53.isStringLiteralLike(node);
13320
13071
  }
13321
13072
  function createStaticExpressionSpan(node) {
13322
13073
  const span = createSourceSpan(node);
13323
- if (ts54.isStringLiteralLike(node)) {
13074
+ if (ts53.isStringLiteralLike(node)) {
13324
13075
  span.fullStart = span.fullStart.moveBy(1);
13325
13076
  span.start = span.start.moveBy(1);
13326
13077
  span.end = span.end.moveBy(-1);
@@ -13360,6 +13111,105 @@ var ReplaceSpanVisitor = class extends RecursiveAstVisitor {
13360
13111
  }
13361
13112
  };
13362
13113
 
13114
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/codegen.js
13115
+ import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
13116
+ import ts54 from "typescript";
13117
+ var TcbExpr = class {
13118
+ source;
13119
+ /** Text for the content containing the expression's location information. */
13120
+ spanComment = null;
13121
+ /** Text for the content containing the expression's identifier. */
13122
+ identifierComment = null;
13123
+ /**
13124
+ * Text of the comment instructing the type checker to
13125
+ * ignore diagnostics coming from this expression.
13126
+ */
13127
+ ignoreComment = null;
13128
+ constructor(source) {
13129
+ this.source = source;
13130
+ }
13131
+ /**
13132
+ * Converts the node's current state to a string.
13133
+ * @param ignoreComments Whether the comments associated with the expression should be skipped.
13134
+ */
13135
+ print(ignoreComments = false) {
13136
+ if (ignoreComments) {
13137
+ return this.source;
13138
+ }
13139
+ return this.source + this.formatComment(this.identifierComment) + this.formatComment(this.ignoreComment) + this.formatComment(this.spanComment);
13140
+ }
13141
+ /**
13142
+ * Adds a synthetic comment to the expression that represents the parse span of the provided node.
13143
+ * This comment can later be retrieved as trivia of a node to recover original source locations.
13144
+ * @param span Span from the parser containing the location information.
13145
+ */
13146
+ addParseSpanInfo(span) {
13147
+ let start;
13148
+ let end;
13149
+ if (span instanceof AbsoluteSourceSpan3) {
13150
+ start = span.start;
13151
+ end = span.end;
13152
+ } else {
13153
+ start = span.start.offset;
13154
+ end = span.end.offset;
13155
+ }
13156
+ this.spanComment = `${start},${end}`;
13157
+ return this;
13158
+ }
13159
+ /** Marks the expression to be ignored for diagnostics. */
13160
+ markIgnoreDiagnostics() {
13161
+ this.ignoreComment = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
13162
+ return this;
13163
+ }
13164
+ /**
13165
+ * Wraps the expression in parenthesis such that inserted
13166
+ * span comments become attached to the proper node.
13167
+ */
13168
+ wrapForTypeChecker() {
13169
+ this.source = `(${this.print()})`;
13170
+ this.spanComment = this.identifierComment = this.ignoreComment = null;
13171
+ return this;
13172
+ }
13173
+ /**
13174
+ * Tags the expression with an identifier.
13175
+ * @param identifier Identifier to apply to the expression.
13176
+ */
13177
+ addExpressionIdentifier(identifier) {
13178
+ this.identifierComment = `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`;
13179
+ return this;
13180
+ }
13181
+ /**
13182
+ * `toString` implementation meant to catch errors like accidentally
13183
+ * writing `foo ${expr} bar` instead of `foo ${expr.print()} bar`.
13184
+ */
13185
+ toString() {
13186
+ throw new Error("Assertion error: TcbExpr should not be converted to a string through concatenation. Use the `print` method instead.");
13187
+ }
13188
+ /** Format a comment string as a TypeScript comment. */
13189
+ formatComment(content) {
13190
+ return content === null || content.length === 0 ? "" : ` /*${content}*/`;
13191
+ }
13192
+ };
13193
+ function declareVariable(identifier, type) {
13194
+ type.addExpressionIdentifier(ExpressionIdentifier.VARIABLE_AS_EXPRESSION);
13195
+ return new TcbExpr(`var ${identifier.print()} = null! as ${type.print()}`);
13196
+ }
13197
+ function getStatementsBlock(expressions, singleLine = false) {
13198
+ let result = "";
13199
+ for (const expr of expressions) {
13200
+ result += `${expr.print()};${singleLine ? " " : "\n"}`;
13201
+ }
13202
+ return result;
13203
+ }
13204
+ function quoteAndEscape(value) {
13205
+ return JSON.stringify(value);
13206
+ }
13207
+ var tempPrinter = null;
13208
+ function tempPrint(node, sourceFile) {
13209
+ tempPrinter ??= ts54.createPrinter();
13210
+ return tempPrinter.printNode(ts54.EmitHint.Unspecified, node, sourceFile);
13211
+ }
13212
+
13363
13213
  // packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.js
13364
13214
  var TCB_FILE_IMPORT_GRAPH_PREPARE_IDENTIFIERS = [
13365
13215
  // Imports may be added for signal input checking. We wouldn't want to change the
@@ -13484,164 +13334,471 @@ function findNodeInFile(file, predicate) {
13484
13334
  };
13485
13335
  return ts55.forEachChild(file, visit2) ?? null;
13486
13336
  }
13337
+ function generateTcbTypeParameters(typeParameters, sourceFile) {
13338
+ return typeParameters.map((p) => {
13339
+ const representation = tempPrint(p, sourceFile);
13340
+ return {
13341
+ name: p.name.text,
13342
+ representation,
13343
+ representationWithDefault: p.default ? representation : `${representation} = any`
13344
+ };
13345
+ });
13346
+ }
13487
13347
 
13488
13348
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.js
13489
13349
  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);
13350
+ const typeArgs = generateGenericArgs(typeParams);
13351
+ const typeRef = ts56.isIdentifier(nodeTypeRef) ? nodeTypeRef.text : tempPrint(nodeTypeRef, nodeTypeRef.getSourceFile());
13352
+ const typeRefWithGenerics = `${typeRef}${typeArgs}`;
13353
+ const initParam = constructTypeCtorParameter(env, meta, typeRef, typeRefWithGenerics);
13493
13354
  const typeParameters = typeParametersWithDefaultTypes(typeParams);
13355
+ let source;
13494
13356
  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
- );
13357
+ const fnType = `${typeParameters}(${initParam}) => ${typeRefWithGenerics}`;
13358
+ source = `const ${meta.fnName}: ${fnType} = null!`;
13520
13359
  } 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
- );
13360
+ source = `declare function ${meta.fnName}${typeParameters}(${initParam}): ${typeRefWithGenerics}`;
13537
13361
  }
13362
+ return new TcbExpr(source);
13538
13363
  }
13539
13364
  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) {
13365
+ const typeRef = node.name.text;
13366
+ const sourceFile = node.getSourceFile();
13367
+ const tcbTypeParams = node.typeParameters && node.typeParameters.length > 0 ? generateTcbTypeParameters(node.typeParameters, sourceFile) : void 0;
13368
+ const typeRefWithGenerics = `${typeRef}${generateGenericArgs(tcbTypeParams)}`;
13369
+ const initParam = constructTypeCtorParameter(env, meta, typeRef, typeRefWithGenerics);
13370
+ const body = `{ return null!; }`;
13371
+ const typeParams = typeParametersWithDefaultTypes(tcbTypeParams);
13372
+ return `static ${meta.fnName}${typeParams}(${initParam}): ${typeRefWithGenerics} ${body}`;
13373
+ }
13374
+ function constructTypeCtorParameter(env, meta, typeRef, typeRefWithGenerics) {
13569
13375
  let initType = null;
13570
13376
  const plainKeys = [];
13571
13377
  const coercedKeys = [];
13572
13378
  const signalInputKeys = [];
13573
- for (const { classPropertyName, transform, isSignal } of meta.fields.inputs) {
13379
+ for (const { classPropertyName, transformType, isSignal } of meta.fields.inputs) {
13574
13380
  if (isSignal) {
13575
- signalInputKeys.push(ts56.factory.createLiteralTypeNode(ts56.factory.createStringLiteral(classPropertyName)));
13381
+ signalInputKeys.push(quoteAndEscape(classPropertyName));
13576
13382
  } else if (!meta.coercedInputFields.has(classPropertyName)) {
13577
- plainKeys.push(ts56.factory.createLiteralTypeNode(ts56.factory.createStringLiteral(classPropertyName)));
13383
+ plainKeys.push(quoteAndEscape(classPropertyName));
13578
13384
  } 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
- ));
13385
+ const coercionType = transformType !== void 0 ? transformType : `typeof ${typeRef}.ngAcceptInputType_${classPropertyName}`;
13386
+ coercedKeys.push(`${classPropertyName}: ${coercionType}`);
13590
13387
  }
13591
13388
  }
13592
13389
  if (plainKeys.length > 0) {
13593
- const keyTypeUnion = ts56.factory.createUnionTypeNode(plainKeys);
13594
- initType = ts56.factory.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
13390
+ initType = `Pick<${typeRefWithGenerics}, ${plainKeys.join(" | ")}>`;
13595
13391
  }
13596
13392
  if (coercedKeys.length > 0) {
13597
- const coercedLiteral = ts56.factory.createTypeLiteralNode(coercedKeys);
13598
- initType = initType !== null ? ts56.factory.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
13393
+ let coercedLiteral = "{\n";
13394
+ for (const key of coercedKeys) {
13395
+ coercedLiteral += `${key};
13396
+ `;
13397
+ }
13398
+ coercedLiteral += "}";
13399
+ initType = initType !== null ? `${initType} & ${coercedLiteral}` : coercedLiteral;
13599
13400
  }
13600
13401
  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;
13402
+ const keyTypeUnion = signalInputKeys.join(" | ");
13403
+ const unwrapRef = env.referenceExternalSymbol(R3Identifiers3.UnwrapDirectiveSignalInputs.moduleName, R3Identifiers3.UnwrapDirectiveSignalInputs.name);
13404
+ const unwrapExpr = `${unwrapRef.print()}<${typeRefWithGenerics}, ${keyTypeUnion}>`;
13405
+ initType = initType !== null ? `${initType} & ${unwrapExpr}` : unwrapExpr;
13608
13406
  }
13609
13407
  if (initType === null) {
13610
- initType = ts56.factory.createTypeLiteralNode([]);
13408
+ initType = "{}";
13611
13409
  }
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
- );
13410
+ return `init: ${initType}`;
13626
13411
  }
13627
- function generateGenericArgs(params) {
13628
- return params.map((param) => ts56.factory.createTypeReferenceNode(param.name, void 0));
13412
+ function generateGenericArgs(typeParameters) {
13413
+ if (typeParameters === void 0 || typeParameters.length === 0) {
13414
+ return "";
13415
+ }
13416
+ return `<${typeParameters.map((param) => param.name).join(", ")}>`;
13629
13417
  }
13630
13418
  function requiresInlineTypeCtor(node, host, env) {
13631
13419
  return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
13632
13420
  }
13633
13421
  function typeParametersWithDefaultTypes(params) {
13634
- if (params === void 0) {
13635
- return void 0;
13422
+ if (params === void 0 || params.length === 0) {
13423
+ return "";
13424
+ }
13425
+ return `<${params.map((param) => param.representationWithDefault).join(", ")}>`;
13426
+ }
13427
+
13428
+ // packages/compiler-cli/src/ngtsc/typecheck/src/tcb_adapter.js
13429
+ import ts57 from "typescript";
13430
+ function adaptTypeCheckBlockMetadata(ref, meta, env) {
13431
+ const refCache = /* @__PURE__ */ new Map();
13432
+ const extractRef = (ref2) => {
13433
+ if (refCache.has(ref2)) {
13434
+ return refCache.get(ref2);
13435
+ }
13436
+ const result = extractReferenceMetadata(ref2, env);
13437
+ refCache.set(ref2, result);
13438
+ return result;
13439
+ };
13440
+ const dirCache = /* @__PURE__ */ new Map();
13441
+ const convertDir = (dir) => {
13442
+ if (dirCache.has(dir))
13443
+ return dirCache.get(dir);
13444
+ const tcbDir = {
13445
+ isComponent: dir.isComponent,
13446
+ name: dir.name,
13447
+ selector: dir.selector,
13448
+ exportAs: dir.exportAs,
13449
+ inputs: ClassPropertyMapping.fromMappedObject(dir.inputs.toJointMappedObject((input) => {
13450
+ return {
13451
+ classPropertyName: input.classPropertyName,
13452
+ bindingPropertyName: input.bindingPropertyName,
13453
+ required: input.required,
13454
+ isSignal: input.isSignal,
13455
+ transformType: (() => {
13456
+ if (input.transform != null) {
13457
+ const node = env.referenceTransplantedType(new TransplantedType(input.transform.type));
13458
+ return tempPrint(node, env.contextFile);
13459
+ }
13460
+ return void 0;
13461
+ })()
13462
+ };
13463
+ })),
13464
+ outputs: dir.outputs,
13465
+ isStructural: dir.isStructural,
13466
+ isStandalone: dir.isStandalone,
13467
+ isExplicitlyDeferred: dir.isExplicitlyDeferred,
13468
+ preserveWhitespaces: dir.preserveWhitespaces,
13469
+ ngContentSelectors: dir.ngContentSelectors,
13470
+ animationTriggerNames: dir.animationTriggerNames,
13471
+ ngTemplateGuards: dir.ngTemplateGuards,
13472
+ hasNgTemplateContextGuard: dir.hasNgTemplateContextGuard,
13473
+ hasNgFieldDirective: ts57.isClassDeclaration(dir.ref.node) && dir.ref.node.members.some((member) => ts57.isPropertyDeclaration(member) && ts57.isComputedPropertyName(member.name) && ts57.isIdentifier(member.name.expression) && member.name.expression.text === "\u0275NgFieldDirective"),
13474
+ coercedInputFields: dir.coercedInputFields,
13475
+ restrictedInputFields: dir.restrictedInputFields,
13476
+ stringLiteralInputFields: dir.stringLiteralInputFields,
13477
+ undeclaredInputFields: dir.undeclaredInputFields,
13478
+ publicMethods: dir.publicMethods,
13479
+ ref: extractRef(dir.ref),
13480
+ isGeneric: dir.isGeneric,
13481
+ typeParameters: (() => {
13482
+ const node = dir.ref.node;
13483
+ if (!node.typeParameters) {
13484
+ return null;
13485
+ }
13486
+ const emitter = new TypeParameterEmitter(node.typeParameters, env.reflector);
13487
+ let emitted;
13488
+ if (!emitter.canEmit((ref2) => env.canReferenceType(ref2))) {
13489
+ emitted = [...node.typeParameters];
13490
+ } else {
13491
+ emitted = emitter.emit((ref2) => env.referenceType(ref2));
13492
+ }
13493
+ return generateTcbTypeParameters(emitted || [], env.contextFile);
13494
+ })(),
13495
+ hasRequiresInlineTypeCtor: requiresInlineTypeCtor(dir.ref.node, env.reflector, env)
13496
+ };
13497
+ dirCache.set(dir, tcbDir);
13498
+ return tcbDir;
13499
+ };
13500
+ const adaptedBoundTarget = {
13501
+ target: (() => {
13502
+ const originalTarget = meta.boundTarget.target;
13503
+ return {
13504
+ template: originalTarget.template,
13505
+ host: originalTarget.host ? {
13506
+ node: originalTarget.host.node,
13507
+ directives: originalTarget.host.directives.map(convertDir)
13508
+ } : void 0
13509
+ };
13510
+ })(),
13511
+ getUsedDirectives: () => meta.boundTarget.getUsedDirectives().map(convertDir),
13512
+ getEagerlyUsedDirectives: () => meta.boundTarget.getEagerlyUsedDirectives().map(convertDir),
13513
+ getUsedPipes: () => meta.boundTarget.getUsedPipes(),
13514
+ getDirectivesOfNode: (node) => {
13515
+ const dirs = meta.boundTarget.getDirectivesOfNode(node);
13516
+ return dirs ? dirs.map(convertDir) : null;
13517
+ },
13518
+ getReferenceTarget: (ref2) => {
13519
+ const target = meta.boundTarget.getReferenceTarget(ref2);
13520
+ if (target && "directive" in target) {
13521
+ return {
13522
+ directive: convertDir(target.directive),
13523
+ node: target.node
13524
+ };
13525
+ }
13526
+ return target;
13527
+ },
13528
+ getDeferredTriggerTarget: (b, t) => meta.boundTarget.getDeferredTriggerTarget(b, t),
13529
+ isDeferred: (node) => meta.boundTarget.isDeferred(node),
13530
+ referencedDirectiveExists: (name) => meta.boundTarget.referencedDirectiveExists(name),
13531
+ getConsumerOfBinding: (binding) => {
13532
+ const consumer = meta.boundTarget.getConsumerOfBinding(binding);
13533
+ if (consumer && consumer.isComponent !== void 0) {
13534
+ return convertDir(consumer);
13535
+ }
13536
+ return consumer;
13537
+ },
13538
+ getExpressionTarget: (expr) => meta.boundTarget.getExpressionTarget(expr),
13539
+ getDefinitionNodeOfSymbol: (sym) => meta.boundTarget.getDefinitionNodeOfSymbol(sym),
13540
+ getNestingLevel: (node) => meta.boundTarget.getNestingLevel(node),
13541
+ getEntitiesInScope: (node) => meta.boundTarget.getEntitiesInScope(node),
13542
+ getEagerlyUsedPipes: () => meta.boundTarget.getEagerlyUsedPipes(),
13543
+ getDeferBlocks: () => meta.boundTarget.getDeferBlocks()
13544
+ };
13545
+ const pipes = /* @__PURE__ */ new Map();
13546
+ if (meta.pipes !== null) {
13547
+ for (const pipeName of meta.boundTarget.getUsedPipes()) {
13548
+ if (!meta.pipes.has(pipeName) || pipes.has(pipeName)) {
13549
+ continue;
13550
+ }
13551
+ const pipe = meta.pipes.get(pipeName);
13552
+ pipes.set(pipeName, {
13553
+ name: pipe.name,
13554
+ ref: extractRef(pipe.ref),
13555
+ isExplicitlyDeferred: pipe.isExplicitlyDeferred
13556
+ });
13557
+ }
13558
+ }
13559
+ return {
13560
+ tcbMeta: {
13561
+ id: meta.id,
13562
+ boundTarget: adaptedBoundTarget,
13563
+ pipes,
13564
+ schemas: meta.schemas,
13565
+ isStandalone: meta.isStandalone,
13566
+ preserveWhitespaces: meta.preserveWhitespaces
13567
+ },
13568
+ component: (() => {
13569
+ return {
13570
+ ref: extractRef(ref),
13571
+ typeParameters: (() => {
13572
+ if (!ref.node.typeParameters)
13573
+ return null;
13574
+ const emitter = new TypeParameterEmitter(ref.node.typeParameters, env.reflector);
13575
+ let emitted;
13576
+ if (!emitter.canEmit((r) => env.canReferenceType(r))) {
13577
+ emitted = [...ref.node.typeParameters];
13578
+ } else {
13579
+ emitted = emitter.emit((r) => env.referenceType(r));
13580
+ }
13581
+ return generateTcbTypeParameters(emitted || [], env.contextFile);
13582
+ })()
13583
+ };
13584
+ })()
13585
+ };
13586
+ }
13587
+ function extractReferenceMetadata(ref, env) {
13588
+ let name = ref.debugName || ref.node.name.text;
13589
+ let moduleName = ref.ownedByModuleGuess;
13590
+ let unexportedDiagnostic = null;
13591
+ let isLocal = true;
13592
+ const emitted = env.refEmitter.emit(ref, env.contextFile, ImportFlags.NoAliasing);
13593
+ if (emitted.kind === ReferenceEmitKind.Success) {
13594
+ if (emitted.expression instanceof ExternalExpr7) {
13595
+ name = emitted.expression.value.name;
13596
+ moduleName = emitted.expression.value.moduleName;
13597
+ isLocal = false;
13598
+ } else if (emitted.expression instanceof WrappedNodeExpr7) {
13599
+ const node = emitted.expression.node;
13600
+ const extractedName = extractNameFromExpr(node);
13601
+ if (extractedName !== null) {
13602
+ name = extractedName;
13603
+ }
13604
+ }
13605
+ } else if (emitted.kind === ReferenceEmitKind.Failed) {
13606
+ unexportedDiagnostic = emitted.reason;
13607
+ isLocal = false;
13608
+ }
13609
+ const refMeta = {
13610
+ name,
13611
+ moduleName,
13612
+ isLocal,
13613
+ unexportedDiagnostic
13614
+ };
13615
+ const nodeName = ref.node?.name;
13616
+ if (nodeName) {
13617
+ refMeta.nodeNameSpan = new AbsoluteSourceSpan4(nodeName.getStart(), nodeName.getEnd());
13618
+ refMeta.nodeFilePath = nodeName.getSourceFile().fileName;
13619
+ }
13620
+ return refMeta;
13621
+ }
13622
+ function extractNameFromExpr(node) {
13623
+ if (ts57.isIdentifier(node)) {
13624
+ return node.text;
13625
+ } else if (ts57.isPropertyAccessExpression(node)) {
13626
+ const receiver = extractNameFromExpr(node.expression);
13627
+ return receiver !== null ? `${receiver}.${node.name.text}` : null;
13628
+ }
13629
+ return null;
13630
+ }
13631
+
13632
+ // packages/compiler-cli/src/ngtsc/typecheck/src/dom.js
13633
+ import { DomElementSchemaRegistry } from "@angular/compiler";
13634
+ import ts58 from "typescript";
13635
+ var REGISTRY = new DomElementSchemaRegistry();
13636
+ var REMOVE_XHTML_REGEX = /^:xhtml:/;
13637
+ var RegistryDomSchemaChecker = class {
13638
+ resolver;
13639
+ _diagnostics = [];
13640
+ get diagnostics() {
13641
+ return this._diagnostics;
13642
+ }
13643
+ constructor(resolver) {
13644
+ this.resolver = resolver;
13645
+ }
13646
+ checkElement(id, tagName, sourceSpanForDiagnostics, schemas, hostIsStandalone) {
13647
+ const name = tagName.replace(REMOVE_XHTML_REGEX, "");
13648
+ if (!REGISTRY.hasElement(name, schemas)) {
13649
+ const mapping = this.resolver.getTemplateSourceMapping(id);
13650
+ const schemas2 = `'${hostIsStandalone ? "@Component" : "@NgModule"}.schemas'`;
13651
+ let errorMsg = `'${name}' is not a known element:
13652
+ `;
13653
+ errorMsg += `1. If '${name}' is an Angular component, then verify that it is ${hostIsStandalone ? "included in the '@Component.imports' of this component" : "part of this module"}.
13654
+ `;
13655
+ if (name.indexOf("-") > -1) {
13656
+ errorMsg += `2. If '${name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.`;
13657
+ } else {
13658
+ errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
13659
+ }
13660
+ const diag = makeTemplateDiagnostic(id, mapping, sourceSpanForDiagnostics, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
13661
+ this._diagnostics.push(diag);
13662
+ }
13663
+ }
13664
+ checkTemplateElementProperty(id, tagName, name, span, schemas, hostIsStandalone) {
13665
+ if (!REGISTRY.hasProperty(tagName, name, schemas)) {
13666
+ const mapping = this.resolver.getTemplateSourceMapping(id);
13667
+ const decorator = hostIsStandalone ? "@Component" : "@NgModule";
13668
+ const schemas2 = `'${decorator}.schemas'`;
13669
+ let errorMsg = `Can't bind to '${name}' since it isn't a known property of '${tagName}'.`;
13670
+ if (tagName.startsWith("ng-")) {
13671
+ errorMsg += `
13672
+ 1. If '${name}' is an Angular directive, then add 'CommonModule' to the '${decorator}.imports' of this component.
13673
+ 2. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
13674
+ } else if (tagName.indexOf("-") > -1) {
13675
+ errorMsg += `
13676
+ 1. If '${tagName}' is an Angular component and it has '${name}' input, then verify that it is ${hostIsStandalone ? "included in the '@Component.imports' of this component" : "part of this module"}.
13677
+ 2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.
13678
+ 3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
13679
+ }
13680
+ const diag = makeTemplateDiagnostic(id, mapping, span, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
13681
+ this._diagnostics.push(diag);
13682
+ }
13683
+ }
13684
+ checkHostElementProperty(id, element, name, span, schemas) {
13685
+ for (const tagName of element.tagNames) {
13686
+ if (REGISTRY.hasProperty(tagName, name, schemas)) {
13687
+ continue;
13688
+ }
13689
+ const errorMessage = `Can't bind to '${name}' since it isn't a known property of '${tagName}'.`;
13690
+ const mapping = this.resolver.getHostBindingsMapping(id);
13691
+ const diag = makeTemplateDiagnostic(id, mapping, span, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMessage);
13692
+ this._diagnostics.push(diag);
13693
+ break;
13694
+ }
13695
+ }
13696
+ };
13697
+
13698
+ // packages/compiler-cli/src/ngtsc/typecheck/src/environment.js
13699
+ import ts60 from "typescript";
13700
+
13701
+ // packages/compiler-cli/src/ngtsc/typecheck/src/reference_emit_environment.js
13702
+ import { ExpressionType, ExternalExpr as ExternalExpr8, TypeModifier } from "@angular/compiler";
13703
+ import ts59 from "typescript";
13704
+ var ReferenceEmitEnvironment = class {
13705
+ importManager;
13706
+ refEmitter;
13707
+ reflector;
13708
+ contextFile;
13709
+ constructor(importManager, refEmitter, reflector, contextFile) {
13710
+ this.importManager = importManager;
13711
+ this.refEmitter = refEmitter;
13712
+ this.reflector = reflector;
13713
+ this.contextFile = contextFile;
13714
+ }
13715
+ canReferenceType(ref, flags = ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports) {
13716
+ const result = this.refEmitter.emit(ref, this.contextFile, flags);
13717
+ return result.kind === ReferenceEmitKind.Success;
13718
+ }
13719
+ /**
13720
+ * Generate a `ts.TypeNode` that references the given node as a type.
13721
+ *
13722
+ * This may involve importing the node into the file if it's not declared there already.
13723
+ */
13724
+ referenceType(ref, flags = ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports) {
13725
+ const ngExpr = this.refEmitter.emit(ref, this.contextFile, flags);
13726
+ assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "symbol");
13727
+ return translateType(new ExpressionType(ngExpr.expression), this.contextFile, this.reflector, this.refEmitter, this.importManager);
13728
+ }
13729
+ /**
13730
+ * Generates a `ts.TypeNode` from a `TcbReferenceMetadata` object.
13731
+ * This is used by the TCB operations which do not hold on to the original `ts.Declaration`.
13732
+ *
13733
+ * Note: It's important that we do not try to evaluate the `typeParameters` here and pad them
13734
+ * out with `any` type arguments. If we supply `any` to a generic pipe (e.g. `var _pipe1: MyPipe<any>;`),
13735
+ * it destroys the generic constraints and degrades the `transform` signature. When they are omitted
13736
+ * entirely, TypeScript implicitly flags an error, which the Angular compiler filters out, and
13737
+ * crucially recovers by falling back to constraint inference (e.g. `var _pipe1: MyPipe;` infers
13738
+ * bounds safely).
13739
+ */
13740
+ referenceTcbType(ref) {
13741
+ if (ref.unexportedDiagnostic !== null || ref.isLocal || ref.moduleName === null) {
13742
+ if (ref.unexportedDiagnostic !== null) {
13743
+ throw new FatalDiagnosticError(
13744
+ ErrorCode.IMPORT_GENERATION_FAILURE,
13745
+ this.contextFile,
13746
+ // Using context file as fallback origin for external file since we lack exact node
13747
+ makeDiagnosticChain(`Unable to import symbol ${ref.name}.`, [
13748
+ makeDiagnosticChain(ref.unexportedDiagnostic)
13749
+ ])
13750
+ );
13751
+ }
13752
+ return ts59.factory.createTypeReferenceNode(ref.name);
13753
+ }
13754
+ return this.referenceExternalType(ref.moduleName, ref.name);
13755
+ }
13756
+ /**
13757
+ * Generates a `TcbExpr` from a `TcbReferenceMetadata` object.
13758
+ */
13759
+ referenceTcbValue(ref) {
13760
+ if (ref.unexportedDiagnostic !== null || ref.isLocal || ref.moduleName === null) {
13761
+ if (ref.unexportedDiagnostic !== null) {
13762
+ throw new FatalDiagnosticError(ErrorCode.IMPORT_GENERATION_FAILURE, this.contextFile, makeDiagnosticChain(`Unable to import symbol ${ref.name}.`, [
13763
+ makeDiagnosticChain(ref.unexportedDiagnostic)
13764
+ ]));
13765
+ }
13766
+ return new TcbExpr(ref.name);
13767
+ }
13768
+ return this.referenceExternalSymbol(ref.moduleName, ref.name);
13769
+ }
13770
+ referenceExternalSymbol(moduleName, name) {
13771
+ const importResult = this.importManager.addImport({
13772
+ exportModuleSpecifier: moduleName,
13773
+ exportSymbolName: name,
13774
+ requestedFile: this.contextFile
13775
+ });
13776
+ if (ts59.isIdentifier(importResult)) {
13777
+ return new TcbExpr(importResult.text);
13778
+ } else if (ts59.isIdentifier(importResult.expression)) {
13779
+ return new TcbExpr(`${importResult.expression.text}.${importResult.name.text}`);
13780
+ }
13781
+ throw new Error("Unexpected value returned by import manager");
13782
+ }
13783
+ /**
13784
+ * Generate a `ts.TypeNode` that references a given type from the provided module.
13785
+ *
13786
+ * This will involve importing the type into the file, and will also add type parameters if
13787
+ * provided.
13788
+ */
13789
+ referenceExternalType(moduleName, name, typeParams) {
13790
+ const external = new ExternalExpr8({ moduleName, name });
13791
+ return translateType(new ExpressionType(external, TypeModifier.None, typeParams), this.contextFile, this.reflector, this.refEmitter, this.importManager);
13792
+ }
13793
+ /**
13794
+ * Generates a `ts.TypeNode` representing a type that is being referenced from a different place
13795
+ * in the program. Any type references inside the transplanted type will be rewritten so that
13796
+ * they can be imported in the context file.
13797
+ */
13798
+ referenceTransplantedType(type) {
13799
+ return translateType(type, this.contextFile, this.reflector, this.refEmitter, this.importManager);
13636
13800
  }
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
- }
13643
- });
13644
- }
13801
+ };
13645
13802
 
13646
13803
  // packages/compiler-cli/src/ngtsc/typecheck/src/environment.js
13647
13804
  var Environment = class extends ReferenceEmitEnvironment {
@@ -13665,52 +13822,49 @@ var Environment = class extends ReferenceEmitEnvironment {
13665
13822
  * type constructor, or to an inline type constructor.
13666
13823
  */
13667
13824
  typeCtorFor(dir) {
13668
- const dirRef = dir.ref;
13669
- const node = dirRef.node;
13670
- if (this.typeCtors.has(node)) {
13671
- return this.typeCtors.get(node);
13672
- }
13673
- if (requiresInlineTypeCtor(node, this.reflector, this)) {
13674
- const ref = this.reference(dirRef);
13675
- const typeCtorExpr = ts57.factory.createPropertyAccessExpression(ref, "ngTypeCtor");
13676
- this.typeCtors.set(node, typeCtorExpr);
13677
- return typeCtorExpr;
13825
+ const key = getTcbReferenceKey(dir.ref);
13826
+ if (this.typeCtors.has(key)) {
13827
+ return new TcbExpr(this.typeCtors.get(key));
13828
+ }
13829
+ if (dir.hasRequiresInlineTypeCtor) {
13830
+ const typeCtorExpr = `${this.referenceTcbValue(dir.ref).print()}.ngTypeCtor`;
13831
+ this.typeCtors.set(key, typeCtorExpr);
13832
+ return new TcbExpr(typeCtorExpr);
13678
13833
  } else {
13679
13834
  const fnName = `_ctor${this.nextIds.typeCtor++}`;
13680
- const nodeTypeRef = this.referenceType(dirRef);
13681
- if (!ts57.isTypeReferenceNode(nodeTypeRef)) {
13682
- throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
13835
+ const nodeTypeRef = this.referenceTcbType(dir.ref);
13836
+ if (!ts60.isTypeReferenceNode(nodeTypeRef)) {
13837
+ throw new Error(`Expected TypeReferenceNode from reference to ${dir.ref.name}`);
13683
13838
  }
13684
13839
  const meta = {
13685
13840
  fnName,
13686
13841
  body: true,
13687
13842
  fields: {
13688
- inputs: dir.inputs,
13843
+ inputs: dir.inputs
13689
13844
  // TODO: support queries
13690
- queries: dir.queries
13691
13845
  },
13692
13846
  coercedInputFields: dir.coercedInputFields
13693
13847
  };
13694
- const typeParams = this.emitTypeParameters(node);
13848
+ const typeParams = dir.typeParameters || void 0;
13695
13849
  const typeCtor = generateTypeCtorDeclarationFn(this, meta, nodeTypeRef.typeName, typeParams);
13696
13850
  this.typeCtorStatements.push(typeCtor);
13697
- const fnId = ts57.factory.createIdentifier(fnName);
13698
- this.typeCtors.set(node, fnId);
13699
- return fnId;
13851
+ this.typeCtors.set(key, fnName);
13852
+ return new TcbExpr(fnName);
13700
13853
  }
13701
13854
  }
13702
13855
  /*
13703
13856
  * Get an expression referring to an instance of the given pipe.
13704
13857
  */
13705
- pipeInst(ref) {
13706
- if (this.pipeInsts.has(ref.node)) {
13707
- return this.pipeInsts.get(ref.node);
13858
+ pipeInst(pipe) {
13859
+ const key = getTcbReferenceKey(pipe.ref);
13860
+ if (this.pipeInsts.has(key)) {
13861
+ return new TcbExpr(this.pipeInsts.get(key));
13708
13862
  }
13709
- const pipeType = this.referenceType(ref);
13710
- const pipeInstId = ts57.factory.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
13711
- this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
13712
- this.pipeInsts.set(ref.node, pipeInstId);
13713
- return pipeInstId;
13863
+ const pipeType = this.referenceTcbType(pipe.ref);
13864
+ const pipeInstId = `_pipe${this.nextIds.pipeInst++}`;
13865
+ this.pipeInsts.set(key, pipeInstId);
13866
+ this.pipeInstStatements.push(declareVariable(new TcbExpr(pipeInstId), new TcbExpr(tempPrint(pipeType, this.contextFile))));
13867
+ return new TcbExpr(pipeInstId);
13714
13868
  }
13715
13869
  /**
13716
13870
  * Generate a `ts.Expression` that references the given node.
@@ -13720,7 +13874,8 @@ var Environment = class extends ReferenceEmitEnvironment {
13720
13874
  reference(ref) {
13721
13875
  const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing);
13722
13876
  assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "class");
13723
- return translateExpression(this.contextFile, ngExpr.expression, this.importManager);
13877
+ const tsExpression = translateExpression(this.contextFile, ngExpr.expression, this.importManager);
13878
+ return new TcbExpr(tempPrint(tsExpression, this.contextFile));
13724
13879
  }
13725
13880
  emitTypeParameters(declaration) {
13726
13881
  const emitter = new TypeParameterEmitter(declaration.typeParameters, this.reflector);
@@ -13730,12 +13885,19 @@ var Environment = class extends ReferenceEmitEnvironment {
13730
13885
  return [...this.pipeInstStatements, ...this.typeCtorStatements];
13731
13886
  }
13732
13887
  };
13888
+ function getTcbReferenceKey(ref) {
13889
+ if (ref.nodeFilePath !== void 0 && ref.nodeNameSpan !== void 0) {
13890
+ return `${ref.nodeFilePath}#${ref.nodeNameSpan.start}`;
13891
+ }
13892
+ return ref.moduleName ? `${ref.moduleName}#${ref.name}` : ref.name;
13893
+ }
13733
13894
 
13734
13895
  // 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";
13896
+ import { AbsoluteSourceSpan as AbsoluteSourceSpan5, BindingType as BindingType2, ParseSourceSpan as ParseSourceSpan2, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent as TmplAstBoundEvent2, TmplAstComponent, TmplAstDirective, TmplAstElement } from "@angular/compiler";
13897
+ import ts61 from "typescript";
13737
13898
  var OutOfBandDiagnosticRecorderImpl = class {
13738
13899
  resolver;
13900
+ getSourceFile;
13739
13901
  _diagnostics = [];
13740
13902
  /**
13741
13903
  * Tracks which `BindingPipe` nodes have already been recorded as invalid, so only one diagnostic
@@ -13758,8 +13920,9 @@ var OutOfBandDiagnosticRecorderImpl = class {
13758
13920
  ["i18nSelect", "I18nSelectPipe"],
13759
13921
  ["keyvalue", "KeyValuePipe"]
13760
13922
  ]);
13761
- constructor(resolver) {
13923
+ constructor(resolver, getSourceFile2 = (name) => void 0) {
13762
13924
  this.resolver = resolver;
13925
+ this.getSourceFile = getSourceFile2;
13763
13926
  }
13764
13927
  get diagnostics() {
13765
13928
  return this._diagnostics;
@@ -13768,7 +13931,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
13768
13931
  const mapping = this.resolver.getTemplateSourceMapping(id);
13769
13932
  const value = ref.value.trim();
13770
13933
  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));
13934
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, ref.valueSpan || ref.sourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
13772
13935
  }
13773
13936
  missingPipe(id, ast, isStandalone) {
13774
13937
  if (this.recordedPipes.has(ast)) {
@@ -13791,7 +13954,7 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
13791
13954
  To fix this, import the "${suggestedClassName}" class from "${suggestedImport}" and add it to the "imports" array of the module declaring the component.`;
13792
13955
  }
13793
13956
  }
13794
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
13957
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
13795
13958
  this.recordedPipes.add(ast);
13796
13959
  }
13797
13960
  deferredPipeUsedEagerly(id, ast) {
@@ -13804,24 +13967,24 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
13804
13967
  if (sourceSpan === null) {
13805
13968
  throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
13806
13969
  }
13807
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_PIPE_USED_EAGERLY), errorMsg));
13970
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_PIPE_USED_EAGERLY), errorMsg));
13808
13971
  this.recordedPipes.add(ast);
13809
13972
  }
13810
13973
  deferredComponentUsedEagerly(id, element) {
13811
13974
  const mapping = this.resolver.getTemplateSourceMapping(id);
13812
13975
  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
13976
  const { start, end } = element.startSourceSpan;
13814
- const absoluteSourceSpan = new AbsoluteSourceSpan3(start.offset, end.offset);
13977
+ const absoluteSourceSpan = new AbsoluteSourceSpan5(start.offset, end.offset);
13815
13978
  const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, absoluteSourceSpan);
13816
13979
  if (sourceSpan === null) {
13817
13980
  throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${element.name}'.`);
13818
13981
  }
13819
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
13982
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
13820
13983
  }
13821
13984
  duplicateTemplateVar(id, variable, firstDecl) {
13822
13985
  const mapping = this.resolver.getTemplateSourceMapping(id);
13823
13986
  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, [
13987
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, variable.sourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [
13825
13988
  {
13826
13989
  text: `The variable '${firstDecl.name}' was first declared here.`,
13827
13990
  start: firstDecl.sourceSpan.start.offset,
@@ -13862,19 +14025,24 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
13862
14025
  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
14026
 
13864
14027
  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));
14028
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, diagnosticVar.keySpan, ts61.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
13866
14029
  }
13867
14030
  splitTwoWayBinding(id, input, output, inputConsumer, outputConsumer) {
13868
14031
  const mapping = this.resolver.getTemplateSourceMapping(id);
13869
14032
  const errorMsg = `The property and event halves of the two-way binding '${input.name}' are not bound to the same target.
13870
14033
  Find more at ${DOC_PAGE_BASE_URL}/guide/templates/two-way-binding`;
13871
14034
  const relatedMessages = [];
13872
- relatedMessages.push({
13873
- text: `The property half of the binding is to the '${inputConsumer.name.text}' component.`,
13874
- start: inputConsumer.name.getStart(),
13875
- end: inputConsumer.name.getEnd(),
13876
- sourceFile: inputConsumer.name.getSourceFile()
13877
- });
14035
+ if (inputConsumer.ref.nodeNameSpan && inputConsumer.ref.nodeFilePath) {
14036
+ const sf = this.getSourceFile(inputConsumer.ref.nodeFilePath);
14037
+ if (sf) {
14038
+ relatedMessages.push({
14039
+ text: `The property half of the binding is to the '${inputConsumer.name}' ${inputConsumer.isComponent ? "component" : "directive"}.`,
14040
+ start: inputConsumer.ref.nodeNameSpan.start,
14041
+ end: inputConsumer.ref.nodeNameSpan.end,
14042
+ sourceFile: sf
14043
+ });
14044
+ }
14045
+ }
13878
14046
  if (outputConsumer instanceof TmplAstElement) {
13879
14047
  let message = `The event half of the binding is to a native event called '${input.name}' on the <${outputConsumer.name}> DOM element.`;
13880
14048
  if (!mapping.node.getSourceFile().isDeclarationFile) {
@@ -13889,14 +14057,19 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13889
14057
  sourceFile: mapping.node.getSourceFile()
13890
14058
  });
13891
14059
  } else {
13892
- relatedMessages.push({
13893
- text: `The event half of the binding is to the '${outputConsumer.name.text}' component.`,
13894
- start: outputConsumer.name.getStart(),
13895
- end: outputConsumer.name.getEnd(),
13896
- sourceFile: outputConsumer.name.getSourceFile()
13897
- });
14060
+ if (outputConsumer.ref.nodeNameSpan && outputConsumer.ref.nodeFilePath) {
14061
+ const sf = this.getSourceFile(outputConsumer.ref.nodeFilePath);
14062
+ if (sf) {
14063
+ relatedMessages.push({
14064
+ text: `The event half of the binding is to the '${outputConsumer.name}' ${outputConsumer.isComponent ? "component" : "directive"}.`,
14065
+ start: outputConsumer.ref.nodeNameSpan.start,
14066
+ end: outputConsumer.ref.nodeNameSpan.end,
14067
+ sourceFile: sf
14068
+ });
14069
+ }
14070
+ }
13898
14071
  }
13899
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, input.keySpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
14072
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, input.keySpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
13900
14073
  }
13901
14074
  missingRequiredInputs(id, element, directiveName, isComponent, inputAliases) {
13902
14075
  const message = `Required input${inputAliases.length === 1 ? "" : "s"} ${inputAliases.map((n2) => `'${n2}'`).join(", ")} from ${isComponent ? "component" : "directive"} ${directiveName} must be specified.`;
@@ -13916,7 +14089,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13916
14089
  const end = element.startSourceSpan.end.moveBy(start.offset + name.length - element.startSourceSpan.end.offset);
13917
14090
  span = new ParseSourceSpan2(start, end);
13918
14091
  }
13919
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), span, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
14092
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), span, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
13920
14093
  }
13921
14094
  illegalForLoopTrackAccess(id, block, access) {
13922
14095
  const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, access.sourceSpan);
@@ -13925,7 +14098,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13925
14098
  }
13926
14099
  const messageVars = [block.item, ...block.contextVariables.filter((v) => v.value === "$index")].map((v) => `'${v.name}'`).join(", ");
13927
14100
  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));
14101
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_FOR_LOOP_TRACK_ACCESS), message));
13929
14102
  }
13930
14103
  inaccessibleDeferredTriggerElement(id, trigger) {
13931
14104
  let message;
@@ -13936,7 +14109,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13936
14109
  Check that an element with #${trigger.reference} exists in the same template and it's accessible from the @defer block.
13937
14110
  Deferred blocks can only access triggers in same view, a parent embedded view or the root view of the @placeholder block.`;
13938
14111
  }
13939
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
14112
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
13940
14113
  }
13941
14114
  controlFlowPreventingContentProjection(id, category, projectionNode, componentName, slotSelector, controlFlowNode, preservesWhitespaces) {
13942
14115
  const blockName = controlFlowNode.nameSpan.toString().trim();
@@ -13958,43 +14131,43 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
13958
14131
  if (sourceSpan === null) {
13959
14132
  throw new Error(`Assertion failure: no SourceLocation found for property write.`);
13960
14133
  }
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}'.`));
14134
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_LET_WRITE), `Cannot assign to @let declaration '${target.name}'.`));
13962
14135
  }
13963
14136
  letUsedBeforeDefinition(id, node, target) {
13964
14137
  const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, node.sourceSpan);
13965
14138
  if (sourceSpan === null) {
13966
14139
  throw new Error(`Assertion failure: no SourceLocation found for property read.`);
13967
14140
  }
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.`));
14141
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.LET_USED_BEFORE_DEFINITION), `Cannot read @let declaration '${target.name}' before it has been defined.`));
13969
14142
  }
13970
14143
  conflictingDeclaration(id, decl) {
13971
14144
  const mapping = this.resolver.getTemplateSourceMapping(id);
13972
14145
  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));
14146
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, decl.sourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.CONFLICTING_LET_DECLARATION), errorMsg));
13974
14147
  }
13975
14148
  missingNamedTemplateDependency(id, node) {
13976
14149
  this._diagnostics.push(makeTemplateDiagnostic(
13977
14150
  id,
13978
14151
  this.resolver.getTemplateSourceMapping(id),
13979
14152
  node.startSourceSpan,
13980
- ts58.DiagnosticCategory.Error,
14153
+ ts61.DiagnosticCategory.Error,
13981
14154
  ngErrorCode(ErrorCode.MISSING_NAMED_TEMPLATE_DEPENDENCY),
13982
14155
  // Wording is meant to mimic the wording TS uses in their diagnostic for missing symbols.
13983
14156
  `Cannot find name "${node instanceof TmplAstDirective ? node.name : node.componentName}". Selectorless references are only supported to classes or non-type import statements.`
13984
14157
  ));
13985
14158
  }
13986
14159
  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"}.`));
14160
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.startSourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INCORRECT_NAMED_TEMPLATE_DEPENDENCY_TYPE), `Incorrect reference type. Type must be a standalone ${node instanceof TmplAstComponent ? "@Component" : "@Directive"}.`));
13988
14161
  }
13989
14162
  unclaimedDirectiveBinding(id, directive, node) {
13990
14163
  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));
14164
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.keySpan || node.sourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.UNCLAIMED_DIRECTIVE_BINDING), errorMsg));
13992
14165
  }
13993
14166
  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"));
14167
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts61.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
14168
  }
13996
14169
  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"));
14170
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts61.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
14171
  }
13999
14172
  formFieldUnsupportedBinding(id, node) {
14000
14173
  let message;
@@ -14011,7 +14184,7 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
14011
14184
  } else {
14012
14185
  message = `Setting the '${node.name}' attribute is not allowed on nodes using the '[formField]' directive`;
14013
14186
  }
14014
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.FORM_FIELD_UNSUPPORTED_BINDING), message));
14187
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.sourceSpan, ts61.DiagnosticCategory.Error, ngErrorCode(ErrorCode.FORM_FIELD_UNSUPPORTED_BINDING), message));
14015
14188
  }
14016
14189
  };
14017
14190
  function makeInlineDiagnostic(id, code, node, messageText, relatedInformation) {
@@ -14023,7 +14196,7 @@ function makeInlineDiagnostic(id, code, node, messageText, relatedInformation) {
14023
14196
  }
14024
14197
 
14025
14198
  // packages/compiler-cli/src/ngtsc/typecheck/src/shim.js
14026
- import ts59 from "typescript";
14199
+ import ts62 from "typescript";
14027
14200
  var TypeCheckShimGenerator = class {
14028
14201
  extensionPrefix = "ngtypecheck";
14029
14202
  shouldEmit = false;
@@ -14031,7 +14204,7 @@ var TypeCheckShimGenerator = class {
14031
14204
  if (priorShimSf !== null) {
14032
14205
  return priorShimSf;
14033
14206
  }
14034
- return ts59.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts59.ScriptTarget.Latest, true, ts59.ScriptKind.TS);
14207
+ return ts62.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts62.ScriptTarget.Latest, true, ts62.ScriptKind.TS);
14035
14208
  }
14036
14209
  static shimFor(fileName) {
14037
14210
  return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
@@ -14039,71 +14212,9 @@ var TypeCheckShimGenerator = class {
14039
14212
  };
14040
14213
 
14041
14214
  // 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
- }
14215
+ import ts66 from "typescript";
14104
14216
 
14105
14217
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/context.js
14106
- import ts61 from "typescript";
14107
14218
  var TcbGenericContextBehavior;
14108
14219
  (function(TcbGenericContextBehavior2) {
14109
14220
  TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
@@ -14139,7 +14250,7 @@ var Context2 = class {
14139
14250
  * might change depending on the type of data being stored.
14140
14251
  */
14141
14252
  allocateId() {
14142
- return ts61.factory.createIdentifier(`_t${this.nextId++}`);
14253
+ return `_t${this.nextId++}`;
14143
14254
  }
14144
14255
  getPipeByName(name) {
14145
14256
  if (this.pipes === null || !this.pipes.has(name)) {
@@ -14151,10 +14262,8 @@ var Context2 = class {
14151
14262
 
14152
14263
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/scope.js
14153
14264
  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
14265
 
14156
14266
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/base.js
14157
- import ts62 from "typescript";
14158
14267
  var TcbOp = class {
14159
14268
  /**
14160
14269
  * Replacement value or operation used while this `TcbOp` is executing (i.e. to resolve circular
@@ -14165,70 +14274,25 @@ var TcbOp = class {
14165
14274
  * circular references.
14166
14275
  */
14167
14276
  circularFallback() {
14168
- return ts62.factory.createNonNullExpression(ts62.factory.createNull());
14277
+ return new TcbExpr("null!");
14169
14278
  }
14170
14279
  };
14171
14280
 
14172
14281
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/template.js
14173
14282
  import { TmplAstBoundAttribute as TmplAstBoundAttribute3, TmplAstTemplate } from "@angular/compiler";
14174
- import ts65 from "typescript";
14175
14283
 
14176
14284
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/expression.js
14177
14285
  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
14286
 
14180
14287
  // packages/compiler-cli/src/ngtsc/typecheck/src/expression.js
14181
14288
  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);
14289
+ function astToTcbExpr(ast, maybeResolve, config) {
14290
+ const translator = new TcbExprTranslator(maybeResolve, config);
14188
14291
  return translator.translate(ast);
14189
14292
  }
14190
- var AstTranslator = class {
14293
+ var TcbExprTranslator = class {
14191
14294
  maybeResolve;
14192
14295
  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
14296
  constructor(maybeResolve, config) {
14233
14297
  this.maybeResolve = maybeResolve;
14234
14298
  this.config = config;
@@ -14245,37 +14309,31 @@ var AstTranslator = class {
14245
14309
  }
14246
14310
  visitUnary(ast) {
14247
14311
  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;
14312
+ const node = new TcbExpr(`${ast.operator}${expr.print()}`);
14313
+ return node.wrapForTypeChecker().addParseSpanInfo(ast.sourceSpan);
14255
14314
  }
14256
14315
  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);
14316
+ const lhs = this.translate(ast.left);
14317
+ const rhs = this.translate(ast.right);
14318
+ lhs.wrapForTypeChecker();
14319
+ rhs.wrapForTypeChecker();
14320
+ const expression = `${lhs.print()} ${ast.operation} ${rhs.print()}`;
14321
+ const node = new TcbExpr(ast.operation === "??" || ast.operation === "**" ? `(${expression})` : expression);
14322
+ node.addParseSpanInfo(ast.sourceSpan);
14265
14323
  return node;
14266
14324
  }
14267
14325
  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);
14326
+ const elements = ast.expressions.map((expr) => this.translate(expr).print());
14327
+ const node = new TcbExpr(elements.join(", "));
14328
+ node.wrapForTypeChecker();
14329
+ node.addParseSpanInfo(ast.sourceSpan);
14271
14330
  return node;
14272
14331
  }
14273
14332
  visitConditional(ast) {
14274
14333
  const condExpr = this.translate(ast.condition);
14275
14334
  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);
14335
+ const falseExpr = this.translate(ast.falseExp).wrapForTypeChecker();
14336
+ const node = new TcbExpr(`(${condExpr.print()} ? ${trueExpr.print()} : ${falseExpr.print()})`).addParseSpanInfo(ast.sourceSpan);
14279
14337
  return node;
14280
14338
  }
14281
14339
  visitImplicitReceiver(ast) {
@@ -14285,141 +14343,136 @@ var AstTranslator = class {
14285
14343
  throw new Error("Method not implemented.");
14286
14344
  }
14287
14345
  visitRegularExpressionLiteral(ast, context) {
14288
- return wrapForTypeChecker(ts63.factory.createRegularExpressionLiteral(`/${ast.body}/${ast.flags ?? ""}`));
14346
+ const node = new TcbExpr(`/${ast.body}/${ast.flags ?? ""}`);
14347
+ node.wrapForTypeChecker();
14348
+ return node;
14289
14349
  }
14290
14350
  visitInterpolation(ast) {
14291
- return ast.expressions.reduce((lhs, ast2) => ts63.factory.createBinaryExpression(lhs, ts63.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts63.factory.createStringLiteral(""));
14351
+ const exprs = ast.expressions.map((e) => {
14352
+ const node = this.translate(e);
14353
+ node.wrapForTypeChecker();
14354
+ return node.print();
14355
+ });
14356
+ return new TcbExpr(`"" + ${exprs.join(" + ")}`);
14292
14357
  }
14293
14358
  visitKeyedRead(ast) {
14294
- const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14359
+ const receiver = this.translate(ast.receiver).wrapForTypeChecker();
14295
14360
  const key = this.translate(ast.key);
14296
- const node = ts63.factory.createElementAccessExpression(receiver, key);
14297
- addParseSpanInfo(node, ast.sourceSpan);
14298
- return node;
14361
+ return new TcbExpr(`${receiver.print()}[${key.print()}]`).addParseSpanInfo(ast.sourceSpan);
14299
14362
  }
14300
14363
  visitLiteralArray(ast) {
14301
14364
  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;
14365
+ let literal4 = `[${elements.map((el) => el.print()).join(", ")}]`;
14366
+ if (!this.config.strictLiteralTypes) {
14367
+ literal4 = `(${literal4} as any)`;
14368
+ }
14369
+ return new TcbExpr(literal4).addParseSpanInfo(ast.sourceSpan);
14306
14370
  }
14307
14371
  visitLiteralMap(ast) {
14308
14372
  const properties = ast.keys.map((key, idx) => {
14309
14373
  const value = this.translate(ast.values[idx]);
14310
14374
  if (key.kind === "property") {
14311
- const keyNode = ts63.factory.createStringLiteral(key.key);
14312
- addParseSpanInfo(keyNode, key.sourceSpan);
14313
- return ts63.factory.createPropertyAssignment(keyNode, value);
14375
+ const keyNode = new TcbExpr(quoteAndEscape(key.key));
14376
+ keyNode.addParseSpanInfo(key.sourceSpan);
14377
+ return `${keyNode.print()}: ${value.print()}`;
14314
14378
  } else {
14315
- return ts63.factory.createSpreadAssignment(value);
14379
+ return `...${value.print()}`;
14316
14380
  }
14317
14381
  });
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;
14382
+ let literal4 = `{ ${properties.join(", ")} }`;
14383
+ if (!this.config.strictLiteralTypes) {
14384
+ literal4 = `${literal4} as any`;
14385
+ }
14386
+ const expression = new TcbExpr(literal4).addParseSpanInfo(ast.sourceSpan);
14387
+ expression.wrapForTypeChecker();
14388
+ return expression;
14322
14389
  }
14323
14390
  visitLiteralPrimitive(ast) {
14324
14391
  let node;
14325
14392
  if (ast.value === void 0) {
14326
- node = ts63.factory.createIdentifier("undefined");
14393
+ node = new TcbExpr("undefined");
14327
14394
  } else if (ast.value === null) {
14328
- node = ts63.factory.createNull();
14395
+ node = new TcbExpr("null");
14329
14396
  } else if (typeof ast.value === "string") {
14330
- node = ts63.factory.createStringLiteral(ast.value);
14397
+ node = new TcbExpr(quoteAndEscape(ast.value));
14331
14398
  } else if (typeof ast.value === "number") {
14332
- node = tsNumericExpression2(ast.value);
14399
+ if (Number.isNaN(ast.value)) {
14400
+ node = new TcbExpr("NaN");
14401
+ } else if (!Number.isFinite(ast.value)) {
14402
+ node = new TcbExpr(ast.value > 0 ? "Infinity" : "-Infinity");
14403
+ } else {
14404
+ node = new TcbExpr(ast.value.toString());
14405
+ }
14333
14406
  } else if (typeof ast.value === "boolean") {
14334
- node = ast.value ? ts63.factory.createTrue() : ts63.factory.createFalse();
14407
+ node = new TcbExpr(ast.value + "");
14335
14408
  } else {
14336
14409
  throw Error(`Unsupported AST value of type ${typeof ast.value}`);
14337
14410
  }
14338
- addParseSpanInfo(node, ast.sourceSpan);
14411
+ node.addParseSpanInfo(ast.sourceSpan);
14339
14412
  return node;
14340
14413
  }
14341
14414
  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;
14415
+ const expr = this.translate(ast.expression).wrapForTypeChecker();
14416
+ return new TcbExpr(`${expr.print()}!`).addParseSpanInfo(ast.sourceSpan);
14346
14417
  }
14347
14418
  visitPipe(ast) {
14348
14419
  throw new Error("Method not implemented.");
14349
14420
  }
14350
14421
  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;
14422
+ const expression = this.translate(ast.expression).wrapForTypeChecker();
14423
+ return new TcbExpr(`!${expression.print()}`).addParseSpanInfo(ast.sourceSpan);
14355
14424
  }
14356
14425
  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;
14426
+ const expression = this.translate(ast.expression).wrapForTypeChecker();
14427
+ return new TcbExpr(`typeof ${expression.print()}`).addParseSpanInfo(ast.sourceSpan);
14361
14428
  }
14362
14429
  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;
14430
+ const expression = this.translate(ast.expression).wrapForTypeChecker();
14431
+ return new TcbExpr(`void ${expression.print()}`).addParseSpanInfo(ast.sourceSpan);
14367
14432
  }
14368
14433
  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;
14434
+ const receiver = this.translate(ast.receiver).wrapForTypeChecker();
14435
+ return new TcbExpr(`${receiver.print()}.${ast.name}`).addParseSpanInfo(ast.nameSpan).wrapForTypeChecker().addParseSpanInfo(ast.sourceSpan);
14375
14436
  }
14376
14437
  visitSafePropertyRead(ast) {
14377
14438
  let node;
14378
- const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14439
+ const receiver = this.translate(ast.receiver).wrapForTypeChecker();
14440
+ const name = new TcbExpr(ast.name).addParseSpanInfo(ast.nameSpan);
14379
14441
  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));
14442
+ node = new TcbExpr(`(0 as any ? ${receiver.print()}!.${name.print()} : undefined)`);
14383
14443
  } else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
14384
- node = ts63.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
14444
+ node = new TcbExpr(`(${receiver.print()} as any).${name.print()}`);
14385
14445
  } else {
14386
- const expr = ts63.factory.createPropertyAccessExpression(ts63.factory.createNonNullExpression(receiver), ast.name);
14387
- addParseSpanInfo(expr, ast.nameSpan);
14388
- node = tsCastToAny(expr);
14446
+ node = new TcbExpr(`(${receiver.print()}!.${name.print()} as any)`);
14389
14447
  }
14390
- addParseSpanInfo(node, ast.sourceSpan);
14391
- return node;
14448
+ return node.addParseSpanInfo(ast.sourceSpan);
14392
14449
  }
14393
14450
  visitSafeKeyedRead(ast) {
14394
- const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14451
+ const receiver = this.translate(ast.receiver).wrapForTypeChecker();
14395
14452
  const key = this.translate(ast.key);
14396
14453
  let node;
14397
14454
  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));
14455
+ const elementAccess = new TcbExpr(`${receiver.print()}![${key.print()}]`).addParseSpanInfo(ast.sourceSpan);
14456
+ node = new TcbExpr(`(0 as any ? ${elementAccess.print()} : undefined)`);
14401
14457
  } else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
14402
- node = ts63.factory.createElementAccessExpression(tsCastToAny(receiver), key);
14458
+ node = new TcbExpr(`(${receiver.print()} as any)[${key.print()}]`);
14403
14459
  } else {
14404
- const expr = ts63.factory.createElementAccessExpression(ts63.factory.createNonNullExpression(receiver), key);
14405
- addParseSpanInfo(expr, ast.sourceSpan);
14406
- node = tsCastToAny(expr);
14460
+ const elementAccess = new TcbExpr(`${receiver.print()}![${key.print()}]`).addParseSpanInfo(ast.sourceSpan);
14461
+ node = new TcbExpr(`(${elementAccess.print()} as any)`);
14407
14462
  }
14408
- addParseSpanInfo(node, ast.sourceSpan);
14409
- return node;
14463
+ return node.addParseSpanInfo(ast.sourceSpan);
14410
14464
  }
14411
14465
  visitCall(ast) {
14412
14466
  const args = ast.args.map((expr2) => this.translate(expr2));
14413
- let expr;
14414
14467
  const receiver = ast.receiver;
14468
+ let expr;
14415
14469
  if (receiver instanceof PropertyRead3) {
14416
14470
  const resolved = this.maybeResolve(receiver);
14417
14471
  if (resolved !== null) {
14418
14472
  expr = resolved;
14419
14473
  } else {
14420
- const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
14421
- expr = ts63.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
14422
- addParseSpanInfo(expr, receiver.nameSpan);
14474
+ const propertyReceiver = this.translate(receiver.receiver).wrapForTypeChecker();
14475
+ expr = new TcbExpr(`${propertyReceiver.print()}.${receiver.name}`).addParseSpanInfo(receiver.nameSpan);
14423
14476
  }
14424
14477
  } else {
14425
14478
  expr = this.translate(receiver);
@@ -14428,87 +14481,84 @@ var AstTranslator = class {
14428
14481
  if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
14429
14482
  node = this.convertToSafeCall(ast, expr, args);
14430
14483
  } else {
14431
- node = ts63.factory.createCallExpression(expr, void 0, args);
14484
+ node = new TcbExpr(`${expr.print()}(${args.map((arg) => arg.print()).join(", ")})`);
14432
14485
  }
14433
- addParseSpanInfo(node, ast.sourceSpan);
14434
- return node;
14486
+ return node.addParseSpanInfo(ast.sourceSpan);
14435
14487
  }
14436
14488
  visitSafeCall(ast) {
14437
14489
  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;
14490
+ const expr = this.translate(ast.receiver).wrapForTypeChecker();
14491
+ return this.convertToSafeCall(ast, expr, args).addParseSpanInfo(ast.sourceSpan);
14442
14492
  }
14443
14493
  visitTemplateLiteral(ast) {
14444
14494
  const length = ast.elements.length;
14445
14495
  const head = ast.elements[0];
14446
14496
  let result;
14447
14497
  if (length === 1) {
14448
- result = ts63.factory.createNoSubstitutionTemplateLiteral(head.text);
14498
+ result = `\`${head.text}\``;
14449
14499
  } else {
14450
- const spans = [];
14500
+ let parts = [`\`${head.text}`];
14451
14501
  const tailIndex = length - 1;
14452
14502
  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));
14503
+ const expr = this.translate(ast.expressions[i - 1]);
14504
+ parts.push(`\${${expr.print()}}${ast.elements[i].text}`);
14455
14505
  }
14456
14506
  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);
14507
+ parts.push(`\${${resolvedExpression.print()}}${ast.elements[tailIndex].text}\``);
14508
+ result = parts.join("");
14460
14509
  }
14461
- return result;
14510
+ return new TcbExpr(result);
14462
14511
  }
14463
- visitTemplateLiteralElement(ast, context) {
14512
+ visitTemplateLiteralElement() {
14464
14513
  throw new Error("Method not implemented");
14465
14514
  }
14466
14515
  visitTaggedTemplateLiteral(ast) {
14467
- return ts63.factory.createTaggedTemplateExpression(this.translate(ast.tag), void 0, this.visitTemplateLiteral(ast.template));
14516
+ const tag = this.translate(ast.tag);
14517
+ const template = this.visitTemplateLiteral(ast.template);
14518
+ return new TcbExpr(`${tag.print()}${template.print()}`);
14468
14519
  }
14469
14520
  visitParenthesizedExpression(ast) {
14470
- return ts63.factory.createParenthesizedExpression(this.translate(ast.expression));
14521
+ const expr = this.translate(ast.expression);
14522
+ return new TcbExpr(`(${expr.print()})`);
14471
14523
  }
14472
14524
  visitSpreadElement(ast) {
14473
- const expression = wrapForDiagnostics(this.translate(ast.expression));
14474
- const node = ts63.factory.createSpreadElement(expression);
14475
- addParseSpanInfo(node, ast.sourceSpan);
14525
+ const expression = this.translate(ast.expression);
14526
+ expression.wrapForTypeChecker();
14527
+ const node = new TcbExpr(`...${expression.print()}`);
14528
+ node.addParseSpanInfo(ast.sourceSpan);
14476
14529
  return node;
14477
14530
  }
14478
- visitEmptyExpr(ast, context) {
14479
- const node = ts63.factory.createIdentifier("undefined");
14480
- addParseSpanInfo(node, ast.sourceSpan);
14531
+ visitEmptyExpr(ast) {
14532
+ const node = new TcbExpr("undefined");
14533
+ node.addParseSpanInfo(ast.sourceSpan);
14481
14534
  return node;
14482
14535
  }
14483
14536
  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) => {
14537
+ const params = ast.parameters.map((param) => new TcbExpr(param.name).markIgnoreDiagnostics().print()).join(", ");
14538
+ const body = astToTcbExpr(ast.body, (innerAst) => {
14490
14539
  if (!(innerAst instanceof PropertyRead3) || innerAst.receiver instanceof ThisReceiver3 || !(innerAst.receiver instanceof ImplicitReceiver3)) {
14491
14540
  return this.maybeResolve(innerAst);
14492
14541
  }
14493
14542
  const correspondingParam = ast.parameters.find((arg) => arg.name === innerAst.name);
14494
14543
  if (correspondingParam) {
14495
- const node = ts63.factory.createIdentifier(innerAst.name);
14496
- addParseSpanInfo(node, innerAst.sourceSpan);
14544
+ const node = new TcbExpr(innerAst.name);
14545
+ node.addParseSpanInfo(innerAst.sourceSpan);
14497
14546
  return node;
14498
14547
  }
14499
14548
  return this.maybeResolve(innerAst);
14500
14549
  }, this.config);
14501
- return ts63.factory.createArrowFunction(void 0, void 0, params, void 0, void 0, body);
14550
+ return new TcbExpr(`${ast.parameters.length === 1 ? params : `(${params})`} => ${body.print()}`);
14502
14551
  }
14503
- convertToSafeCall(ast, expr, args) {
14552
+ convertToSafeCall(ast, exprNode, argNodes) {
14553
+ const expr = exprNode.print();
14554
+ const args = argNodes.map((node) => node.print()).join(", ");
14504
14555
  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));
14556
+ return new TcbExpr(`(0 as any ? ${expr}!(${args}) : undefined)`);
14507
14557
  }
14508
14558
  if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
14509
- return ts63.factory.createCallExpression(tsCastToAny(expr), void 0, args);
14559
+ return new TcbExpr(`(${expr} as any)(${args})`);
14510
14560
  }
14511
- return tsCastToAny(ts63.factory.createCallExpression(ts63.factory.createNonNullExpression(expr), void 0, args));
14561
+ return new TcbExpr(`(${expr}!(${args}) as any)`);
14512
14562
  }
14513
14563
  };
14514
14564
  var VeSafeLhsInferenceBugDetector = class _VeSafeLhsInferenceBugDetector {
@@ -14610,7 +14660,7 @@ function tcbExpression(ast, tcb, scope) {
14610
14660
  }
14611
14661
  function unwrapWritableSignal(expression, tcb) {
14612
14662
  const unwrapRef = tcb.env.referenceExternalSymbol(R3Identifiers4.unwrapWritableSignal.moduleName, R3Identifiers4.unwrapWritableSignal.name);
14613
- return ts64.factory.createCallExpression(unwrapRef, void 0, [expression]);
14663
+ return new TcbExpr(`${unwrapRef.print()}(${expression.print()})`);
14614
14664
  }
14615
14665
  var TcbExpressionOp = class extends TcbOp {
14616
14666
  tcb;
@@ -14627,7 +14677,7 @@ var TcbExpressionOp = class extends TcbOp {
14627
14677
  }
14628
14678
  execute() {
14629
14679
  const expr = tcbExpression(this.expression, this.tcb, this.scope);
14630
- this.scope.addStatement(ts64.factory.createExpressionStatement(expr));
14680
+ this.scope.addStatement(expr);
14631
14681
  return null;
14632
14682
  }
14633
14683
  };
@@ -14646,7 +14696,7 @@ var TcbConditionOp = class extends TcbOp {
14646
14696
  }
14647
14697
  execute() {
14648
14698
  const expr = tcbExpression(this.expression, this.tcb, this.scope);
14649
- this.scope.addStatement(ts64.factory.createIfStatement(expr, ts64.factory.createBlock([])));
14699
+ this.scope.addStatement(new TcbExpr(`if (${expr.print()}) {}`));
14650
14700
  return null;
14651
14701
  }
14652
14702
  };
@@ -14658,7 +14708,7 @@ var TcbExpressionTranslator = class {
14658
14708
  this.scope = scope;
14659
14709
  }
14660
14710
  translate(ast) {
14661
- return astToTypescript(ast, (ast2) => this.resolve(ast2), this.tcb.env.config);
14711
+ return astToTcbExpr(ast, (ast2) => this.resolve(ast2), this.tcb.env.config);
14662
14712
  }
14663
14713
  /**
14664
14714
  * Resolve an `AST` expression within the given scope.
@@ -14673,7 +14723,7 @@ var TcbExpressionTranslator = class {
14673
14723
  if (target instanceof TmplAstLetDeclaration2 && !this.isValidLetDeclarationAccess(target, ast)) {
14674
14724
  this.tcb.oobRecorder.letUsedBeforeDefinition(this.tcb.id, ast, target);
14675
14725
  if (targetExpression !== null) {
14676
- return ts64.factory.createAsExpression(targetExpression, ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
14726
+ return new TcbExpr(`${targetExpression.print()} as any`);
14677
14727
  }
14678
14728
  }
14679
14729
  return targetExpression;
@@ -14685,62 +14735,51 @@ var TcbExpressionTranslator = class {
14685
14735
  }
14686
14736
  const targetExpression = this.getTargetNodeExpression(target, read);
14687
14737
  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);
14738
+ const result = new TcbExpr(`(${targetExpression.print()} = ${expr.print()})`);
14739
+ result.addParseSpanInfo(read.sourceSpan);
14690
14740
  if (target instanceof TmplAstLetDeclaration2) {
14691
- markIgnoreDiagnostics(result);
14741
+ result.markIgnoreDiagnostics();
14692
14742
  this.tcb.oobRecorder.illegalWriteToLetDeclaration(this.tcb.id, read, target);
14693
14743
  }
14694
14744
  return result;
14695
14745
  } else if (ast instanceof ImplicitReceiver4 || ast instanceof ThisReceiver4) {
14696
- return ts64.factory.createThis();
14746
+ return new TcbExpr("this");
14697
14747
  } else if (ast instanceof BindingPipe) {
14698
14748
  const expr = this.translate(ast.exp);
14699
14749
  const pipeMeta = this.tcb.getPipeByName(ast.name);
14700
14750
  let pipe;
14701
14751
  if (pipeMeta === null) {
14702
14752
  this.tcb.oobRecorder.missingPipe(this.tcb.id, ast, this.tcb.hostIsStandalone);
14703
- pipe = getAnyExpression();
14753
+ pipe = new TcbExpr("(0 as any)");
14704
14754
  } else if (pipeMeta.isExplicitlyDeferred && this.tcb.boundTarget.getEagerlyUsedPipes().includes(ast.name)) {
14705
14755
  this.tcb.oobRecorder.deferredPipeUsedEagerly(this.tcb.id, ast);
14706
- pipe = getAnyExpression();
14756
+ pipe = new TcbExpr("(0 as any)");
14707
14757
  } else {
14708
- pipe = this.tcb.env.pipeInst(pipeMeta.ref);
14758
+ pipe = this.tcb.env.pipeInst(pipeMeta);
14709
14759
  }
14710
- const args = ast.args.map((arg) => this.translate(arg));
14711
- let methodAccess = ts64.factory.createPropertyAccessExpression(pipe, "transform");
14712
- addParseSpanInfo(methodAccess, ast.nameSpan);
14760
+ const args = ast.args.map((arg) => this.translate(arg).print());
14761
+ let methodAccess = new TcbExpr(`${pipe.print()}.transform`).addParseSpanInfo(ast.nameSpan);
14713
14762
  if (!this.tcb.env.config.checkTypeOfPipes) {
14714
- methodAccess = ts64.factory.createAsExpression(methodAccess, ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
14763
+ methodAccess = new TcbExpr(`(${methodAccess.print()} as any)`);
14715
14764
  }
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;
14765
+ const result = new TcbExpr(`${methodAccess.print()}(${[expr.print(), ...args].join(", ")})`);
14766
+ return result.addParseSpanInfo(ast.sourceSpan);
14726
14767
  } else if ((ast instanceof Call3 || ast instanceof SafeCall2) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
14727
14768
  if (ast.receiver.receiver instanceof ImplicitReceiver4 && ast.receiver.name === "$any" && ast.args.length === 1) {
14728
14769
  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);
14770
+ const result = new TcbExpr(`(${expr.print()} as any)`);
14771
+ result.addParseSpanInfo(ast.sourceSpan);
14732
14772
  return result;
14733
14773
  }
14734
14774
  const target = this.tcb.boundTarget.getExpressionTarget(ast);
14735
14775
  if (target === null) {
14736
14776
  return null;
14737
14777
  }
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);
14778
+ const method = this.getTargetNodeExpression(target, ast);
14779
+ method.addParseSpanInfo(ast.receiver.nameSpan).wrapForTypeChecker();
14780
+ const args = ast.args.map((arg) => this.translate(arg).print());
14781
+ const node = new TcbExpr(`${method.print()}(${args.join(", ")})`);
14782
+ node.addParseSpanInfo(ast.sourceSpan);
14744
14783
  return node;
14745
14784
  } else {
14746
14785
  return null;
@@ -14748,7 +14787,7 @@ var TcbExpressionTranslator = class {
14748
14787
  }
14749
14788
  getTargetNodeExpression(targetNode, expressionNode) {
14750
14789
  const expr = this.scope.resolve(targetNode);
14751
- addParseSpanInfo(expr, expressionNode.sourceSpan);
14790
+ expr.addParseSpanInfo(expressionNode.sourceSpan);
14752
14791
  return expr;
14753
14792
  }
14754
14793
  isValidLetDeclarationAccess(target, ast) {
@@ -14771,9 +14810,8 @@ var TcbTemplateContextOp = class extends TcbOp {
14771
14810
  // The declaration of the context variable is only needed when the context is actually referenced.
14772
14811
  optional = true;
14773
14812
  execute() {
14774
- const ctx = this.tcb.allocateId();
14775
- const type = ts65.factory.createKeywordTypeNode(ts65.SyntaxKind.AnyKeyword);
14776
- this.scope.addStatement(tsDeclareVariable(ctx, type));
14813
+ const ctx = new TcbExpr(this.tcb.allocateId());
14814
+ this.scope.addStatement(declareVariable(ctx, new TcbExpr("any")));
14777
14815
  return ctx;
14778
14816
  }
14779
14817
  };
@@ -14798,23 +14836,19 @@ var TcbTemplateBodyOp = class extends TcbOp {
14798
14836
  this.addDirectiveGuards(directiveGuards, directive, this.tcb.boundTarget.getDirectivesOfNode(directive));
14799
14837
  }
14800
14838
  if (directiveGuards.length > 0) {
14801
- guard = directiveGuards.reduce((expr, dirGuard) => ts65.factory.createBinaryExpression(expr, ts65.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
14839
+ guard = directiveGuards.reduce((expr, dirGuard) => new TcbExpr(`${expr.print()} && ${dirGuard.print()}`), directiveGuards.pop());
14802
14840
  }
14803
14841
  const tmplScope = this.scope.createChildScope(this.scope, this.template, this.template.children, guard);
14804
14842
  const statements = tmplScope.render();
14805
14843
  if (statements.length === 0) {
14806
14844
  return null;
14807
14845
  }
14808
- let tmplBlock = ts65.factory.createBlock(statements);
14846
+ let tmplBlock = `{
14847
+ ${getStatementsBlock(statements)}}`;
14809
14848
  if (guard !== null) {
14810
- tmplBlock = ts65.factory.createIfStatement(
14811
- /* expression */
14812
- guard,
14813
- /* thenStatement */
14814
- tmplBlock
14815
- );
14849
+ tmplBlock = `if (${guard.print()}) ${tmplBlock}`;
14816
14850
  }
14817
- this.scope.addStatement(tmplBlock);
14851
+ this.scope.addStatement(new TcbExpr(tmplBlock));
14818
14852
  return null;
14819
14853
  }
14820
14854
  addDirectiveGuards(guards, hostNode, directives) {
@@ -14824,22 +14858,19 @@ var TcbTemplateBodyOp = class extends TcbOp {
14824
14858
  const isTemplate = hostNode instanceof TmplAstTemplate;
14825
14859
  for (const dir of directives) {
14826
14860
  const dirInstId = this.scope.resolve(hostNode, dir);
14827
- const dirId = this.tcb.env.reference(dir.ref);
14861
+ const dirId = this.tcb.env.referenceTcbValue(dir.ref);
14828
14862
  dir.ngTemplateGuards.forEach((guard) => {
14829
14863
  const boundInput = hostNode.inputs.find((i) => i.name === guard.inputName) || (isTemplate ? hostNode.templateAttrs.find((input) => {
14830
14864
  return input instanceof TmplAstBoundAttribute3 && input.name === guard.inputName;
14831
14865
  }) : void 0);
14832
14866
  if (boundInput !== void 0) {
14833
14867
  const expr = tcbExpression(boundInput.value, this.tcb, this.scope);
14834
- markIgnoreDiagnostics(expr);
14868
+ expr.markIgnoreDiagnostics();
14835
14869
  if (guard.type === "binding") {
14836
14870
  guards.push(expr);
14837
14871
  } else {
14838
- const guardInvoke = tsCallMethod(dirId, `ngTemplateGuard_${guard.inputName}`, [
14839
- dirInstId,
14840
- expr
14841
- ]);
14842
- addParseSpanInfo(guardInvoke, boundInput.value.sourceSpan);
14872
+ const guardInvoke = new TcbExpr(`${dirId.print()}.ngTemplateGuard_${guard.inputName}(${dirInstId.print()}, ${expr.print()})`);
14873
+ guardInvoke.addParseSpanInfo(boundInput.value.sourceSpan);
14843
14874
  guards.push(guardInvoke);
14844
14875
  }
14845
14876
  }
@@ -14847,9 +14878,9 @@ var TcbTemplateBodyOp = class extends TcbOp {
14847
14878
  if (dir.hasNgTemplateContextGuard) {
14848
14879
  if (this.tcb.env.config.applyTemplateContextGuards) {
14849
14880
  const ctx = this.scope.resolve(hostNode);
14850
- const guardInvoke = tsCallMethod(dirId, "ngTemplateContextGuard", [dirInstId, ctx]);
14851
- markIgnoreDiagnostics(guardInvoke);
14852
- addParseSpanInfo(guardInvoke, hostNode.sourceSpan);
14881
+ const guardInvoke = new TcbExpr(`${dirId.print()}.ngTemplateContextGuard(${dirInstId.print()}, ${ctx.print()})`);
14882
+ guardInvoke.markIgnoreDiagnostics();
14883
+ guardInvoke.addParseSpanInfo(hostNode.sourceSpan);
14853
14884
  guards.push(guardInvoke);
14854
14885
  } else if (isTemplate && hostNode.variables.length > 0 && this.tcb.env.config.suggestionsForSuboptimalTypeInference) {
14855
14886
  this.tcb.oobRecorder.suboptimalTypeInference(this.tcb.id, hostNode.variables);
@@ -14875,15 +14906,18 @@ var TcbElementOp = class extends TcbOp {
14875
14906
  }
14876
14907
  execute() {
14877
14908
  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;
14909
+ const idNode = new TcbExpr(id);
14910
+ idNode.addParseSpanInfo(this.element.startSourceSpan || this.element.sourceSpan);
14911
+ const initializer = new TcbExpr(`document.createElement("${this.element.name}")`);
14912
+ initializer.addParseSpanInfo(this.element.startSourceSpan || this.element.sourceSpan);
14913
+ const stmt = new TcbExpr(`var ${idNode.print()} = ${initializer.print()}`);
14914
+ stmt.addParseSpanInfo(this.element.startSourceSpan || this.element.sourceSpan);
14915
+ this.scope.addStatement(stmt);
14916
+ return idNode;
14882
14917
  }
14883
14918
  };
14884
14919
 
14885
14920
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/variables.js
14886
- import ts66 from "typescript";
14887
14921
  var TcbBlockImplicitVariableOp = class extends TcbOp {
14888
14922
  tcb;
14889
14923
  scope;
@@ -14898,10 +14932,10 @@ var TcbBlockImplicitVariableOp = class extends TcbOp {
14898
14932
  }
14899
14933
  optional = true;
14900
14934
  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);
14935
+ const id = new TcbExpr(this.tcb.allocateId());
14936
+ id.addParseSpanInfo(this.variable.keySpan);
14937
+ const variable = declareVariable(id, this.type);
14938
+ variable.addParseSpanInfo(this.variable.sourceSpan);
14905
14939
  this.scope.addStatement(variable);
14906
14940
  return id;
14907
14941
  }
@@ -14923,22 +14957,15 @@ var TcbTemplateVariableOp = class extends TcbOp {
14923
14957
  }
14924
14958
  execute() {
14925
14959
  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;
14960
+ const id = new TcbExpr(this.tcb.allocateId());
14961
+ const initializer = new TcbExpr(`${ctx.print()}.${this.variable.value || "$implicit"}`);
14962
+ id.addParseSpanInfo(this.variable.keySpan);
14935
14963
  if (this.variable.valueSpan !== void 0) {
14936
- addParseSpanInfo(initializer, this.variable.valueSpan);
14937
- variable = tsCreateVariable(id, wrapForTypeChecker(initializer));
14964
+ initializer.addParseSpanInfo(this.variable.valueSpan).wrapForTypeChecker();
14938
14965
  } else {
14939
- variable = tsCreateVariable(id, initializer);
14940
14966
  }
14941
- addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
14967
+ const variable = new TcbExpr(`var ${id.print()} = ${initializer.print()}`);
14968
+ variable.addParseSpanInfo(this.variable.sourceSpan);
14942
14969
  this.scope.addStatement(variable);
14943
14970
  return id;
14944
14971
  }
@@ -14959,17 +14986,17 @@ var TcbBlockVariableOp = class extends TcbOp {
14959
14986
  return false;
14960
14987
  }
14961
14988
  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);
14989
+ const id = new TcbExpr(this.tcb.allocateId());
14990
+ id.addParseSpanInfo(this.variable.keySpan);
14991
+ this.initializer.wrapForTypeChecker();
14992
+ const variable = new TcbExpr(`var ${id.print()} = ${this.initializer.print()}`);
14993
+ variable.addParseSpanInfo(this.variable.sourceSpan);
14966
14994
  this.scope.addStatement(variable);
14967
14995
  return id;
14968
14996
  }
14969
14997
  };
14970
14998
 
14971
14999
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/completions.js
14972
- import ts67 from "typescript";
14973
15000
  var TcbComponentContextCompletionOp = class extends TcbOp {
14974
15001
  scope;
14975
15002
  constructor(scope) {
@@ -14978,18 +15005,16 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
14978
15005
  }
14979
15006
  optional = false;
14980
15007
  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));
15008
+ const ctx = new TcbExpr("this.");
15009
+ ctx.markIgnoreDiagnostics();
15010
+ ctx.addExpressionIdentifier(ExpressionIdentifier.COMPONENT_COMPLETION);
15011
+ this.scope.addStatement(ctx);
14986
15012
  return null;
14987
15013
  }
14988
15014
  };
14989
15015
 
14990
15016
  // 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";
15017
+ import { TmplAstElement as TmplAstElement2, TmplAstTemplate as TmplAstTemplate2 } from "@angular/compiler";
14993
15018
  var TcbReferenceOp = class extends TcbOp {
14994
15019
  tcb;
14995
15020
  scope;
@@ -15008,18 +15033,17 @@ var TcbReferenceOp = class extends TcbOp {
15008
15033
  // so it can map a reference variable in the template directly to a node in the TCB.
15009
15034
  optional = true;
15010
15035
  execute() {
15011
- const id = this.tcb.allocateId();
15036
+ const id = new TcbExpr(this.tcb.allocateId());
15012
15037
  let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement2 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
15013
15038
  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));
15039
+ initializer = new TcbExpr(`${initializer.print()} as any`);
15015
15040
  } 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);
15041
+ const templateRef = this.tcb.env.referenceExternalSymbol("@angular/core", "TemplateRef");
15042
+ initializer = new TcbExpr(`(${initializer.print()} as any as ${templateRef.print()}<any>)`);
15019
15043
  }
15020
- addParseSpanInfo(initializer, this.node.sourceSpan);
15021
- addParseSpanInfo(id, this.node.keySpan);
15022
- this.scope.addStatement(tsCreateVariable(id, initializer));
15044
+ initializer.addParseSpanInfo(this.node.sourceSpan);
15045
+ id.addParseSpanInfo(this.node.keySpan);
15046
+ this.scope.addStatement(new TcbExpr(`var ${id.print()} = ${initializer.print()}`));
15023
15047
  return id;
15024
15048
  }
15025
15049
  };
@@ -15034,14 +15058,13 @@ var TcbInvalidReferenceOp = class extends TcbOp {
15034
15058
  // The declaration of a missing reference is only needed when the reference is resolved.
15035
15059
  optional = true;
15036
15060
  execute() {
15037
- const id = this.tcb.allocateId();
15038
- this.scope.addStatement(tsCreateVariable(id, getAnyExpression()));
15061
+ const id = new TcbExpr(this.tcb.allocateId());
15062
+ this.scope.addStatement(new TcbExpr(`var ${id.print()} = any`));
15039
15063
  return id;
15040
15064
  }
15041
15065
  };
15042
15066
 
15043
15067
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/if_block.js
15044
- import ts69 from "typescript";
15045
15068
  var TcbIfOp = class extends TcbOp {
15046
15069
  tcb;
15047
15070
  scope;
@@ -15068,17 +15091,21 @@ var TcbIfOp = class extends TcbOp {
15068
15091
  }
15069
15092
  if (branch.expression === null) {
15070
15093
  const branchScope = this.getBranchScope(this.scope, branch, index);
15071
- return ts69.factory.createBlock(branchScope.render());
15094
+ return new TcbExpr(`{
15095
+ ${getStatementsBlock(branchScope.render())}}`);
15072
15096
  }
15073
15097
  const outerScope = this.scope.createChildScope(this.scope, branch, [], null);
15074
15098
  outerScope.render().forEach((stmt) => this.scope.addStatement(stmt));
15075
15099
  this.expressionScopes.set(branch, outerScope);
15076
15100
  let expression = tcbExpression(branch.expression, this.tcb, this.scope);
15077
15101
  if (branch.expressionAlias !== null) {
15078
- expression = ts69.factory.createBinaryExpression(ts69.factory.createParenthesizedExpression(expression), ts69.SyntaxKind.AmpersandAmpersandToken, outerScope.resolve(branch.expressionAlias));
15102
+ expression = new TcbExpr(`(${expression.print()}) && ${outerScope.resolve(branch.expressionAlias).print()}`);
15079
15103
  }
15080
15104
  const bodyScope = this.getBranchScope(outerScope, branch, index);
15081
- return ts69.factory.createIfStatement(expression, ts69.factory.createBlock(bodyScope.render()), this.generateBranch(index + 1));
15105
+ const ifStatement = `if (${expression.print()}) {
15106
+ ${getStatementsBlock(bodyScope.render())}}`;
15107
+ const elseBranch = this.generateBranch(index + 1);
15108
+ return new TcbExpr(ifStatement + (elseBranch ? " else " + elseBranch.print() : ""));
15082
15109
  }
15083
15110
  getBranchScope(parentScope, branch, index) {
15084
15111
  const checkBody = this.tcb.env.config.checkControlFlowBodies;
@@ -15098,18 +15125,17 @@ var TcbIfOp = class extends TcbOp {
15098
15125
  let expression;
15099
15126
  expression = tcbExpression(branch.expression, this.tcb, expressionScope);
15100
15127
  if (branch.expressionAlias !== null) {
15101
- expression = ts69.factory.createBinaryExpression(ts69.factory.createParenthesizedExpression(expression), ts69.SyntaxKind.AmpersandAmpersandToken, expressionScope.resolve(branch.expressionAlias));
15128
+ expression = new TcbExpr(`(${expression.print()}) && ${expressionScope.resolve(branch.expressionAlias).print()}`);
15102
15129
  }
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);
15130
+ expression.markIgnoreDiagnostics();
15131
+ const comparisonExpression = i === index ? expression : new TcbExpr(`!(${expression.print()})`);
15132
+ guard = guard === null ? comparisonExpression : new TcbExpr(`(${guard.print()}) && (${comparisonExpression.print()})`);
15106
15133
  }
15107
15134
  return guard;
15108
15135
  }
15109
15136
  };
15110
15137
 
15111
15138
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/switch_block.js
15112
- import ts70 from "typescript";
15113
15139
  var TcbSwitchOp = class extends TcbOp {
15114
15140
  tcb;
15115
15141
  scope;
@@ -15128,21 +15154,23 @@ var TcbSwitchOp = class extends TcbOp {
15128
15154
  const clauses = this.block.groups.flatMap((current) => {
15129
15155
  const checkBody = this.tcb.env.config.checkControlFlowBodies;
15130
15156
  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()];
15157
+ const statements = [...clauseScope.render(), new TcbExpr("break")];
15132
15158
  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);
15159
+ const statementsStr = getStatementsBlock(
15160
+ index === current.cases.length - 1 ? statements : [],
15161
+ true
15162
+ /* singleLine */
15163
+ );
15164
+ const source = switchCase.expression === null ? `default: ${statementsStr}` : `case ${tcbExpression(switchCase.expression, this.tcb, this.scope).print()}: ${statementsStr}`;
15165
+ return new TcbExpr(source);
15135
15166
  });
15136
15167
  });
15137
15168
  if (this.block.exhaustiveCheck) {
15138
15169
  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
- ]));
15170
+ const exhaustiveId = this.tcb.allocateId();
15171
+ clauses.push(new TcbExpr(`default: const tcbExhaustive${exhaustiveId}: never = ${switchValue.print()};`));
15144
15172
  }
15145
- this.scope.addStatement(ts70.factory.createSwitchStatement(switchExpression, ts70.factory.createCaseBlock(clauses)));
15173
+ this.scope.addStatement(new TcbExpr(`switch (${switchExpression.print()}) { ${clauses.map((c) => c.print()).join("\n")} }`));
15146
15174
  return null;
15147
15175
  }
15148
15176
  generateGuard(group, switchValue) {
@@ -15152,12 +15180,12 @@ var TcbSwitchOp = class extends TcbOp {
15152
15180
  for (const switchCase of group.cases) {
15153
15181
  if (switchCase.expression !== null) {
15154
15182
  const expression = tcbExpression(switchCase.expression, this.tcb, this.scope);
15155
- markIgnoreDiagnostics(expression);
15156
- const comparison = ts70.factory.createBinaryExpression(switchValue, ts70.SyntaxKind.EqualsEqualsEqualsToken, expression);
15183
+ expression.markIgnoreDiagnostics();
15184
+ const comparison = new TcbExpr(`${switchValue.print()} === ${expression.print()}`);
15157
15185
  if (guard2 === null) {
15158
15186
  guard2 = comparison;
15159
15187
  } else {
15160
- guard2 = ts70.factory.createBinaryExpression(guard2, ts70.SyntaxKind.BarBarToken, comparison);
15188
+ guard2 = new TcbExpr(`(${guard2.print()}) || (${comparison.print()})`);
15161
15189
  }
15162
15190
  }
15163
15191
  }
@@ -15173,12 +15201,12 @@ var TcbSwitchOp = class extends TcbOp {
15173
15201
  continue;
15174
15202
  }
15175
15203
  const expression = tcbExpression(switchCase.expression, this.tcb, this.scope);
15176
- markIgnoreDiagnostics(expression);
15177
- const comparison = ts70.factory.createBinaryExpression(switchValue, ts70.SyntaxKind.ExclamationEqualsEqualsToken, expression);
15204
+ expression.markIgnoreDiagnostics();
15205
+ const comparison = new TcbExpr(`${switchValue.print()} !== ${expression.print()}`);
15178
15206
  if (guard === null) {
15179
15207
  guard = comparison;
15180
15208
  } else {
15181
- guard = ts70.factory.createBinaryExpression(guard, ts70.SyntaxKind.AmpersandAmpersandToken, comparison);
15209
+ guard = new TcbExpr(`(${guard.print()}) && (${comparison.print()})`);
15182
15210
  }
15183
15211
  }
15184
15212
  }
@@ -15188,7 +15216,6 @@ var TcbSwitchOp = class extends TcbOp {
15188
15216
 
15189
15217
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/for_block.js
15190
15218
  import { ImplicitReceiver as ImplicitReceiver5, PropertyRead as PropertyRead5, ThisReceiver as ThisReceiver5, TmplAstVariable } from "@angular/compiler";
15191
- import ts71 from "typescript";
15192
15219
  var TcbForOfOp = class extends TcbOp {
15193
15220
  tcb;
15194
15221
  scope;
@@ -15205,19 +15232,14 @@ var TcbForOfOp = class extends TcbOp {
15205
15232
  execute() {
15206
15233
  const loopScope = this.scope.createChildScope(this.scope, this.block, this.tcb.env.config.checkControlFlowBodies ? this.block.children : [], null);
15207
15234
  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));
15235
+ const initializer = new TcbExpr(`const ${initializerId.print()}`);
15236
+ initializer.addParseSpanInfo(this.block.item.keySpan);
15237
+ const expression = new TcbExpr(`${tcbExpression(this.block.expression, this.tcb, this.scope).print()}!`);
15214
15238
  const trackTranslator = new TcbForLoopTrackTranslator(this.tcb, loopScope, this.block);
15215
15239
  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)));
15240
+ const block = getStatementsBlock([...loopScope.render(), trackExpression]);
15241
+ this.scope.addStatement(new TcbExpr(`for (${initializer.print()} of ${expression.print()}) {
15242
+ ${block} }`));
15221
15243
  return null;
15222
15244
  }
15223
15245
  };
@@ -15246,7 +15268,6 @@ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
15246
15268
  };
15247
15269
 
15248
15270
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/let.js
15249
- import ts72 from "typescript";
15250
15271
  var TcbLetDeclarationOp = class extends TcbOp {
15251
15272
  tcb;
15252
15273
  scope;
@@ -15263,23 +15284,21 @@ var TcbLetDeclarationOp = class extends TcbOp {
15263
15284
  */
15264
15285
  optional = false;
15265
15286
  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);
15287
+ const id = new TcbExpr(this.tcb.allocateId()).addParseSpanInfo(this.node.nameSpan);
15288
+ const value = tcbExpression(this.node.value, this.tcb, this.scope).wrapForTypeChecker();
15289
+ const varStatement = new TcbExpr(`const ${id.print()} = ${value.print()}`);
15290
+ varStatement.addParseSpanInfo(this.node.sourceSpan);
15271
15291
  this.scope.addStatement(varStatement);
15272
15292
  return id;
15273
15293
  }
15274
15294
  };
15275
15295
 
15276
15296
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/inputs.js
15277
- import { BindingType as BindingType5, R3Identifiers as R3Identifiers5, TransplantedType } from "@angular/compiler";
15278
- import ts75 from "typescript";
15297
+ import { BindingType as BindingType5, R3Identifiers as R3Identifiers5 } from "@angular/compiler";
15298
+ import ts63 from "typescript";
15279
15299
 
15280
15300
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/signal_forms.js
15281
15301
  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";
15283
15302
  var formControlInputFields = [
15284
15303
  // Should be kept in sync with the `FormUiControl` bindings,
15285
15304
  // defined in `packages/forms/signals/src/api/control.ts`.
@@ -15343,58 +15362,43 @@ var TcbNativeFieldOp = class extends TcbOp {
15343
15362
  return null;
15344
15363
  }
15345
15364
  checkUnsupportedFieldBindings(this.node, this.unsupportedBindingFields, this.tcb);
15346
- const expectedType = this.getExpectedTypeFromDomNode(this.node);
15365
+ const expectedType = new TcbExpr(this.getExpectedTypeFromDomNode(this.node));
15347
15366
  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));
15367
+ const id = new TcbExpr(this.tcb.allocateId());
15368
+ const assignment = new TcbExpr(`${id.print()} = ${value.print()}`);
15369
+ assignment.addParseSpanInfo(fieldBinding.valueSpan ?? fieldBinding.sourceSpan);
15370
+ this.scope.addStatement(declareVariable(id, expectedType));
15371
+ this.scope.addStatement(assignment);
15353
15372
  return null;
15354
15373
  }
15355
15374
  getExpectedTypeFromDomNode(node) {
15356
15375
  if (node.name === "textarea" || node.name === "select") {
15357
- return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword);
15376
+ return "string";
15358
15377
  }
15359
15378
  if (node.name !== "input") {
15360
15379
  return this.getUnsupportedType();
15361
15380
  }
15362
15381
  switch (this.inputType) {
15363
15382
  case "checkbox":
15364
- return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.BooleanKeyword);
15383
+ return "boolean";
15365
15384
  case "number":
15366
15385
  case "range":
15367
15386
  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
- ]);
15387
+ return "string | number | null";
15373
15388
  case "date":
15374
15389
  case "month":
15375
15390
  case "time":
15376
15391
  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
- ]);
15392
+ return "string | number | Date | null";
15383
15393
  }
15384
15394
  const hasDynamicType = this.inputType === null && this.node.inputs.some((input) => (input.type === BindingType3.Property || input.type === BindingType3.Attribute) && input.name === "type");
15385
15395
  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
- ]);
15396
+ return "string | number | boolean | Date | null";
15393
15397
  }
15394
- return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword);
15398
+ return "string";
15395
15399
  }
15396
15400
  getUnsupportedType() {
15397
- return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NeverKeyword);
15401
+ return "never";
15398
15402
  }
15399
15403
  };
15400
15404
  var TcbNativeRadioButtonFieldOp = class extends TcbNativeFieldOp {
@@ -15408,12 +15412,12 @@ var TcbNativeRadioButtonFieldOp = class extends TcbNativeFieldOp {
15408
15412
  return attr.type === BindingType3.Property && attr.name === "value";
15409
15413
  });
15410
15414
  if (valueBinding !== void 0) {
15411
- const id = this.tcb.allocateId();
15415
+ const id = new TcbExpr(this.tcb.allocateId());
15412
15416
  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));
15417
+ const assignment = new TcbExpr(`${id.print()} = ${value.print()}`);
15418
+ assignment.addParseSpanInfo(valueBinding.sourceSpan);
15419
+ this.scope.addStatement(declareVariable(id, new TcbExpr("string")));
15420
+ this.scope.addStatement(assignment);
15417
15421
  }
15418
15422
  return null;
15419
15423
  }
@@ -15449,10 +15453,10 @@ function isFieldDirective(meta) {
15449
15453
  if (meta.name !== "FormField") {
15450
15454
  return false;
15451
15455
  }
15452
- if (meta.ref.bestGuessOwningModule?.specifier === "@angular/forms/signals") {
15456
+ if (meta.ref.moduleName === "@angular/forms/signals") {
15453
15457
  return true;
15454
15458
  }
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");
15459
+ return meta.hasNgFieldDirective;
15456
15460
  }
15457
15461
  function getSyntheticFieldBoundInput(dir, inputName, fieldPropertyName, fieldBinding, customFieldType) {
15458
15462
  const inputs = dir.inputs.getByBindingPropertyName(inputName);
@@ -15478,7 +15482,7 @@ function getSyntheticFieldBoundInput(dir, inputName, fieldPropertyName, fieldBin
15478
15482
  inputs: inputs.map((input) => ({
15479
15483
  fieldName: input.classPropertyName,
15480
15484
  required: input.required,
15481
- transformType: input.transform?.type || null,
15485
+ transformType: input.transformType,
15482
15486
  isSignal: input.isSignal,
15483
15487
  isTwoWayBinding
15484
15488
  }))
@@ -15524,9 +15528,9 @@ function checkUnsupportedFieldBindings(node, unsupportedBindingFields, tcb) {
15524
15528
  }
15525
15529
  }
15526
15530
  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);
15531
+ const innerCall = new TcbExpr(tcbExpression(expression, tcb, scope).print() + "()");
15532
+ innerCall.markIgnoreDiagnostics();
15533
+ return new TcbExpr(`${innerCall.print()}.value()`);
15530
15534
  }
15531
15535
  function hasModelInput(name, meta) {
15532
15536
  return meta.inputs.hasBindingPropertyName(name) && meta.outputs.hasBindingPropertyName(name + "Change");
@@ -15545,8 +15549,7 @@ function isFormControl(allDirectiveMatches) {
15545
15549
  }
15546
15550
 
15547
15551
  // 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";
15552
+ import { BindingType as BindingType4, LiteralArray, LiteralMap, TmplAstBoundAttribute as TmplAstBoundAttribute4, TmplAstElement as TmplAstElement4, TmplAstTemplate as TmplAstTemplate3 } from "@angular/compiler";
15550
15553
  function getBoundAttributes(directive, node) {
15551
15554
  const boundInputs = [];
15552
15555
  const processAttribute = (attr) => {
@@ -15563,7 +15566,7 @@ function getBoundAttributes(directive, node) {
15563
15566
  return {
15564
15567
  fieldName: input.classPropertyName,
15565
15568
  required: input.required,
15566
- transformType: input.transform?.type || null,
15569
+ transformType: input.transformType,
15567
15570
  isSignal: input.isSignal,
15568
15571
  isTwoWayBinding: attr instanceof TmplAstBoundAttribute4 && attr.type === BindingType4.TwoWay
15569
15572
  };
@@ -15594,22 +15597,22 @@ function checkSplitTwoWayBinding(inputName, output, inputs, tcb) {
15594
15597
  return false;
15595
15598
  }
15596
15599
  if (outputConsumer instanceof TmplAstElement4) {
15597
- tcb.oobRecorder.splitTwoWayBinding(tcb.id, input, output, inputConsumer.ref.node, outputConsumer);
15600
+ tcb.oobRecorder.splitTwoWayBinding(tcb.id, input, output, inputConsumer, outputConsumer);
15598
15601
  return true;
15599
15602
  } else if (outputConsumer.ref !== inputConsumer.ref) {
15600
- tcb.oobRecorder.splitTwoWayBinding(tcb.id, input, output, inputConsumer.ref.node, outputConsumer.ref.node);
15603
+ tcb.oobRecorder.splitTwoWayBinding(tcb.id, input, output, inputConsumer, outputConsumer);
15601
15604
  return true;
15602
15605
  }
15603
15606
  return false;
15604
15607
  }
15605
- function widenBinding(expr, tcb) {
15608
+ function widenBinding(expr, tcb, originalValue) {
15606
15609
  if (!tcb.env.config.checkTypeOfInputBindings) {
15607
- return tsCastToAny(expr);
15610
+ return new TcbExpr(`((${expr.print()}) as any)`);
15608
15611
  } else if (!tcb.env.config.strictNullInputBindings) {
15609
- if (ts74.isObjectLiteralExpression(expr) || ts74.isArrayLiteralExpression(expr)) {
15612
+ if (originalValue instanceof LiteralMap || originalValue instanceof LiteralArray) {
15610
15613
  return expr;
15611
15614
  } else {
15612
- return ts74.factory.createNonNullExpression(expr);
15615
+ return new TcbExpr(`(${expr.print()})!`);
15613
15616
  }
15614
15617
  } else {
15615
15618
  return expr;
@@ -15619,7 +15622,7 @@ function widenBinding(expr, tcb) {
15619
15622
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/inputs.js
15620
15623
  function translateInput(value, tcb, scope) {
15621
15624
  if (typeof value === "string") {
15622
- return ts75.factory.createStringLiteral(value);
15625
+ return new TcbExpr(quoteAndEscape(value));
15623
15626
  } else {
15624
15627
  return tcbExpression(value, tcb, scope);
15625
15628
  }
@@ -15657,8 +15660,8 @@ var TcbDirectiveInputsOp = class extends TcbOp {
15657
15660
  }
15658
15661
  }
15659
15662
  for (const attr of boundAttrs) {
15660
- const expr = widenBinding(translateInput(attr.value, this.tcb, this.scope), this.tcb);
15661
- let assignment = wrapForDiagnostics(expr);
15663
+ let assignment = widenBinding(translateInput(attr.value, this.tcb, this.scope), this.tcb, attr.value);
15664
+ assignment.wrapForTypeChecker();
15662
15665
  for (const { fieldName, required, transformType, isSignal, isTwoWayBinding } of attr.inputs) {
15663
15666
  let target;
15664
15667
  if (required) {
@@ -15666,17 +15669,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
15666
15669
  }
15667
15670
  if (this.dir.coercedInputFields.has(fieldName)) {
15668
15671
  let type;
15669
- if (transformType !== null) {
15670
- type = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
15672
+ if (transformType !== void 0) {
15673
+ type = new TcbExpr(transformType);
15671
15674
  } else {
15672
- const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
15673
- if (!ts75.isTypeReferenceNode(dirTypeRef)) {
15674
- throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
15675
+ const dirTypeRef = this.tcb.env.referenceTcbType(this.dir.ref);
15676
+ if (!ts63.isTypeReferenceNode(dirTypeRef)) {
15677
+ throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.name}`);
15675
15678
  }
15676
- type = tsCreateTypeQueryForCoercedInput(dirTypeRef.typeName, fieldName);
15679
+ const typeName = ts63.isIdentifier(dirTypeRef.typeName) ? dirTypeRef.typeName.text : tempPrint(dirTypeRef.typeName, dirTypeRef.typeName.getSourceFile());
15680
+ type = new TcbExpr(`typeof ${typeName}.ngAcceptInputType_${fieldName}`);
15677
15681
  }
15678
- const id = this.tcb.allocateId();
15679
- this.scope.addStatement(tsDeclareVariable(id, type));
15682
+ const id = new TcbExpr(this.tcb.allocateId());
15683
+ this.scope.addStatement(declareVariable(id, type));
15680
15684
  target = id;
15681
15685
  } else if (this.dir.undeclaredInputFields.has(fieldName)) {
15682
15686
  continue;
@@ -15684,41 +15688,38 @@ var TcbDirectiveInputsOp = class extends TcbOp {
15684
15688
  if (dirId === null) {
15685
15689
  dirId = this.scope.resolve(this.node, this.dir);
15686
15690
  }
15687
- const id = this.tcb.allocateId();
15688
- const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
15689
- if (!ts75.isTypeReferenceNode(dirTypeRef)) {
15690
- throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
15691
+ const id = new TcbExpr(this.tcb.allocateId());
15692
+ const dirTypeRef = this.tcb.env.referenceTcbType(this.dir.ref);
15693
+ if (!ts63.isTypeReferenceNode(dirTypeRef)) {
15694
+ throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.name}`);
15691
15695
  }
15692
- const type = ts75.factory.createIndexedAccessTypeNode(ts75.factory.createTypeQueryNode(dirId), ts75.factory.createLiteralTypeNode(ts75.factory.createStringLiteral(fieldName)));
15693
- const temp = tsDeclareVariable(id, type);
15696
+ const type = new TcbExpr(`(typeof ${dirId.print()})[${quoteAndEscape(fieldName)}]`);
15697
+ const temp = declareVariable(id, type);
15694
15698
  this.scope.addStatement(temp);
15695
15699
  target = id;
15696
15700
  } else {
15697
15701
  if (dirId === null) {
15698
15702
  dirId = this.scope.resolve(this.node, this.dir);
15699
15703
  }
15700
- target = this.dir.stringLiteralInputFields.has(fieldName) ? ts75.factory.createElementAccessExpression(dirId, ts75.factory.createStringLiteral(fieldName)) : ts75.factory.createPropertyAccessExpression(dirId, ts75.factory.createIdentifier(fieldName));
15704
+ target = this.dir.stringLiteralInputFields.has(fieldName) ? new TcbExpr(`${dirId.print()}[${quoteAndEscape(fieldName)}]`) : new TcbExpr(`${dirId.print()}.${fieldName}`);
15701
15705
  }
15702
15706
  if (isSignal) {
15703
15707
  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);
15708
+ target = new TcbExpr(`${target.print()}[${inputSignalBrandWriteSymbol.print()}]`);
15708
15709
  }
15709
15710
  if (attr.keySpan !== null) {
15710
- addParseSpanInfo(target, attr.keySpan);
15711
+ target.addParseSpanInfo(attr.keySpan);
15711
15712
  }
15712
15713
  if (isTwoWayBinding && this.tcb.env.config.allowSignalsInTwoWayBindings) {
15713
15714
  assignment = unwrapWritableSignal(assignment, this.tcb);
15714
15715
  }
15715
- assignment = ts75.factory.createBinaryExpression(target, ts75.SyntaxKind.EqualsToken, assignment);
15716
+ assignment = new TcbExpr(`${target.print()} = ${assignment.print()}`);
15716
15717
  }
15717
- addParseSpanInfo(assignment, attr.sourceSpan);
15718
+ assignment.addParseSpanInfo(attr.sourceSpan);
15718
15719
  if (!this.tcb.env.config.checkTypeOfAttributes && typeof attr.value === "string") {
15719
- markIgnoreDiagnostics(assignment);
15720
+ assignment.markIgnoreDiagnostics();
15720
15721
  }
15721
- this.scope.addStatement(ts75.factory.createExpressionStatement(assignment));
15722
+ this.scope.addStatement(assignment);
15722
15723
  }
15723
15724
  this.checkRequiredInputs(seenRequiredInputs);
15724
15725
  return null;
@@ -15759,22 +15760,20 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
15759
15760
  if (isPropertyBinding && this.claimedInputs?.has(binding.name)) {
15760
15761
  continue;
15761
15762
  }
15762
- const expr = widenBinding(tcbExpression(binding.value, this.tcb, this.scope), this.tcb);
15763
+ const expr = widenBinding(tcbExpression(binding.value, this.tcb, this.scope), this.tcb, binding.value);
15763
15764
  if (this.tcb.env.config.checkTypeOfDomBindings && isPropertyBinding) {
15764
15765
  if (binding.name !== "style" && binding.name !== "class") {
15765
15766
  if (elId === null) {
15766
15767
  elId = this.scope.resolve(this.target);
15767
15768
  }
15768
15769
  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));
15770
+ const stmt = new TcbExpr(`${elId.print()}[${quoteAndEscape(propertyName)}] = ${expr.wrapForTypeChecker().print()}`).addParseSpanInfo(binding.sourceSpan);
15771
+ this.scope.addStatement(stmt);
15773
15772
  } else {
15774
- this.scope.addStatement(ts75.factory.createExpressionStatement(expr));
15773
+ this.scope.addStatement(expr);
15775
15774
  }
15776
15775
  } else {
15777
- this.scope.addStatement(ts75.factory.createExpressionStatement(expr));
15776
+ this.scope.addStatement(expr);
15778
15777
  }
15779
15778
  }
15780
15779
  return null;
@@ -15801,10 +15800,10 @@ var TcbComponentNodeOp = class extends TcbOp {
15801
15800
  }
15802
15801
  execute() {
15803
15802
  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;
15803
+ const initializer = new TcbExpr(`document.createElement("${getComponentTagName(this.component)}")`);
15804
+ initializer.addParseSpanInfo(this.component.startSourceSpan || this.component.sourceSpan);
15805
+ this.scope.addStatement(new TcbExpr(`var ${id} = ${initializer.print()}`));
15806
+ return new TcbExpr(id);
15808
15807
  }
15809
15808
  };
15810
15809
 
@@ -15854,7 +15853,6 @@ var TcbDomSchemaCheckerOp = class extends TcbOp {
15854
15853
 
15855
15854
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/events.js
15856
15855
  import { ImplicitReceiver as ImplicitReceiver6, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead7, TmplAstElement as TmplAstElement6 } from "@angular/compiler";
15857
- import ts76 from "typescript";
15858
15856
  var EVENT_PARAMETER = "$event";
15859
15857
  function tcbEventHandlerExpression(ast, tcb, scope) {
15860
15858
  const translator = new TcbEventHandlerTranslator(tcb, scope);
@@ -15894,8 +15892,8 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15894
15892
  if (dirId === null) {
15895
15893
  dirId = this.scope.resolve(this.node, this.dir);
15896
15894
  }
15897
- const outputField = ts76.factory.createElementAccessExpression(dirId, ts76.factory.createStringLiteral(field));
15898
- addParseSpanInfo(outputField, output.keySpan);
15895
+ const outputField = new TcbExpr(`${dirId.print()}[${quoteAndEscape(field)}]`);
15896
+ outputField.addParseSpanInfo(output.keySpan);
15899
15897
  if (this.tcb.env.config.checkTypeOfOutputEvents) {
15900
15898
  const handler = tcbCreateEventHandler(
15901
15899
  output,
@@ -15904,19 +15902,11 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15904
15902
  0
15905
15903
  /* EventParamType.Infer */
15906
15904
  );
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));
15905
+ const call = new TcbExpr(`${outputField.print()}.subscribe(${handler.print()})`);
15906
+ call.addParseSpanInfo(output.sourceSpan);
15907
+ this.scope.addStatement(call);
15918
15908
  } else {
15919
- this.scope.addStatement(ts76.factory.createExpressionStatement(outputField));
15909
+ this.scope.addStatement(outputField);
15920
15910
  const handler = tcbCreateEventHandler(
15921
15911
  output,
15922
15912
  this.tcb,
@@ -15924,7 +15914,7 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15924
15914
  1
15925
15915
  /* EventParamType.Any */
15926
15916
  );
15927
- this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15917
+ this.scope.addStatement(handler);
15928
15918
  }
15929
15919
  }
15930
15920
  return null;
@@ -15962,41 +15952,32 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
15962
15952
  }
15963
15953
  }
15964
15954
  if (output.type === ParsedEventType2.LegacyAnimation) {
15965
- const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
15955
+ const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalSymbol("@angular/animations", "AnimationEvent").print() : 1;
15966
15956
  const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
15967
- this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15957
+ this.scope.addStatement(handler);
15968
15958
  } 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));
15959
+ const eventType = this.tcb.env.referenceExternalSymbol("@angular/core", "AnimationCallbackEvent");
15960
+ const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType.print());
15961
+ this.scope.addStatement(handler);
15972
15962
  } else if (this.tcb.env.config.checkTypeOfDomEvents) {
15973
15963
  let target;
15974
15964
  let domEventAssertion;
15975
15965
  if (output.target === "window" || output.target === "document") {
15976
- target = ts76.factory.createIdentifier(output.target);
15966
+ target = new TcbExpr(output.target);
15977
15967
  } else if (elId === null) {
15978
15968
  target = elId = this.scope.resolve(this.target);
15979
15969
  } else {
15980
15970
  target = elId;
15981
15971
  }
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
- ]);
15972
+ if (this.target instanceof TmplAstElement6 && this.target.isVoid && this.tcb.env.config.allowDomEventAssertion) {
15973
+ const assertUtil = this.tcb.env.referenceExternalSymbol("@angular/core", "\u0275assertType");
15974
+ domEventAssertion = new TcbExpr(`${assertUtil.print()}<typeof ${target.print()}>(${EVENT_PARAMETER}.target)`);
15986
15975
  }
15987
- const propertyAccess = ts76.factory.createPropertyAccessExpression(target, "addEventListener");
15988
- addParseSpanInfo(propertyAccess, output.keySpan);
15976
+ const propertyAccess = new TcbExpr(`${target.print()}.addEventListener`).addParseSpanInfo(output.keySpan);
15989
15977
  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));
15978
+ const call = new TcbExpr(`${propertyAccess.print()}(${quoteAndEscape(output.name)}, ${handler.print()})`);
15979
+ call.addParseSpanInfo(output.sourceSpan);
15980
+ this.scope.addStatement(call);
16000
15981
  } else {
16001
15982
  const handler = tcbCreateEventHandler(
16002
15983
  output,
@@ -16005,7 +15986,7 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
16005
15986
  1
16006
15987
  /* EventParamType.Any */
16007
15988
  );
16008
- this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15989
+ this.scope.addStatement(handler);
16009
15990
  }
16010
15991
  }
16011
15992
  return null;
@@ -16014,9 +15995,7 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
16014
15995
  var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
16015
15996
  resolve(ast) {
16016
15997
  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;
15998
+ return new TcbExpr(EVENT_PARAMETER).addParseSpanInfo(ast.nameSpan);
16020
15999
  }
16021
16000
  return super.resolve(ast);
16022
16001
  }
@@ -16028,60 +16007,37 @@ function tcbCreateEventHandler(event, tcb, scope, eventType, assertionExpression
16028
16007
  const handler = tcbEventHandlerExpression(event.handler, tcb, scope);
16029
16008
  const statements = [];
16030
16009
  if (assertionExpression !== void 0) {
16031
- statements.push(ts76.factory.createExpressionStatement(assertionExpression));
16010
+ statements.push(assertionExpression);
16032
16011
  }
16033
16012
  if (event.type === ParsedEventType2.TwoWay && tcb.env.config.checkTwoWayBoundEvents) {
16034
16013
  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));
16014
+ const initializer = tcb.env.config.allowSignalsInTwoWayBindings ? unwrapWritableSignal(handler, tcb) : handler;
16015
+ statements.push(new TcbExpr(`var ${target} = ${initializer.print()}`), new TcbExpr(`${target} = ${EVENT_PARAMETER}`));
16037
16016
  } else {
16038
- statements.push(ts76.factory.createExpressionStatement(handler));
16017
+ statements.push(handler);
16039
16018
  }
16040
16019
  let eventParamType;
16041
16020
  if (eventType === 0) {
16042
16021
  eventParamType = void 0;
16043
16022
  } else if (eventType === 1) {
16044
- eventParamType = ts76.factory.createKeywordTypeNode(ts76.SyntaxKind.AnyKeyword);
16023
+ eventParamType = "any";
16045
16024
  } else {
16046
16025
  eventParamType = eventType;
16047
16026
  }
16048
16027
  const guards = scope.guards();
16049
- let body = ts76.factory.createBlock(statements);
16028
+ let body = `{
16029
+ ${getStatementsBlock(statements)} }`;
16050
16030
  if (guards !== null) {
16051
- body = ts76.factory.createBlock([ts76.factory.createIfStatement(guards, body)]);
16031
+ body = `{ if (${guards.print()}) ${body} }`;
16052
16032
  }
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
- );
16033
+ const eventParam = new TcbExpr(`${EVENT_PARAMETER}${eventParamType === void 0 ? "" : ": " + eventParamType}`);
16034
+ eventParam.addExpressionIdentifier(ExpressionIdentifier.EVENT_PARAMETER);
16035
+ return new TcbExpr(`(${eventParam.print()}): any => ${body}`);
16080
16036
  }
16081
16037
 
16082
16038
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/directive_type.js
16083
16039
  import { TmplAstHostElement as TmplAstHostElement3 } from "@angular/compiler";
16084
- import ts77 from "typescript";
16040
+ import ts64 from "typescript";
16085
16041
  var TcbDirectiveTypeOpBase = class extends TcbOp {
16086
16042
  tcb;
16087
16043
  scope;
@@ -16098,28 +16054,26 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
16098
16054
  return true;
16099
16055
  }
16100
16056
  execute() {
16101
- const dirRef = this.dir.ref;
16102
- const rawType = this.tcb.env.referenceType(this.dir.ref);
16057
+ const rawType = this.tcb.env.referenceTcbType(this.dir.ref);
16103
16058
  let type;
16104
16059
  let span;
16105
- if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
16106
- type = rawType;
16060
+ if (this.dir.isGeneric === false || this.dir.typeParameters === null || this.dir.typeParameters.length === 0) {
16061
+ type = new TcbExpr(tempPrint(rawType, this.tcb.env.contextFile));
16107
16062
  } else {
16108
- if (!ts77.isTypeReferenceNode(rawType)) {
16109
- throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
16063
+ if (!ts64.isTypeReferenceNode(rawType)) {
16064
+ throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.name}`);
16110
16065
  }
16111
- const typeArguments = dirRef.node.typeParameters.map(() => ts77.factory.createKeywordTypeNode(ts77.SyntaxKind.AnyKeyword));
16112
- type = ts77.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
16066
+ const typeName = ts64.isIdentifier(rawType.typeName) ? rawType.typeName.text : tempPrint(rawType.typeName, this.tcb.env.contextFile);
16067
+ const typeArguments = Array(this.dir.typeParameters?.length ?? 0).fill("any").join(", ");
16068
+ type = new TcbExpr(`${typeName}<${typeArguments}>`);
16113
16069
  }
16114
16070
  if (this.node instanceof TmplAstHostElement3) {
16115
16071
  span = this.node.sourceSpan;
16116
16072
  } else {
16117
16073
  span = this.node.startSourceSpan || this.node.sourceSpan;
16118
16074
  }
16119
- const id = this.tcb.allocateId();
16120
- addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
16121
- addParseSpanInfo(id, span);
16122
- this.scope.addStatement(tsDeclareVariable(id, type));
16075
+ const id = new TcbExpr(this.tcb.allocateId()).addExpressionIdentifier(ExpressionIdentifier.DIRECTIVE).addParseSpanInfo(span);
16076
+ this.scope.addStatement(declareVariable(id, type));
16123
16077
  return id;
16124
16078
  }
16125
16079
  };
@@ -16129,18 +16083,16 @@ var TcbNonGenericDirectiveTypeOp = class extends TcbDirectiveTypeOpBase {
16129
16083
  * the newly created variable.
16130
16084
  */
16131
16085
  execute() {
16132
- const dirRef = this.dir.ref;
16133
16086
  if (this.dir.isGeneric) {
16134
- throw new Error(`Assertion Error: expected ${dirRef.debugName} not to be generic.`);
16087
+ throw new Error(`Assertion Error: expected ${this.dir.ref.name} not to be generic.`);
16135
16088
  }
16136
16089
  return super.execute();
16137
16090
  }
16138
16091
  };
16139
16092
  var TcbGenericDirectiveTypeWithAnyParamsOp = class extends TcbDirectiveTypeOpBase {
16140
16093
  execute() {
16141
- const dirRef = this.dir.ref;
16142
- if (dirRef.node.typeParameters === void 0) {
16143
- throw new Error(`Assertion Error: expected typeParameters when creating a declaration for ${dirRef.debugName}`);
16094
+ if (this.dir.typeParameters === null || this.dir.typeParameters.length === 0) {
16095
+ throw new Error(`Assertion Error: expected typeParameters when creating a declaration for ${this.dir.ref.name}`);
16144
16096
  }
16145
16097
  return super.execute();
16146
16098
  }
@@ -16148,7 +16100,6 @@ var TcbGenericDirectiveTypeWithAnyParamsOp = class extends TcbDirectiveTypeOpBas
16148
16100
 
16149
16101
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/directive_constructor.js
16150
16102
  import { TmplAstHostElement as TmplAstHostElement4 } from "@angular/compiler";
16151
- import ts78 from "typescript";
16152
16103
  var TcbDirectiveCtorOp = class extends TcbOp {
16153
16104
  tcb;
16154
16105
  scope;
@@ -16168,7 +16119,7 @@ var TcbDirectiveCtorOp = class extends TcbOp {
16168
16119
  }
16169
16120
  execute() {
16170
16121
  const genericInputs = /* @__PURE__ */ new Map();
16171
- const id = this.tcb.allocateId();
16122
+ const id = new TcbExpr(this.tcb.allocateId());
16172
16123
  let boundAttrs;
16173
16124
  let span;
16174
16125
  if (this.node instanceof TmplAstHostElement4) {
@@ -16184,8 +16135,7 @@ var TcbDirectiveCtorOp = class extends TcbOp {
16184
16135
  }
16185
16136
  }
16186
16137
  }
16187
- addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
16188
- addParseSpanInfo(id, span);
16138
+ id.addExpressionIdentifier(ExpressionIdentifier.DIRECTIVE).addParseSpanInfo(span);
16189
16139
  for (const attr of boundAttrs) {
16190
16140
  if (!this.tcb.env.config.checkTypeOfAttributes && typeof attr.value === "string") {
16191
16141
  continue;
@@ -16199,6 +16149,7 @@ var TcbDirectiveCtorOp = class extends TcbOp {
16199
16149
  type: "binding",
16200
16150
  field: fieldName,
16201
16151
  expression,
16152
+ originalExpression: attr.value,
16202
16153
  sourceSpan: attr.sourceSpan,
16203
16154
  isTwoWayBinding
16204
16155
  });
@@ -16210,8 +16161,8 @@ var TcbDirectiveCtorOp = class extends TcbOp {
16210
16161
  }
16211
16162
  }
16212
16163
  const typeCtor = tcbCallTypeCtor(this.dir, this.tcb, Array.from(genericInputs.values()));
16213
- markIgnoreDiagnostics(typeCtor);
16214
- this.scope.addStatement(tsCreateVariable(id, typeCtor));
16164
+ typeCtor.markIgnoreDiagnostics();
16165
+ this.scope.addStatement(new TcbExpr(`var ${id.print()} = ${typeCtor.print()}`));
16215
16166
  return id;
16216
16167
  }
16217
16168
  circularFallback() {
@@ -16234,45 +16185,37 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
16234
16185
  execute() {
16235
16186
  const id = this.tcb.allocateId();
16236
16187
  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;
16188
+ this.scope.addStatement(new TcbExpr(`var ${id} = ${typeCtor.print()}(null!)`));
16189
+ return new TcbExpr(id);
16245
16190
  }
16246
16191
  };
16247
16192
  function tcbCallTypeCtor(dir, tcb, inputs) {
16248
16193
  const typeCtor = tcb.env.typeCtorFor(dir);
16249
- const members = inputs.map((input) => {
16250
- const propertyName = ts78.factory.createStringLiteral(input.field);
16194
+ let literal4 = "{ ";
16195
+ for (let i = 0; i < inputs.length; i++) {
16196
+ const input = inputs[i];
16197
+ const propertyName = quoteAndEscape(input.field);
16198
+ const isLast = i === inputs.length - 1;
16251
16199
  if (input.type === "binding") {
16252
- let expr = widenBinding(input.expression, tcb);
16200
+ let expr = widenBinding(input.expression, tcb, input.originalExpression);
16253
16201
  if (input.isTwoWayBinding && tcb.env.config.allowSignalsInTwoWayBindings) {
16254
16202
  expr = unwrapWritableSignal(expr, tcb);
16255
16203
  }
16256
- const assignment = ts78.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
16257
- addParseSpanInfo(assignment, input.sourceSpan);
16258
- return assignment;
16204
+ const assignment = new TcbExpr(`${propertyName}: ${expr.wrapForTypeChecker().print()}`);
16205
+ assignment.addParseSpanInfo(input.sourceSpan);
16206
+ literal4 += assignment.print();
16259
16207
  } else {
16260
- return ts78.factory.createPropertyAssignment(propertyName, getAnyExpression());
16208
+ literal4 += `${propertyName}: 0 as any`;
16261
16209
  }
16262
- });
16263
- return ts78.factory.createCallExpression(
16264
- /* expression */
16265
- typeCtor,
16266
- /* typeArguments */
16267
- void 0,
16268
- /* argumentsArray */
16269
- [ts78.factory.createObjectLiteralExpression(members)]
16270
- );
16210
+ literal4 += `${isLast ? "" : ","} `;
16211
+ }
16212
+ literal4 += "}";
16213
+ return new TcbExpr(`${typeCtor.print()}(${literal4})`);
16271
16214
  }
16272
16215
 
16273
16216
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/content_projection.js
16274
16217
  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";
16218
+ import ts65 from "typescript";
16276
16219
  var TcbControlFlowContentProjectionOp = class extends TcbOp {
16277
16220
  tcb;
16278
16221
  element;
@@ -16285,7 +16228,7 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
16285
16228
  this.element = element;
16286
16229
  this.ngContentSelectors = ngContentSelectors;
16287
16230
  this.componentName = componentName;
16288
- this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ? ts79.DiagnosticCategory.Error : ts79.DiagnosticCategory.Warning;
16231
+ this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ? ts65.DiagnosticCategory.Error : ts65.DiagnosticCategory.Warning;
16289
16232
  }
16290
16233
  optional = false;
16291
16234
  execute() {
@@ -16353,7 +16296,6 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
16353
16296
  };
16354
16297
 
16355
16298
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/intersection_observer.js
16356
- import ts80 from "typescript";
16357
16299
  var TcbIntersectionObserverOp = class extends TcbOp {
16358
16300
  tcb;
16359
16301
  scope;
@@ -16367,9 +16309,7 @@ var TcbIntersectionObserverOp = class extends TcbOp {
16367
16309
  optional = false;
16368
16310
  execute() {
16369
16311
  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));
16312
+ this.scope.addStatement(new TcbExpr(`new IntersectionObserver(null!, ${options.print()})`));
16373
16313
  return null;
16374
16314
  }
16375
16315
  };
@@ -16388,10 +16328,16 @@ var TcbHostElementOp = class extends TcbOp {
16388
16328
  }
16389
16329
  execute() {
16390
16330
  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;
16331
+ let tagNames;
16332
+ if (this.element.tagNames.length === 1) {
16333
+ tagNames = `"${this.element.tagNames[0]}"`;
16334
+ } else {
16335
+ tagNames = `null! as ${this.element.tagNames.map((t) => `"${t}"`).join(" | ")}`;
16336
+ }
16337
+ const initializer = new TcbExpr(`document.createElement(${tagNames})`);
16338
+ initializer.addParseSpanInfo(this.element.sourceSpan);
16339
+ this.scope.addStatement(new TcbExpr(`var ${id} = ${initializer.print()}`));
16340
+ return new TcbExpr(id);
16395
16341
  }
16396
16342
  };
16397
16343
 
@@ -16403,7 +16349,7 @@ var Scope = class _Scope {
16403
16349
  /**
16404
16350
  * A queue of operations which need to be performed to generate the TCB code for this scope.
16405
16351
  *
16406
- * This array can contain either a `TcbOp` which has yet to be executed, or a `ts.Expression|null`
16352
+ * This array can contain either a `TcbOp` which has yet to be executed, or a `TcbExpr|null`
16407
16353
  * representing the memoized result of executing the operation. As operations are executed, their
16408
16354
  * results are written into the `opQueue`, overwriting the original operation.
16409
16355
  *
@@ -16463,12 +16409,12 @@ var Scope = class _Scope {
16463
16409
  */
16464
16410
  static getForLoopContextVariableTypes() {
16465
16411
  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]
16412
+ ["$first", "boolean"],
16413
+ ["$last", "boolean"],
16414
+ ["$even", "boolean"],
16415
+ ["$odd", "boolean"],
16416
+ ["$index", "number"],
16417
+ ["$count", "number"]
16472
16418
  ]);
16473
16419
  }
16474
16420
  constructor(tcb, parent = null, guard = null) {
@@ -16509,15 +16455,15 @@ var Scope = class _Scope {
16509
16455
  _Scope.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
16510
16456
  }
16511
16457
  } else if (scopedNode instanceof TmplAstForLoopBlock2) {
16512
- const loopInitializer = tcb.allocateId();
16513
- addParseSpanInfo(loopInitializer, scopedNode.item.sourceSpan);
16458
+ const loopInitializer = new TcbExpr(tcb.allocateId());
16459
+ loopInitializer.addParseSpanInfo(scopedNode.item.sourceSpan);
16514
16460
  scope.varMap.set(scopedNode.item, loopInitializer);
16515
16461
  const forLoopContextVariableTypes = _Scope.getForLoopContextVariableTypes();
16516
16462
  for (const variable of scopedNode.contextVariables) {
16517
16463
  if (!forLoopContextVariableTypes.has(variable.value)) {
16518
16464
  throw new Error(`Unrecognized for loop context variable ${variable.name}`);
16519
16465
  }
16520
- const type = ts81.factory.createKeywordTypeNode(forLoopContextVariableTypes.get(variable.value));
16466
+ const type = new TcbExpr(forLoopContextVariableTypes.get(variable.value));
16521
16467
  _Scope.registerVariable(scope, variable, new TcbBlockImplicitVariableOp(tcb, scope, type, variable));
16522
16468
  }
16523
16469
  } else if (scopedNode instanceof TmplAstHostElement5) {
@@ -16563,17 +16509,7 @@ var Scope = class _Scope {
16563
16509
  resolve(node, directive) {
16564
16510
  const res = this.resolveLocal(node, directive);
16565
16511
  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, []);
16512
+ return res;
16577
16513
  } else if (this.parent !== null) {
16578
16514
  return this.parent.resolve(node, directive);
16579
16515
  } else {
@@ -16608,9 +16544,10 @@ var Scope = class _Scope {
16608
16544
  if (this.guard === null) {
16609
16545
  return parentGuards;
16610
16546
  } else if (parentGuards === null) {
16611
- return this.guard;
16547
+ return typeof this.guard === "string" ? new TcbExpr(this.guard) : this.guard;
16612
16548
  } else {
16613
- return ts81.factory.createBinaryExpression(parentGuards, ts81.SyntaxKind.AmpersandAmpersandToken, this.guard);
16549
+ const guard = typeof this.guard === "string" ? this.guard : this.guard.print();
16550
+ return new TcbExpr(`(${parentGuards.print()}) && (${guard})`);
16614
16551
  }
16615
16552
  }
16616
16553
  /** Returns whether a template symbol is defined locally within the current scope. */
@@ -16644,7 +16581,10 @@ var Scope = class _Scope {
16644
16581
  return this.resolveOp(this.letDeclOpMap.get(ref.name).opIndex);
16645
16582
  } else if (ref instanceof TmplAstVariable2 && this.varMap.has(ref)) {
16646
16583
  const opIndexOrNode = this.varMap.get(ref);
16647
- return typeof opIndexOrNode === "number" ? this.resolveOp(opIndexOrNode) : opIndexOrNode;
16584
+ return typeof opIndexOrNode === "number" ? this.resolveOp(opIndexOrNode) : new TcbExpr(opIndexOrNode.print(
16585
+ true
16586
+ /* ignoreComments */
16587
+ ));
16648
16588
  } else if (ref instanceof TmplAstTemplate5 && directive === void 0 && this.templateCtxOpMap.has(ref)) {
16649
16589
  return this.resolveOp(this.templateCtxOpMap.get(ref));
16650
16590
  } 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 +16601,7 @@ var Scope = class _Scope {
16661
16601
  }
16662
16602
  }
16663
16603
  /**
16664
- * Like `executeOp`, but assert that the operation actually returned `ts.Expression`.
16604
+ * Like `executeOp`, but assert that the operation actually returned `TcbExpr`.
16665
16605
  */
16666
16606
  resolveOp(opIndex) {
16667
16607
  const res = this.executeOp(
@@ -16684,13 +16624,22 @@ var Scope = class _Scope {
16684
16624
  executeOp(opIndex, skipOptional) {
16685
16625
  const op = this.opQueue[opIndex];
16686
16626
  if (!(op instanceof TcbOp)) {
16687
- return op;
16627
+ return op === null ? null : new TcbExpr(op.print(
16628
+ true
16629
+ /* ignoreComments */
16630
+ ));
16688
16631
  }
16689
16632
  if (skipOptional && op.optional) {
16690
16633
  return null;
16691
16634
  }
16692
16635
  this.opQueue[opIndex] = op.circularFallback();
16693
- const res = op.execute();
16636
+ let res = op.execute();
16637
+ if (res !== null) {
16638
+ res = new TcbExpr(res.print(
16639
+ true
16640
+ /* ignoreComments */
16641
+ ));
16642
+ }
16694
16643
  this.opQueue[opIndex] = res;
16695
16644
  return res;
16696
16645
  }
@@ -16887,10 +16836,9 @@ var Scope = class _Scope {
16887
16836
  this.opQueue.push(new TcbDirectiveInputsOp(this.tcb, this, node, dir, nodeIsFormControl, customFormControlType));
16888
16837
  }
16889
16838
  getDirectiveOp(dir, node, customFieldType) {
16890
- const dirRef = dir.ref;
16891
16839
  if (!dir.isGeneric) {
16892
16840
  return new TcbNonGenericDirectiveTypeOp(this.tcb, this, node, dir);
16893
- } else if (!requiresInlineTypeCtor(dirRef.node, this.tcb.env.reflector, this.tcb.env) || this.tcb.env.config.useInlineTypeConstructors) {
16841
+ } else if (!dir.hasRequiresInlineTypeCtor || this.tcb.env.config.useInlineTypeConstructors) {
16894
16842
  return new TcbDirectiveCtorOp(this.tcb, this, node, dir, customFieldType);
16895
16843
  }
16896
16844
  return new TcbGenericDirectiveTypeWithAnyParamsOp(this.tcb, this, node, dir);
@@ -17067,33 +17015,39 @@ var Scope = class _Scope {
17067
17015
  };
17068
17016
 
17069
17017
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js
17070
- function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
17018
+ function generateTypeCheckBlock(env, component, name, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
17071
17019
  const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone, meta.preserveWhitespaces);
17072
- const ctxRawType = env.referenceType(ref);
17073
- if (!ts82.isTypeReferenceNode(ctxRawType)) {
17074
- throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
17020
+ const ctxRawType = env.referenceTcbType(component.ref);
17021
+ if (!ts66.isTypeReferenceNode(ctxRawType)) {
17022
+ throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${component.ref.name}`);
17075
17023
  }
17076
17024
  let typeParameters = void 0;
17077
17025
  let typeArguments = void 0;
17078
- if (ref.node.typeParameters !== void 0) {
17026
+ if (component.typeParameters !== void 0) {
17079
17027
  if (!env.config.useContextGenericType) {
17080
17028
  genericContextBehavior = TcbGenericContextBehavior.FallbackToAny;
17081
17029
  }
17082
17030
  switch (genericContextBehavior) {
17083
17031
  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));
17032
+ const emittedParams = component.typeParameters || [];
17033
+ typeParameters = emittedParams;
17034
+ typeArguments = typeParameters.map((param) => param.name);
17086
17035
  break;
17087
17036
  case TcbGenericContextBehavior.CopyClassNodes:
17088
- typeParameters = [...ref.node.typeParameters];
17089
- typeArguments = typeParameters.map((param) => ts82.factory.createTypeReferenceNode(param.name));
17037
+ const copiedParams = component.typeParameters ? [...component.typeParameters] : [];
17038
+ typeParameters = copiedParams;
17039
+ typeArguments = typeParameters.map((param) => param.name);
17090
17040
  break;
17091
17041
  case TcbGenericContextBehavior.FallbackToAny:
17092
- typeArguments = ref.node.typeParameters.map(() => ts82.factory.createKeywordTypeNode(ts82.SyntaxKind.AnyKeyword));
17042
+ typeArguments = Array.from({ length: component.typeParameters?.length ?? 0 }).map(() => "any");
17093
17043
  break;
17094
17044
  }
17095
17045
  }
17096
- const paramList = [tcbThisParam(ctxRawType.typeName, typeArguments)];
17046
+ const sourceFile = env.contextFile;
17047
+ const typeParamsStr = typeParameters === void 0 || typeParameters.length === 0 ? "" : `<${typeParameters.map((p) => p.representation).join(", ")}>`;
17048
+ const typeArgsStr = typeArguments === void 0 || typeArguments.length === 0 ? "" : `<${typeArguments.join(", ")}>`;
17049
+ const typeRef = ts66.isIdentifier(ctxRawType.typeName) ? ctxRawType.typeName.text : tempPrint(ctxRawType.typeName, sourceFile);
17050
+ const thisParamStr = `this: ${typeRef}${typeArgsStr}`;
17097
17051
  const statements = [];
17098
17052
  if (tcb.boundTarget.target.template !== void 0) {
17099
17053
  const templateScope = Scope.forNodes(
@@ -17104,58 +17058,32 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
17104
17058
  /* guard */
17105
17059
  null
17106
17060
  );
17107
- statements.push(renderBlockStatements(env, templateScope, ts82.factory.createTrue()));
17061
+ statements.push(renderBlockStatements(env, templateScope, "true"));
17108
17062
  }
17109
17063
  if (tcb.boundTarget.target.host !== void 0) {
17110
17064
  const hostScope = Scope.forNodes(tcb, null, tcb.boundTarget.target.host.node, null, null);
17111
17065
  statements.push(renderBlockStatements(env, hostScope, createHostBindingsBlockGuard()));
17112
17066
  }
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;
17067
+ const bodyStr = `{
17068
+ ${statements.join("\n")}
17069
+ }`;
17070
+ const funcDeclStr = `function ${name.text}${typeParamsStr}(${thisParamStr}) ${bodyStr}`;
17071
+ return `/*${meta.id}*/
17072
+ ${funcDeclStr}`;
17132
17073
  }
17133
17074
  function renderBlockStatements(env, scope, wrapperExpression) {
17134
17075
  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
- );
17076
+ const statements = getStatementsBlock([...env.getPreludeStatements(), ...scopeStatements]);
17077
+ return `if (${wrapperExpression}) {
17078
+ ${statements}
17079
+ }`;
17153
17080
  }
17154
17081
 
17155
17082
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.js
17156
- import ts83 from "typescript";
17083
+ import ts67 from "typescript";
17157
17084
  var TypeCheckFile = class extends Environment {
17158
17085
  fileName;
17086
+ isTypeCheckFile = true;
17159
17087
  nextTcbId = 1;
17160
17088
  tcbStatements = [];
17161
17089
  constructor(fileName, config, refEmitter, reflector, compilerHost) {
@@ -17165,36 +17093,33 @@ var TypeCheckFile = class extends Environment {
17165
17093
  // Type check block code affects code completion and fix suggestions.
17166
17094
  // We want to encourage single quotes for now, like we always did.
17167
17095
  shouldUseSingleQuotes: () => true
17168
- }), refEmitter, reflector, ts83.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts83.ScriptTarget.Latest, true));
17096
+ }), refEmitter, reflector, ts67.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts67.ScriptTarget.Latest, true));
17169
17097
  this.fileName = fileName;
17170
17098
  }
17171
17099
  addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
17172
- const fnId = ts83.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
17173
- const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
17100
+ const fnId = ts67.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
17101
+ const { tcbMeta, component } = adaptTypeCheckBlockMetadata(ref, meta, this);
17102
+ const fn = generateTypeCheckBlock(this, component, fnId, tcbMeta, domSchemaChecker, oobRecorder, genericContextBehavior);
17174
17103
  this.tcbStatements.push(fn);
17175
17104
  }
17176
- render(removeComments) {
17105
+ render() {
17177
17106
  ensureTypeCheckFilePreparationImports(this);
17178
17107
  const importChanges = this.importManager.finalize();
17179
17108
  if (importChanges.updatedImports.size > 0) {
17180
17109
  throw new Error("AssertionError: Expected no imports to be updated for a new type check file.");
17181
17110
  }
17182
- const printer = ts83.createPrinter({ removeComments });
17111
+ const printer = ts67.createPrinter();
17183
17112
  let source = "";
17184
17113
  const newImports = importChanges.newImports.get(this.contextFile.fileName);
17185
17114
  if (newImports !== void 0) {
17186
- source += newImports.map((i) => printer.printNode(ts83.EmitHint.Unspecified, i, this.contextFile)).join("\n");
17115
+ source += newImports.map((i) => printer.printNode(ts67.EmitHint.Unspecified, i, this.contextFile)).join("\n");
17187
17116
  }
17188
17117
  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
- }
17118
+ source += getStatementsBlock(this.pipeInstStatements);
17119
+ source += getStatementsBlock(this.typeCtorStatements);
17195
17120
  source += "\n";
17196
17121
  for (const stmt of this.tcbStatements) {
17197
- source += printer.printNode(ts83.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
17122
+ source += stmt + "\n";
17198
17123
  }
17199
17124
  source += "\nexport const IS_A_MODULE = true;\n";
17200
17125
  return source;
@@ -17278,9 +17203,8 @@ var TypeCheckContextImpl = class {
17278
17203
  // it comes from a .d.ts file. .d.ts declarations don't have bodies.
17279
17204
  body: !dirNode.getSourceFile().isDeclarationFile,
17280
17205
  fields: {
17281
- inputs: dir.inputs,
17206
+ inputs: dir.inputs
17282
17207
  // TODO(alxhub): support queries
17283
- queries: dir.queries
17284
17208
  },
17285
17209
  coercedInputFields: dir.coercedInputFields
17286
17210
  });
@@ -17360,7 +17284,7 @@ var TypeCheckContextImpl = class {
17360
17284
  if (!this.opMap.has(sf)) {
17361
17285
  return null;
17362
17286
  }
17363
- const printer = ts84.createPrinter({ omitTrailingSemicolon: true });
17287
+ const printer = ts68.createPrinter({ omitTrailingSemicolon: true });
17364
17288
  const importManager = new ImportManager({
17365
17289
  // This minimizes noticeable changes with older versions of `ImportManager`.
17366
17290
  forceGenerateNamespacesForNewImports: true,
@@ -17371,7 +17295,7 @@ var TypeCheckContextImpl = class {
17371
17295
  const updates = this.opMap.get(sf).map((op) => {
17372
17296
  return {
17373
17297
  pos: op.splitPoint,
17374
- text: op.execute(importManager, sf, this.refEmitter, printer)
17298
+ text: op.execute(importManager, sf, this.refEmitter)
17375
17299
  };
17376
17300
  });
17377
17301
  const { newImports, updatedImports } = importManager.finalize();
@@ -17379,7 +17303,7 @@ var TypeCheckContextImpl = class {
17379
17303
  newImports.get(sf.fileName).forEach((newImport) => {
17380
17304
  updates.push({
17381
17305
  pos: 0,
17382
- text: printer.printNode(ts84.EmitHint.Unspecified, newImport, sf)
17306
+ text: printer.printNode(ts68.EmitHint.Unspecified, newImport, sf)
17383
17307
  });
17384
17308
  });
17385
17309
  }
@@ -17390,7 +17314,7 @@ var TypeCheckContextImpl = class {
17390
17314
  updates.push({
17391
17315
  pos: oldBindings.getStart(),
17392
17316
  deletePos: oldBindings.getEnd(),
17393
- text: printer.printNode(ts84.EmitHint.Unspecified, newBindings, sf)
17317
+ text: printer.printNode(ts68.EmitHint.Unspecified, newBindings, sf)
17394
17318
  });
17395
17319
  }
17396
17320
  const result = new MagicString(sf.text, { filename: sf.fileName });
@@ -17424,10 +17348,7 @@ var TypeCheckContextImpl = class {
17424
17348
  path: pendingShimData.file.fileName,
17425
17349
  data: pendingShimData.data
17426
17350
  });
17427
- const sfText = pendingShimData.file.render(
17428
- false
17429
- /* removeComments */
17430
- );
17351
+ const sfText = pendingShimData.file.render();
17431
17352
  updates.set(pendingShimData.file.fileName, {
17432
17353
  newText: sfText,
17433
17354
  // Shim files do not have an associated original file.
@@ -17452,7 +17373,7 @@ var TypeCheckContextImpl = class {
17452
17373
  if (!fileData.shimData.has(shimPath)) {
17453
17374
  fileData.shimData.set(shimPath, {
17454
17375
  domSchemaChecker: new RegistryDomSchemaChecker(fileData.sourceManager),
17455
- oobRecorder: new OutOfBandDiagnosticRecorderImpl(fileData.sourceManager),
17376
+ oobRecorder: new OutOfBandDiagnosticRecorderImpl(fileData.sourceManager, (name) => this.compilerHost.getSourceFile(name, ts68.ScriptTarget.Latest)),
17456
17377
  file: new TypeCheckFile(shimPath, this.config, this.refEmitter, this.reflector, this.compilerHost),
17457
17378
  data: /* @__PURE__ */ new Map()
17458
17379
  });
@@ -17478,7 +17399,7 @@ function getTemplateDiagnostics(parseErrors, templateId, sourceMapping) {
17478
17399
  if (span.start.offset === span.end.offset) {
17479
17400
  span.end.offset++;
17480
17401
  }
17481
- return makeTemplateDiagnostic(templateId, sourceMapping, span, ts84.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
17402
+ return makeTemplateDiagnostic(templateId, sourceMapping, span, ts68.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
17482
17403
  });
17483
17404
  }
17484
17405
  var InlineTcbOp = class {
@@ -17502,11 +17423,12 @@ var InlineTcbOp = class {
17502
17423
  get splitPoint() {
17503
17424
  return this.ref.node.end + 1;
17504
17425
  }
17505
- execute(im, sf, refEmitter, printer) {
17426
+ execute(im, sf, refEmitter) {
17506
17427
  const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
17507
- const fnName = ts84.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
17508
- const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
17509
- return printer.printNode(ts84.EmitHint.Unspecified, fn, sf);
17428
+ const fnName = ts68.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
17429
+ const { tcbMeta, component } = adaptTypeCheckBlockMetadata(this.ref, this.meta, env);
17430
+ const fn = generateTypeCheckBlock(env, component, fnName, tcbMeta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
17431
+ return fn;
17510
17432
  }
17511
17433
  };
17512
17434
  var TypeCtorOp = class {
@@ -17524,13 +17446,49 @@ var TypeCtorOp = class {
17524
17446
  get splitPoint() {
17525
17447
  return this.ref.node.end - 1;
17526
17448
  }
17527
- execute(im, sf, refEmitter, printer) {
17449
+ execute(im, sf, refEmitter) {
17528
17450
  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);
17451
+ return generateInlineTypeCtor(emitEnv, this.ref.node, this.meta);
17531
17452
  }
17532
17453
  };
17533
17454
 
17455
+ // packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.js
17456
+ import { AbsoluteSourceSpan as AbsoluteSourceSpan6 } from "@angular/compiler";
17457
+ import ts69 from "typescript";
17458
+ function shouldReportDiagnostic(diagnostic) {
17459
+ const { code } = diagnostic;
17460
+ if (code === 6133) {
17461
+ return false;
17462
+ } else if (code === 6199) {
17463
+ return false;
17464
+ } else if (code === 2695) {
17465
+ return false;
17466
+ } else if (code === 7006) {
17467
+ return false;
17468
+ }
17469
+ return true;
17470
+ }
17471
+ function translateDiagnostic(diagnostic, resolver) {
17472
+ if (diagnostic.file === void 0 || diagnostic.start === void 0) {
17473
+ return null;
17474
+ }
17475
+ const fullMapping = getSourceMapping(
17476
+ diagnostic.file,
17477
+ diagnostic.start,
17478
+ resolver,
17479
+ /*isDiagnosticsRequest*/
17480
+ true
17481
+ );
17482
+ if (fullMapping === null) {
17483
+ return null;
17484
+ }
17485
+ const { sourceLocation, sourceMapping: templateSourceMapping, span } = fullMapping;
17486
+ return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText, void 0, diagnostic.reportsDeprecated !== void 0 ? {
17487
+ reportsDeprecated: diagnostic.reportsDeprecated,
17488
+ relatedMessages: diagnostic.relatedInformation
17489
+ } : void 0);
17490
+ }
17491
+
17534
17492
  // packages/compiler-cli/src/ngtsc/typecheck/src/source.js
17535
17493
  import { ParseLocation as ParseLocation2, ParseSourceSpan as ParseSourceSpan3 } from "@angular/compiler";
17536
17494
 
@@ -17649,7 +17607,7 @@ var DirectiveSourceManager = class {
17649
17607
 
17650
17608
  // packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.js
17651
17609
  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";
17610
+ import ts70 from "typescript";
17653
17611
  var SymbolBuilder = class {
17654
17612
  tcbPath;
17655
17613
  tcbIsShim;
@@ -17706,7 +17664,7 @@ var SymbolBuilder = class {
17706
17664
  const elementSourceSpan = element.startSourceSpan ?? element.sourceSpan;
17707
17665
  const node = findFirstMatchingNode(this.typeCheckBlock, {
17708
17666
  withSpan: elementSourceSpan,
17709
- filter: ts85.isVariableDeclaration
17667
+ filter: ts70.isVariableDeclaration
17710
17668
  });
17711
17669
  if (node === null) {
17712
17670
  return null;
@@ -17763,7 +17721,7 @@ var SymbolBuilder = class {
17763
17721
  const seenDirectives = /* @__PURE__ */ new Set();
17764
17722
  for (const node of nodes) {
17765
17723
  const symbol = this.getSymbolOfTsNode(node.parent);
17766
- if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts85.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17724
+ if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts70.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17767
17725
  continue;
17768
17726
  }
17769
17727
  const declaration = symbol.tsSymbol.valueDeclaration;
@@ -17798,7 +17756,7 @@ var SymbolBuilder = class {
17798
17756
  throw new Error("Impossible state: typecheck code path in local compilation mode.");
17799
17757
  }
17800
17758
  const node = current.directive.node;
17801
- if (!ts85.isClassDeclaration(node) || seenDirectives.has(node)) {
17759
+ if (!ts70.isClassDeclaration(node) || seenDirectives.has(node)) {
17802
17760
  continue;
17803
17761
  }
17804
17762
  const symbol = this.getSymbolOfTsNode(node);
@@ -17846,7 +17804,7 @@ var SymbolBuilder = class {
17846
17804
  if (directives === null) {
17847
17805
  return null;
17848
17806
  }
17849
- const directive = directives.find((m) => m.ref.node === directiveDeclaration);
17807
+ const directive = directives.find((m) => isSameDirectiveDeclaration(m.ref.node, directiveDeclaration));
17850
17808
  if (directive) {
17851
17809
  return directive;
17852
17810
  }
@@ -17856,7 +17814,7 @@ var SymbolBuilder = class {
17856
17814
  if (hasPotentialCandidate) {
17857
17815
  const classWithSameName = findMatchingDirective(originalFile, directiveDeclaration);
17858
17816
  if (classWithSameName !== null) {
17859
- return directives.find((m) => m.ref.node === classWithSameName) ?? null;
17817
+ return directives.find((m) => isSameDirectiveDeclaration(m.ref.node, classWithSameName)) ?? null;
17860
17818
  }
17861
17819
  }
17862
17820
  }
@@ -17888,10 +17846,10 @@ var SymbolBuilder = class {
17888
17846
  if (!isAccessExpression(n2)) {
17889
17847
  return false;
17890
17848
  }
17891
- if (ts85.isPropertyAccessExpression(n2)) {
17849
+ if (ts70.isPropertyAccessExpression(n2)) {
17892
17850
  return n2.name.getText() === expectedAccess;
17893
17851
  } else {
17894
- return ts85.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
17852
+ return ts70.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
17895
17853
  }
17896
17854
  }
17897
17855
  const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, {
@@ -17901,7 +17859,7 @@ var SymbolBuilder = class {
17901
17859
  const bindings = [];
17902
17860
  for (const outputFieldAccess of outputFieldAccesses) {
17903
17861
  if (consumer instanceof TmplAstTemplate6 || consumer instanceof TmplAstElement9) {
17904
- if (!ts85.isPropertyAccessExpression(outputFieldAccess)) {
17862
+ if (!ts70.isPropertyAccessExpression(outputFieldAccess)) {
17905
17863
  continue;
17906
17864
  }
17907
17865
  const addEventListener = outputFieldAccess.name;
@@ -17924,7 +17882,7 @@ var SymbolBuilder = class {
17924
17882
  }
17925
17883
  });
17926
17884
  } else {
17927
- if (!ts85.isElementAccessExpression(outputFieldAccess)) {
17885
+ if (!ts70.isElementAccessExpression(outputFieldAccess)) {
17928
17886
  continue;
17929
17887
  }
17930
17888
  const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
@@ -17977,7 +17935,7 @@ var SymbolBuilder = class {
17977
17935
  let fieldAccessExpr;
17978
17936
  let symbolInfo = null;
17979
17937
  if (signalInputAssignment !== null) {
17980
- if (ts85.isIdentifier(signalInputAssignment.fieldExpr)) {
17938
+ if (ts70.isIdentifier(signalInputAssignment.fieldExpr)) {
17981
17939
  continue;
17982
17940
  }
17983
17941
  const fieldSymbol = this.getSymbolOfTsNode(signalInputAssignment.fieldExpr);
@@ -18017,7 +17975,7 @@ var SymbolBuilder = class {
18017
17975
  return null;
18018
17976
  }
18019
17977
  const [declaration] = tsSymbol.declarations;
18020
- if (!ts85.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
17978
+ if (!ts70.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
18021
17979
  // The expression identifier could be on the type (for regular directives) or the name
18022
17980
  // (for generic directives and the ctor op).
18023
17981
  declaration.getSourceFile(),
@@ -18027,7 +17985,7 @@ var SymbolBuilder = class {
18027
17985
  return null;
18028
17986
  }
18029
17987
  const symbol = this.getSymbolOfTsNode(declaration);
18030
- if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts85.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17988
+ if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts70.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
18031
17989
  return null;
18032
17990
  }
18033
17991
  const ref = new Reference(symbol.tsSymbol.valueDeclaration);
@@ -18051,13 +18009,13 @@ var SymbolBuilder = class {
18051
18009
  getSymbolOfVariable(variable) {
18052
18010
  const node = findFirstMatchingNode(this.typeCheckBlock, {
18053
18011
  withSpan: variable.sourceSpan,
18054
- filter: ts85.isVariableDeclaration
18012
+ filter: ts70.isVariableDeclaration
18055
18013
  });
18056
18014
  if (node === null) {
18057
18015
  return null;
18058
18016
  }
18059
18017
  let nodeValueSymbol = null;
18060
- if (ts85.isForOfStatement(node.parent.parent)) {
18018
+ if (ts70.isForOfStatement(node.parent.parent)) {
18061
18019
  nodeValueSymbol = this.getSymbolOfTsNode(node);
18062
18020
  } else if (node.initializer !== void 0) {
18063
18021
  nodeValueSymbol = this.getSymbolOfTsNode(node.initializer);
@@ -18082,12 +18040,12 @@ var SymbolBuilder = class {
18082
18040
  const target = this.typeCheckData.boundTarget.getReferenceTarget(ref);
18083
18041
  let node = findFirstMatchingNode(this.typeCheckBlock, {
18084
18042
  withSpan: ref.sourceSpan,
18085
- filter: ts85.isVariableDeclaration
18043
+ filter: ts70.isVariableDeclaration
18086
18044
  });
18087
18045
  if (node === null || target === null || node.initializer === void 0) {
18088
18046
  return null;
18089
18047
  }
18090
- const originalDeclaration = ts85.isParenthesizedExpression(node.initializer) && ts85.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
18048
+ const originalDeclaration = ts70.isParenthesizedExpression(node.initializer) && ts70.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
18091
18049
  if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
18092
18050
  return null;
18093
18051
  }
@@ -18111,7 +18069,7 @@ var SymbolBuilder = class {
18111
18069
  referenceVarLocation: referenceVarTcbLocation
18112
18070
  };
18113
18071
  } else {
18114
- if (!ts85.isClassDeclaration(target.directive.ref.node)) {
18072
+ if (!ts70.isClassDeclaration(target.directive.ref.node)) {
18115
18073
  return null;
18116
18074
  }
18117
18075
  return {
@@ -18128,7 +18086,7 @@ var SymbolBuilder = class {
18128
18086
  getSymbolOfLetDeclaration(decl) {
18129
18087
  const node = findFirstMatchingNode(this.typeCheckBlock, {
18130
18088
  withSpan: decl.sourceSpan,
18131
- filter: ts85.isVariableDeclaration
18089
+ filter: ts70.isVariableDeclaration
18132
18090
  });
18133
18091
  if (node === null) {
18134
18092
  return null;
@@ -18153,7 +18111,7 @@ var SymbolBuilder = class {
18153
18111
  getSymbolOfPipe(expression) {
18154
18112
  const methodAccess = findFirstMatchingNode(this.typeCheckBlock, {
18155
18113
  withSpan: expression.nameSpan,
18156
- filter: ts85.isPropertyAccessExpression
18114
+ filter: ts70.isPropertyAccessExpression
18157
18115
  });
18158
18116
  if (methodAccess === null) {
18159
18117
  return null;
@@ -18198,7 +18156,7 @@ var SymbolBuilder = class {
18198
18156
  if (expression instanceof PropertyRead8) {
18199
18157
  node = findFirstMatchingNode(this.typeCheckBlock, {
18200
18158
  withSpan,
18201
- filter: ts85.isPropertyAccessExpression
18159
+ filter: ts70.isPropertyAccessExpression
18202
18160
  });
18203
18161
  }
18204
18162
  if (node === null) {
@@ -18207,10 +18165,10 @@ var SymbolBuilder = class {
18207
18165
  if (node === null) {
18208
18166
  return null;
18209
18167
  }
18210
- while (ts85.isParenthesizedExpression(node)) {
18168
+ while (ts70.isParenthesizedExpression(node)) {
18211
18169
  node = node.expression;
18212
18170
  }
18213
- if (expression instanceof SafePropertyRead4 && ts85.isConditionalExpression(node)) {
18171
+ if (expression instanceof SafePropertyRead4 && ts70.isConditionalExpression(node)) {
18214
18172
  const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
18215
18173
  if (whenTrueSymbol === null) {
18216
18174
  return null;
@@ -18228,13 +18186,13 @@ var SymbolBuilder = class {
18228
18186
  }
18229
18187
  }
18230
18188
  getSymbolOfTsNode(node) {
18231
- while (ts85.isParenthesizedExpression(node)) {
18189
+ while (ts70.isParenthesizedExpression(node)) {
18232
18190
  node = node.expression;
18233
18191
  }
18234
18192
  let tsSymbol;
18235
- if (ts85.isPropertyAccessExpression(node)) {
18193
+ if (ts70.isPropertyAccessExpression(node)) {
18236
18194
  tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
18237
- } else if (ts85.isCallExpression(node)) {
18195
+ } else if (ts70.isCallExpression(node)) {
18238
18196
  tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.expression);
18239
18197
  } else {
18240
18198
  tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
@@ -18255,13 +18213,13 @@ var SymbolBuilder = class {
18255
18213
  };
18256
18214
  }
18257
18215
  getTcbPositionForNode(node) {
18258
- if (ts85.isTypeReferenceNode(node)) {
18216
+ if (ts70.isTypeReferenceNode(node)) {
18259
18217
  return this.getTcbPositionForNode(node.typeName);
18260
- } else if (ts85.isQualifiedName(node)) {
18218
+ } else if (ts70.isQualifiedName(node)) {
18261
18219
  return node.right.getStart();
18262
- } else if (ts85.isPropertyAccessExpression(node)) {
18220
+ } else if (ts70.isPropertyAccessExpression(node)) {
18263
18221
  return node.name.getStart();
18264
- } else if (ts85.isElementAccessExpression(node)) {
18222
+ } else if (ts70.isElementAccessExpression(node)) {
18265
18223
  return node.argumentExpression.getStart();
18266
18224
  } else {
18267
18225
  return node.getStart();
@@ -18275,13 +18233,13 @@ function sourceSpanEqual(a, b) {
18275
18233
  return a.start.offset === b.start.offset && a.end.offset === b.end.offset;
18276
18234
  }
18277
18235
  function unwrapSignalInputWriteTAccessor(expr) {
18278
- if (!ts85.isElementAccessExpression(expr) || !ts85.isPropertyAccessExpression(expr.argumentExpression)) {
18236
+ if (!ts70.isElementAccessExpression(expr) || !ts70.isPropertyAccessExpression(expr.argumentExpression)) {
18279
18237
  return null;
18280
18238
  }
18281
- if (!ts85.isIdentifier(expr.argumentExpression.name) || expr.argumentExpression.name.text !== R3Identifiers6.InputSignalBrandWriteType.name) {
18239
+ if (!ts70.isIdentifier(expr.argumentExpression.name) || expr.argumentExpression.name.text !== R3Identifiers6.InputSignalBrandWriteType.name) {
18282
18240
  return null;
18283
18241
  }
18284
- if (!ts85.isPropertyAccessExpression(expr.expression) && !ts85.isElementAccessExpression(expr.expression) && !ts85.isIdentifier(expr.expression)) {
18242
+ if (!ts70.isPropertyAccessExpression(expr.expression) && !ts70.isElementAccessExpression(expr.expression) && !ts70.isIdentifier(expr.expression)) {
18285
18243
  throw new Error("Unexpected expression for signal input write type.");
18286
18244
  }
18287
18245
  return {
@@ -18289,6 +18247,14 @@ function unwrapSignalInputWriteTAccessor(expr) {
18289
18247
  typeExpr: expr
18290
18248
  };
18291
18249
  }
18250
+ function isSameDirectiveDeclaration(a, b) {
18251
+ if (a === b) {
18252
+ return true;
18253
+ }
18254
+ const aName = a.name?.text;
18255
+ const bName = b.name?.text;
18256
+ return aName !== void 0 && bName !== void 0 && aName === bName && a.getSourceFile().fileName === b.getSourceFile().fileName;
18257
+ }
18292
18258
  function findMatchingDirective(originalSourceFile, directiveDeclarationInTypeCheckSourceFile) {
18293
18259
  const className = directiveDeclarationInTypeCheckSourceFile.name?.text ?? "";
18294
18260
  const ogClasses = collectClassesWithName(originalSourceFile, className);
@@ -18298,10 +18264,10 @@ function findMatchingDirective(originalSourceFile, directiveDeclarationInTypeChe
18298
18264
  function collectClassesWithName(sourceFile, className) {
18299
18265
  const classes = [];
18300
18266
  function visit2(node) {
18301
- if (ts85.isClassDeclaration(node) && node.name?.text === className) {
18267
+ if (ts70.isClassDeclaration(node) && node.name?.text === className) {
18302
18268
  classes.push(node);
18303
18269
  }
18304
- ts85.forEachChild(node, visit2);
18270
+ ts70.forEachChild(node, visit2);
18305
18271
  }
18306
18272
  sourceFile.forEachChild(visit2);
18307
18273
  return classes;
@@ -19113,7 +19079,7 @@ var TemplateTypeCheckerImpl = class {
19113
19079
  }
19114
19080
  }
19115
19081
  return { kind, symbolName: emitted.node.text, isForwardReference };
19116
- } else if (emitted instanceof ExternalExpr8 && emitted.value.moduleName !== null && emitted.value.name !== null) {
19082
+ } else if (emitted instanceof ExternalExpr9 && emitted.value.moduleName !== null && emitted.value.name !== null) {
19117
19083
  return {
19118
19084
  kind,
19119
19085
  moduleSpecifier: emitted.value.moduleName,
@@ -19330,11 +19296,11 @@ function getClassDeclFromSymbol(symbol, checker) {
19330
19296
  if (decl === void 0) {
19331
19297
  return null;
19332
19298
  }
19333
- if (ts86.isExportAssignment(decl)) {
19299
+ if (ts71.isExportAssignment(decl)) {
19334
19300
  const symbol2 = checker.getTypeAtLocation(decl.expression).getSymbol();
19335
19301
  return getClassDeclFromSymbol(symbol2, checker);
19336
19302
  }
19337
- if (ts86.isExportSpecifier(decl)) {
19303
+ if (ts71.isExportSpecifier(decl)) {
19338
19304
  const symbol2 = checker.getTypeAtLocation(decl).getSymbol();
19339
19305
  return getClassDeclFromSymbol(symbol2, checker);
19340
19306
  }
@@ -19367,7 +19333,7 @@ function getTheElementTagDeprecatedSuggestionDiagnostics(shimPath, program, file
19367
19333
  const nodeType = typeChecker.getTypeAtLocation(diagNode);
19368
19334
  const nodeSymbolDeclarations = nodeType.getSymbol()?.declarations;
19369
19335
  const decl = nodeSymbolDeclarations !== void 0 && nodeSymbolDeclarations.length > 0 ? nodeSymbolDeclarations[0] : void 0;
19370
- if (decl === void 0 || !ts86.isClassDeclaration(decl)) {
19336
+ if (decl === void 0 || !ts71.isClassDeclaration(decl)) {
19371
19337
  continue;
19372
19338
  }
19373
19339
  const directiveForDiagnostic = templateTypeChecker.getDirectiveMetadata(decl);
@@ -19387,7 +19353,7 @@ function getTheElementTagDeprecatedSuggestionDiagnostics(shimPath, program, file
19387
19353
  if (decl === void 0) {
19388
19354
  continue;
19389
19355
  }
19390
- if (!ts86.isClassDeclaration(decl)) {
19356
+ if (!ts71.isClassDeclaration(decl)) {
19391
19357
  continue;
19392
19358
  }
19393
19359
  const diagnostic = nodeToDiag.get(decl);
@@ -19666,7 +19632,7 @@ var DirectiveDecoratorHandler = class {
19666
19632
  if (!this.typeCheckHostBindings) {
19667
19633
  return;
19668
19634
  }
19669
- if (!ts87.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
19635
+ if (!ts72.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
19670
19636
  return;
19671
19637
  }
19672
19638
  const ref = new Reference(node);
@@ -19775,17 +19741,17 @@ var DirectiveDecoratorHandler = class {
19775
19741
  };
19776
19742
 
19777
19743
  // 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";
19744
+ import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as ExternalExpr10, FactoryTarget as FactoryTarget2, FunctionExpr, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr3, R3Identifiers as R3Identifiers7, R3NgModuleMetadataKind, R3SelectorScopeMode, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr10 } from "@angular/compiler";
19745
+ import ts74 from "typescript";
19780
19746
 
19781
19747
  // packages/compiler-cli/src/ngtsc/annotations/ng_module/src/module_with_providers.js
19782
- import ts88 from "typescript";
19748
+ import ts73 from "typescript";
19783
19749
  function createModuleWithProvidersResolver(reflector, isCore) {
19784
19750
  function _reflectModuleFromTypeParam(type, node) {
19785
- if (!ts88.isTypeReferenceNode(type)) {
19751
+ if (!ts73.isTypeReferenceNode(type)) {
19786
19752
  return null;
19787
19753
  }
19788
- const typeName = type && (ts88.isIdentifier(type.typeName) && type.typeName || ts88.isQualifiedName(type.typeName) && type.typeName.right) || null;
19754
+ const typeName = type && (ts73.isIdentifier(type.typeName) && type.typeName || ts73.isQualifiedName(type.typeName) && type.typeName.right) || null;
19789
19755
  if (typeName === null) {
19790
19756
  return null;
19791
19757
  }
@@ -19797,7 +19763,7 @@ function createModuleWithProvidersResolver(reflector, isCore) {
19797
19763
  return null;
19798
19764
  }
19799
19765
  if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
19800
- const parent = ts88.isMethodDeclaration(node) && ts88.isClassDeclaration(node.parent) ? node.parent : null;
19766
+ const parent = ts73.isMethodDeclaration(node) && ts73.isClassDeclaration(node.parent) ? node.parent : null;
19801
19767
  const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
19802
19768
  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
19769
  }
@@ -19805,15 +19771,15 @@ function createModuleWithProvidersResolver(reflector, isCore) {
19805
19771
  return typeNodeToValueExpr(arg);
19806
19772
  }
19807
19773
  function _reflectModuleFromLiteralType(type) {
19808
- if (!ts88.isIntersectionTypeNode(type)) {
19774
+ if (!ts73.isIntersectionTypeNode(type)) {
19809
19775
  return null;
19810
19776
  }
19811
19777
  for (const t of type.types) {
19812
- if (ts88.isTypeLiteralNode(t)) {
19778
+ if (ts73.isTypeLiteralNode(t)) {
19813
19779
  for (const m of t.members) {
19814
- const ngModuleType = ts88.isPropertySignature(m) && ts88.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
19780
+ const ngModuleType = ts73.isPropertySignature(m) && ts73.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
19815
19781
  let ngModuleExpression = null;
19816
- if (ngModuleType !== null && ts88.isTypeQueryNode(ngModuleType)) {
19782
+ if (ngModuleType !== null && ts73.isTypeQueryNode(ngModuleType)) {
19817
19783
  ngModuleExpression = entityNameToValue(ngModuleType.exprName);
19818
19784
  } else if (ngModuleType !== null) {
19819
19785
  ngModuleExpression = typeNodeToValueExpr(ngModuleType);
@@ -19991,8 +19957,8 @@ var NgModuleDecoratorHandler = class {
19991
19957
  if (decorator.args === null || decorator.args.length > 1) {
19992
19958
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @NgModule decorator`);
19993
19959
  }
19994
- const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts89.factory.createObjectLiteralExpression([]);
19995
- if (!ts89.isObjectLiteralExpression(meta)) {
19960
+ const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts74.factory.createObjectLiteralExpression([]);
19961
+ if (!ts74.isObjectLiteralExpression(meta)) {
19996
19962
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@NgModule argument must be an object literal");
19997
19963
  }
19998
19964
  const ngModule = reflectObjectLiteral(meta);
@@ -20079,7 +20045,7 @@ var NgModuleDecoratorHandler = class {
20079
20045
  id = new WrappedNodeExpr10(idExpr);
20080
20046
  } else {
20081
20047
  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;
20048
+ diag.category = ts74.DiagnosticCategory.Warning;
20083
20049
  diagnostics.push(diag);
20084
20050
  }
20085
20051
  }
@@ -20139,16 +20105,16 @@ var NgModuleDecoratorHandler = class {
20139
20105
  }
20140
20106
  const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
20141
20107
  let wrappedProviders = null;
20142
- if (rawProviders !== null && (!ts89.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
20108
+ if (rawProviders !== null && (!ts74.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
20143
20109
  wrappedProviders = new WrappedNodeExpr10(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders);
20144
20110
  }
20145
20111
  const topLevelImports = [];
20146
20112
  if (!allowUnresolvedReferences && ngModule.has("imports")) {
20147
20113
  const rawImports2 = unwrapExpression(ngModule.get("imports"));
20148
20114
  let topLevelExpressions = [];
20149
- if (ts89.isArrayLiteralExpression(rawImports2)) {
20115
+ if (ts74.isArrayLiteralExpression(rawImports2)) {
20150
20116
  for (const element of rawImports2.elements) {
20151
- if (ts89.isSpreadElement(element)) {
20117
+ if (ts74.isSpreadElement(element)) {
20152
20118
  topLevelExpressions.push(element.expression);
20153
20119
  continue;
20154
20120
  }
@@ -20188,7 +20154,7 @@ var NgModuleDecoratorHandler = class {
20188
20154
  if (exp === null) {
20189
20155
  continue;
20190
20156
  }
20191
- if (ts89.isArrayLiteralExpression(exp)) {
20157
+ if (ts74.isArrayLiteralExpression(exp)) {
20192
20158
  if (exp.elements) {
20193
20159
  injectorMetadata.imports.push(...exp.elements.map((n2) => new WrappedNodeExpr10(n2)));
20194
20160
  }
@@ -20418,7 +20384,7 @@ var NgModuleDecoratorHandler = class {
20418
20384
  const componentType = this.refEmitter.emit(decl, context);
20419
20385
  assertSuccessfulReferenceEmit(componentType, node, "component");
20420
20386
  const declExpr = componentType.expression;
20421
- const setComponentScope = new ExternalExpr9(R3Identifiers7.setComponentScope);
20387
+ const setComponentScope = new ExternalExpr10(R3Identifiers7.setComponentScope);
20422
20388
  const callExpr = new InvokeFunctionExpr(setComponentScope, [
20423
20389
  declExpr,
20424
20390
  directiveExpr,
@@ -20519,7 +20485,7 @@ function isNgModule(node, compilation) {
20519
20485
  return !compilation.dependencies.some((dep) => dep.ref.node === node);
20520
20486
  }
20521
20487
  function isModuleIdExpression(expr) {
20522
- return ts89.isPropertyAccessExpression(expr) && ts89.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
20488
+ return ts74.isPropertyAccessExpression(expr) && ts74.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
20523
20489
  }
20524
20490
  function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef, rawBootstrapExpr) {
20525
20491
  const componentClassName = bootstrappedClassRef.node.name.text;
@@ -20592,7 +20558,7 @@ var ComponentSymbol = class _ComponentSymbol extends DirectiveSymbol {
20592
20558
  };
20593
20559
 
20594
20560
  // packages/compiler-cli/src/ngtsc/annotations/component/src/util.js
20595
- import ts90 from "typescript";
20561
+ import ts75 from "typescript";
20596
20562
  function collectLegacyAnimationNames(value, legacyAnimationTriggerNames) {
20597
20563
  if (value instanceof Map) {
20598
20564
  const name = value.get("name");
@@ -20639,7 +20605,7 @@ function validateAndFlattenComponentImports(imports, expr, isDeferred) {
20639
20605
  for (let i = 0; i < imports.length; i++) {
20640
20606
  const ref = imports[i];
20641
20607
  let refExpr = expr;
20642
- if (ts90.isArrayLiteralExpression(expr) && expr.elements.length === imports.length && !expr.elements.some(ts90.isSpreadAssignment)) {
20608
+ if (ts75.isArrayLiteralExpression(expr) && expr.elements.length === imports.length && !expr.elements.some(ts75.isSpreadAssignment)) {
20643
20609
  refExpr = expr.elements[i];
20644
20610
  }
20645
20611
  if (Array.isArray(ref)) {
@@ -20701,11 +20667,11 @@ import { outputAst as o4 } from "@angular/compiler";
20701
20667
 
20702
20668
  // packages/compiler-cli/src/ngtsc/hmr/src/extract_dependencies.js
20703
20669
  import { outputAst as o3 } from "@angular/compiler";
20704
- import ts91 from "typescript";
20670
+ import ts76 from "typescript";
20705
20671
  function extractHmrDependencies(node, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator) {
20706
- const name = ts91.isClassDeclaration(node) && node.name ? node.name.text : null;
20672
+ const name = ts76.isClassDeclaration(node) && node.name ? node.name.text : null;
20707
20673
  const visitor = new PotentialTopLevelReadsVisitor();
20708
- const sourceFile = ts91.getOriginalNode(node).getSourceFile();
20674
+ const sourceFile = ts76.getOriginalNode(node).getSourceFile();
20709
20675
  definition.expression.visitExpression(visitor, null);
20710
20676
  definition.statements.forEach((statement) => statement.visitStatement(visitor, null));
20711
20677
  factory.initializer?.visitExpression(visitor, null);
@@ -20766,21 +20732,21 @@ function getRuntimeRepresentation(node, reflection, evaluator) {
20766
20732
  function getTopLevelDeclarationNames(sourceFile) {
20767
20733
  const results = /* @__PURE__ */ new Set();
20768
20734
  for (const node of sourceFile.statements) {
20769
- if (ts91.isClassDeclaration(node) || ts91.isFunctionDeclaration(node) || ts91.isEnumDeclaration(node)) {
20735
+ if (ts76.isClassDeclaration(node) || ts76.isFunctionDeclaration(node) || ts76.isEnumDeclaration(node)) {
20770
20736
  if (node.name) {
20771
20737
  results.add(node.name.text);
20772
20738
  }
20773
20739
  continue;
20774
20740
  }
20775
- if (ts91.isVariableStatement(node)) {
20741
+ if (ts76.isVariableStatement(node)) {
20776
20742
  for (const decl of node.declarationList.declarations) {
20777
20743
  trackBindingName(decl.name, results);
20778
20744
  }
20779
20745
  continue;
20780
20746
  }
20781
- if (ts91.isImportDeclaration(node) && node.importClause) {
20747
+ if (ts76.isImportDeclaration(node) && node.importClause) {
20782
20748
  const importClause = node.importClause;
20783
- if (importClause.phaseModifier === ts91.SyntaxKind.TypeKeyword) {
20749
+ if (importClause.phaseModifier === ts76.SyntaxKind.TypeKeyword) {
20784
20750
  continue;
20785
20751
  }
20786
20752
  if (importClause.name) {
@@ -20788,7 +20754,7 @@ function getTopLevelDeclarationNames(sourceFile) {
20788
20754
  }
20789
20755
  if (importClause.namedBindings) {
20790
20756
  const namedBindings = importClause.namedBindings;
20791
- if (ts91.isNamespaceImport(namedBindings)) {
20757
+ if (ts76.isNamespaceImport(namedBindings)) {
20792
20758
  results.add(namedBindings.name.text);
20793
20759
  } else {
20794
20760
  namedBindings.elements.forEach((el) => {
@@ -20804,11 +20770,11 @@ function getTopLevelDeclarationNames(sourceFile) {
20804
20770
  return results;
20805
20771
  }
20806
20772
  function trackBindingName(node, results) {
20807
- if (ts91.isIdentifier(node)) {
20773
+ if (ts76.isIdentifier(node)) {
20808
20774
  results.add(node.text);
20809
20775
  } else {
20810
20776
  for (const el of node.elements) {
20811
- if (!ts91.isOmittedExpression(el)) {
20777
+ if (!ts76.isOmittedExpression(el)) {
20812
20778
  trackBindingName(el.name, results);
20813
20779
  }
20814
20780
  }
@@ -20838,10 +20804,10 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
20838
20804
  * @param node Node from which to start the traversal.
20839
20805
  */
20840
20806
  addAllTopLevelIdentifiers = (node) => {
20841
- if (ts91.isIdentifier(node) && this.isTopLevelIdentifierReference(node)) {
20807
+ if (ts76.isIdentifier(node) && this.isTopLevelIdentifierReference(node)) {
20842
20808
  this.allReads.add(node);
20843
20809
  } else {
20844
- ts91.forEachChild(node, this.addAllTopLevelIdentifiers);
20810
+ ts76.forEachChild(node, this.addAllTopLevelIdentifiers);
20845
20811
  }
20846
20812
  };
20847
20813
  /**
@@ -20856,52 +20822,52 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
20856
20822
  if (!parent) {
20857
20823
  return false;
20858
20824
  }
20859
- if (ts91.isParenthesizedExpression(parent) && parent.expression === node) {
20860
- while (parent && ts91.isParenthesizedExpression(parent)) {
20825
+ if (ts76.isParenthesizedExpression(parent) && parent.expression === node) {
20826
+ while (parent && ts76.isParenthesizedExpression(parent)) {
20861
20827
  node = parent;
20862
20828
  parent = parent.parent;
20863
20829
  }
20864
20830
  }
20865
- if (ts91.isSourceFile(parent)) {
20831
+ if (ts76.isSourceFile(parent)) {
20866
20832
  return true;
20867
20833
  }
20868
- if (ts91.isCallExpression(parent)) {
20834
+ if (ts76.isCallExpression(parent)) {
20869
20835
  return parent.expression === node || parent.arguments.includes(node);
20870
20836
  }
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)) {
20837
+ 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
20838
  return parent.expression === node;
20873
20839
  }
20874
- if (ts91.isArrayLiteralExpression(parent)) {
20840
+ if (ts76.isArrayLiteralExpression(parent)) {
20875
20841
  return parent.elements.includes(node);
20876
20842
  }
20877
- if (ts91.isPropertyAssignment(parent) || ts91.isParameter(parent) || ts91.isBindingElement(parent) || ts91.isPropertyDeclaration(parent) || ts91.isEnumMember(parent)) {
20843
+ if (ts76.isPropertyAssignment(parent) || ts76.isParameter(parent) || ts76.isBindingElement(parent) || ts76.isPropertyDeclaration(parent) || ts76.isEnumMember(parent)) {
20878
20844
  return parent.initializer === node;
20879
20845
  }
20880
- if (ts91.isVariableDeclaration(parent)) {
20846
+ if (ts76.isVariableDeclaration(parent)) {
20881
20847
  return parent.name === node || parent.initializer === node;
20882
20848
  }
20883
- if (ts91.isClassDeclaration(parent) || ts91.isFunctionDeclaration(parent) || ts91.isShorthandPropertyAssignment(parent)) {
20849
+ if (ts76.isClassDeclaration(parent) || ts76.isFunctionDeclaration(parent) || ts76.isShorthandPropertyAssignment(parent)) {
20884
20850
  return parent.name === node;
20885
20851
  }
20886
- if (ts91.isElementAccessExpression(parent)) {
20852
+ if (ts76.isElementAccessExpression(parent)) {
20887
20853
  return parent.expression === node || parent.argumentExpression === node;
20888
20854
  }
20889
- if (ts91.isBinaryExpression(parent)) {
20855
+ if (ts76.isBinaryExpression(parent)) {
20890
20856
  return parent.left === node || parent.right === node;
20891
20857
  }
20892
- if (ts91.isForInStatement(parent) || ts91.isForOfStatement(parent)) {
20858
+ if (ts76.isForInStatement(parent) || ts76.isForOfStatement(parent)) {
20893
20859
  return parent.expression === node || parent.initializer === node;
20894
20860
  }
20895
- if (ts91.isForStatement(parent)) {
20861
+ if (ts76.isForStatement(parent)) {
20896
20862
  return parent.condition === node || parent.initializer === node || parent.incrementor === node;
20897
20863
  }
20898
- if (ts91.isArrowFunction(parent)) {
20864
+ if (ts76.isArrowFunction(parent)) {
20899
20865
  return parent.body === node;
20900
20866
  }
20901
- if (ts91.isImportSpecifier(parent) || ts91.isExportSpecifier(parent)) {
20867
+ if (ts76.isImportSpecifier(parent) || ts76.isExportSpecifier(parent)) {
20902
20868
  return (parent.propertyName || parent.name) === node;
20903
20869
  }
20904
- if (ts91.isConditionalExpression(parent)) {
20870
+ if (ts76.isConditionalExpression(parent)) {
20905
20871
  return parent.condition === node || parent.whenFalse === node || parent.whenTrue === node;
20906
20872
  }
20907
20873
  return false;
@@ -20913,20 +20879,20 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
20913
20879
  };
20914
20880
  function isConstEnumReference(node, reflection) {
20915
20881
  const parent = node.parent;
20916
- if (!parent || !ts91.isPropertyAccessExpression(parent) || parent.expression !== node || !ts91.isIdentifier(parent.name)) {
20882
+ if (!parent || !ts76.isPropertyAccessExpression(parent) || parent.expression !== node || !ts76.isIdentifier(parent.name)) {
20917
20883
  return false;
20918
20884
  }
20919
20885
  const declaration = reflection.getDeclarationOfIdentifier(node);
20920
- return declaration !== null && ts91.isEnumDeclaration(declaration.node) && !!declaration.node.modifiers?.some((m) => m.kind === ts91.SyntaxKind.ConstKeyword);
20886
+ return declaration !== null && ts76.isEnumDeclaration(declaration.node) && !!declaration.node.modifiers?.some((m) => m.kind === ts76.SyntaxKind.ConstKeyword);
20921
20887
  }
20922
20888
 
20923
20889
  // packages/compiler-cli/src/ngtsc/hmr/src/metadata.js
20924
- import ts92 from "typescript";
20890
+ import ts77 from "typescript";
20925
20891
  function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDirs, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
20926
20892
  if (!reflection.isClass(clazz)) {
20927
20893
  return null;
20928
20894
  }
20929
- const sourceFile = ts92.getOriginalNode(clazz).getSourceFile();
20895
+ const sourceFile = ts77.getOriginalNode(clazz).getSourceFile();
20930
20896
  const filePath = getProjectRelativePath(sourceFile.fileName, rootDirs, compilerHost) || compilerHost.getCanonicalFileName(sourceFile.fileName);
20931
20897
  const dependencies = extractHmrDependencies(clazz, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator);
20932
20898
  if (dependencies === null) {
@@ -20944,7 +20910,7 @@ function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDi
20944
20910
 
20945
20911
  // packages/compiler-cli/src/ngtsc/hmr/src/update_declaration.js
20946
20912
  import { compileHmrUpdateCallback } from "@angular/compiler";
20947
- import ts93 from "typescript";
20913
+ import ts78 from "typescript";
20948
20914
  function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, declaration) {
20949
20915
  const namespaceSpecifiers = meta.namespaceDependencies.reduce((result, current) => {
20950
20916
  result.set(current.moduleName, current.assignedName);
@@ -20956,11 +20922,11 @@ function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, d
20956
20922
  rewriter: importRewriter
20957
20923
  });
20958
20924
  const callback = compileHmrUpdateCallback(compilationResults, constantStatements, meta);
20959
- const sourceFile = ts93.getOriginalNode(declaration).getSourceFile();
20925
+ const sourceFile = ts78.getOriginalNode(declaration).getSourceFile();
20960
20926
  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)
20927
+ return ts78.factory.updateFunctionDeclaration(node, [
20928
+ ts78.factory.createToken(ts78.SyntaxKind.ExportKeyword),
20929
+ ts78.factory.createToken(ts78.SyntaxKind.DefaultKeyword)
20964
20930
  ], node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body);
20965
20931
  }
20966
20932
  var HmrModuleImportRewriter = class {
@@ -21407,7 +21373,7 @@ var ComponentDecoratorHandler = class {
21407
21373
  path: absoluteFrom(template.declaration.resolvedTemplateUrl),
21408
21374
  node: template.sourceMapping.node
21409
21375
  };
21410
- const relativeTemplatePath = getProjectRelativePath(templateResource.path ?? ts94.getOriginalNode(node).getSourceFile().fileName, this.rootDirs, this.compilerHost);
21376
+ const relativeTemplatePath = getProjectRelativePath(templateResource.path ?? ts79.getOriginalNode(node).getSourceFile().fileName, this.rootDirs, this.compilerHost);
21411
21377
  let selectorlessEnabled = false;
21412
21378
  let localReferencedSymbols = null;
21413
21379
  if (this.enableSelectorless) {
@@ -21441,7 +21407,7 @@ var ComponentDecoratorHandler = class {
21441
21407
  externalStyles.push(resourceUrl);
21442
21408
  continue;
21443
21409
  }
21444
- if (styleUrl.source === 2 && ts94.isStringLiteralLike(styleUrl.expression)) {
21410
+ if (styleUrl.source === 2 && ts79.isStringLiteralLike(styleUrl.expression)) {
21445
21411
  styleResources.add({
21446
21412
  path: absoluteFrom(resourceUrl),
21447
21413
  node: styleUrl.expression
@@ -21649,7 +21615,7 @@ var ComponentDecoratorHandler = class {
21649
21615
  return null;
21650
21616
  }
21651
21617
  typeCheck(ctx, node, meta) {
21652
- if (!ts94.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
21618
+ if (!ts79.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
21653
21619
  return;
21654
21620
  }
21655
21621
  const ref = new Reference(node);
@@ -22058,7 +22024,7 @@ var ComponentDecoratorHandler = class {
22058
22024
  data.declarations = eagerDeclarations;
22059
22025
  if (this.compilationMode === CompilationMode.LOCAL && this.localCompilationExtraImportsTracker !== null) {
22060
22026
  for (const { type } of eagerDeclarations) {
22061
- if (type instanceof ExternalExpr10 && type.value.moduleName) {
22027
+ if (type instanceof ExternalExpr11 && type.value.moduleName) {
22062
22028
  this.localCompilationExtraImportsTracker.addImportForFile(context, type.value.moduleName);
22063
22029
  }
22064
22030
  }
@@ -22180,12 +22146,12 @@ var ComponentDecoratorHandler = class {
22180
22146
  */
22181
22147
  collectExplicitlyDeferredSymbols(rawDeferredImports) {
22182
22148
  const deferredTypes = /* @__PURE__ */ new Map();
22183
- if (!ts94.isArrayLiteralExpression(rawDeferredImports)) {
22149
+ if (!ts79.isArrayLiteralExpression(rawDeferredImports)) {
22184
22150
  return deferredTypes;
22185
22151
  }
22186
22152
  for (const element of rawDeferredImports.elements) {
22187
22153
  const node = tryUnwrapForwardRef(element, this.reflector) || element;
22188
- if (!ts94.isIdentifier(node)) {
22154
+ if (!ts79.isIdentifier(node)) {
22189
22155
  continue;
22190
22156
  }
22191
22157
  const imp = this.reflector.getImportOfIdentifier(node);
@@ -22253,12 +22219,12 @@ var ComponentDecoratorHandler = class {
22253
22219
  }
22254
22220
  }
22255
22221
  if (analysisData.meta.isStandalone) {
22256
- if (analysisData.rawImports !== null && ts94.isArrayLiteralExpression(analysisData.rawImports)) {
22222
+ if (analysisData.rawImports !== null && ts79.isArrayLiteralExpression(analysisData.rawImports)) {
22257
22223
  for (const element of analysisData.rawImports.elements) {
22258
22224
  this.registerDeferrableCandidate(componentClassDecl, element, false, allDeferredDecls, eagerlyUsedDecls, resolutionData);
22259
22225
  }
22260
22226
  }
22261
- if (analysisData.rawDeferredImports !== null && ts94.isArrayLiteralExpression(analysisData.rawDeferredImports)) {
22227
+ if (analysisData.rawDeferredImports !== null && ts79.isArrayLiteralExpression(analysisData.rawDeferredImports)) {
22262
22228
  for (const element of analysisData.rawDeferredImports.elements) {
22263
22229
  this.registerDeferrableCandidate(componentClassDecl, element, false, allDeferredDecls, eagerlyUsedDecls, resolutionData);
22264
22230
  }
@@ -22277,7 +22243,7 @@ var ComponentDecoratorHandler = class {
22277
22243
  */
22278
22244
  registerDeferrableCandidate(componentClassDecl, element, isDeferredImport, allDeferredDecls, eagerlyUsedDecls, resolutionData) {
22279
22245
  const node = tryUnwrapForwardRef(element, this.reflector) || element;
22280
- if (!ts94.isIdentifier(node)) {
22246
+ if (!ts79.isIdentifier(node)) {
22281
22247
  return;
22282
22248
  }
22283
22249
  const imp = this.reflector.getImportOfIdentifier(node);
@@ -22412,7 +22378,7 @@ function isDefaultImport(node) {
22412
22378
 
22413
22379
  // packages/compiler-cli/src/ngtsc/annotations/src/injectable.js
22414
22380
  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";
22381
+ import ts80 from "typescript";
22416
22382
  var InjectableDecoratorHandler = class {
22417
22383
  reflector;
22418
22384
  evaluator;
@@ -22547,7 +22513,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
22547
22513
  };
22548
22514
  } else if (decorator.args.length === 1) {
22549
22515
  const metaNode = decorator.args[0];
22550
- if (!ts95.isObjectLiteralExpression(metaNode)) {
22516
+ if (!ts80.isObjectLiteralExpression(metaNode)) {
22551
22517
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
22552
22518
  }
22553
22519
  const meta = reflectObjectLiteral(metaNode);
@@ -22559,7 +22525,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
22559
22525
  let deps = void 0;
22560
22526
  if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
22561
22527
  const depsExpr = meta.get("deps");
22562
- if (!ts95.isArrayLiteralExpression(depsExpr)) {
22528
+ if (!ts80.isArrayLiteralExpression(depsExpr)) {
22563
22529
  throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
22564
22530
  }
22565
22531
  deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
@@ -22648,12 +22614,12 @@ function getDep(dep, reflector) {
22648
22614
  }
22649
22615
  return true;
22650
22616
  }
22651
- if (ts95.isArrayLiteralExpression(dep)) {
22617
+ if (ts80.isArrayLiteralExpression(dep)) {
22652
22618
  dep.elements.forEach((el) => {
22653
22619
  let isDecorator = false;
22654
- if (ts95.isIdentifier(el)) {
22620
+ if (ts80.isIdentifier(el)) {
22655
22621
  isDecorator = maybeUpdateDecorator(el, reflector);
22656
- } else if (ts95.isNewExpression(el) && ts95.isIdentifier(el.expression)) {
22622
+ } else if (ts80.isNewExpression(el) && ts80.isIdentifier(el.expression)) {
22657
22623
  const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
22658
22624
  isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
22659
22625
  }
@@ -22667,7 +22633,7 @@ function getDep(dep, reflector) {
22667
22633
 
22668
22634
  // packages/compiler-cli/src/ngtsc/annotations/src/pipe.js
22669
22635
  import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5 } from "@angular/compiler";
22670
- import ts96 from "typescript";
22636
+ import ts81 from "typescript";
22671
22637
  var PipeSymbol = class _PipeSymbol extends SemanticSymbol {
22672
22638
  name;
22673
22639
  constructor(decl, name) {
@@ -22737,13 +22703,13 @@ var PipeDecoratorHandler = class {
22737
22703
  }
22738
22704
  const meta = decorator.args.length === 0 || // TODO(crisbeto): temporary for testing until we've changed
22739
22705
  // 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]);
22706
+ ts81.isNonNullExpression(decorator.args[0]) && decorator.args[0].expression.kind === ts81.SyntaxKind.NullKeyword ? null : unwrapExpression(decorator.args[0]);
22741
22707
  let pipeName = null;
22742
22708
  let pipeNameExpr = null;
22743
22709
  let pure = true;
22744
22710
  let isStandalone = this.implicitStandaloneValue;
22745
22711
  if (meta !== null) {
22746
- if (!ts96.isObjectLiteralExpression(meta)) {
22712
+ if (!ts81.isObjectLiteralExpression(meta)) {
22747
22713
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
22748
22714
  }
22749
22715
  const pipe = reflectObjectLiteral(meta);
@@ -22869,12 +22835,12 @@ var PipeDecoratorHandler = class {
22869
22835
  };
22870
22836
 
22871
22837
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform.js
22872
- import ts99 from "typescript";
22838
+ import ts84 from "typescript";
22873
22839
 
22874
22840
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform_api.js
22875
- import ts97 from "typescript";
22841
+ import ts82 from "typescript";
22876
22842
  function createSyntheticAngularCoreDecoratorAccess(factory, importManager, ngClassDecorator, sourceFile, decoratorName) {
22877
- const classDecoratorIdentifier = ts97.isIdentifier(ngClassDecorator.identifier) ? ngClassDecorator.identifier : ngClassDecorator.identifier.expression;
22843
+ const classDecoratorIdentifier = ts82.isIdentifier(ngClassDecorator.identifier) ? ngClassDecorator.identifier : ngClassDecorator.identifier.expression;
22878
22844
  return factory.createPropertyAccessExpression(
22879
22845
  importManager.addImport({
22880
22846
  exportModuleSpecifier: "@angular/core",
@@ -22884,11 +22850,11 @@ function createSyntheticAngularCoreDecoratorAccess(factory, importManager, ngCla
22884
22850
  // The synthetic identifier may be checked later by the downlevel decorators
22885
22851
  // transform to resolve to an Angular import using `getSymbolAtLocation`. We trick
22886
22852
  // the transform to think it's not synthetic and comes from Angular core.
22887
- ts97.setOriginalNode(factory.createIdentifier(decoratorName), classDecoratorIdentifier)
22853
+ ts82.setOriginalNode(factory.createIdentifier(decoratorName), classDecoratorIdentifier)
22888
22854
  );
22889
22855
  }
22890
22856
  function castAsAny(factory, expr) {
22891
- return factory.createAsExpression(expr, factory.createKeywordTypeNode(ts97.SyntaxKind.AnyKeyword));
22857
+ return factory.createAsExpression(expr, factory.createKeywordTypeNode(ts82.SyntaxKind.AnyKeyword));
22892
22858
  }
22893
22859
 
22894
22860
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/input_function.js
@@ -22919,7 +22885,7 @@ var signalInputsTransform = (member, sourceFile, host, factory, importTracker, i
22919
22885
  };
22920
22886
 
22921
22887
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/model_function.js
22922
- import ts98 from "typescript";
22888
+ import ts83 from "typescript";
22923
22889
  var signalModelTransform = (member, sourceFile, host, factory, importTracker, importManager, classDecorator, isCore) => {
22924
22890
  if (host.getDecoratorsOfDeclaration(member.node)?.some((d) => {
22925
22891
  return isAngularDecorator2(d, "Input", isCore) || isAngularDecorator2(d, "Output", isCore);
@@ -22940,7 +22906,7 @@ var signalModelTransform = (member, sourceFile, host, factory, importTracker, im
22940
22906
  // Config is cast to `any` because `isSignal` will be private, and in case this
22941
22907
  // transform is used directly as a pre-compilation step, the decorator should
22942
22908
  // not fail. It is already validated now due to us parsing the input metadata.
22943
- factory.createAsExpression(inputConfig, factory.createKeywordTypeNode(ts98.SyntaxKind.AnyKeyword)),
22909
+ factory.createAsExpression(inputConfig, factory.createKeywordTypeNode(ts83.SyntaxKind.AnyKeyword)),
22944
22910
  classDecorator,
22945
22911
  factory,
22946
22912
  sourceFile,
@@ -23015,21 +22981,21 @@ function getInitializerApiJitTransform(host, importTracker, isCore, shouldTransf
23015
22981
  return (ctx) => {
23016
22982
  return (sourceFile) => {
23017
22983
  const importManager = new ImportManager();
23018
- sourceFile = ts99.visitNode(sourceFile, createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass), ts99.isSourceFile);
22984
+ sourceFile = ts84.visitNode(sourceFile, createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass), ts84.isSourceFile);
23019
22985
  return importManager.transformTsFile(ctx, sourceFile);
23020
22986
  };
23021
22987
  };
23022
22988
  }
23023
22989
  function createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass) {
23024
22990
  const visitor = (node) => {
23025
- if (ts99.isClassDeclaration(node) && node.name !== void 0) {
23026
- const originalNode = ts99.getOriginalNode(node, ts99.isClassDeclaration);
22991
+ if (ts84.isClassDeclaration(node) && node.name !== void 0) {
22992
+ const originalNode = ts84.getOriginalNode(node, ts84.isClassDeclaration);
23027
22993
  const angularDecorator = host.getDecoratorsOfDeclaration(originalNode)?.find((d) => decoratorsWithInputs.some((name) => isAngularDecorator2(d, name, isCore)));
23028
22994
  if (angularDecorator !== void 0 && (shouldTransformClass === void 0 || shouldTransformClass(node))) {
23029
22995
  let hasChanged = false;
23030
22996
  const sourceFile = originalNode.getSourceFile();
23031
22997
  const members = node.members.map((memberNode) => {
23032
- if (!ts99.isPropertyDeclaration(memberNode)) {
22998
+ if (!ts84.isPropertyDeclaration(memberNode)) {
23033
22999
  return memberNode;
23034
23000
  }
23035
23001
  const member = reflectClassMember(memberNode);
@@ -23050,7 +23016,7 @@ function createTransformVisitor(ctx, host, importManager, importTracker, isCore,
23050
23016
  }
23051
23017
  }
23052
23018
  }
23053
- return ts99.visitEachChild(node, visitor, ctx);
23019
+ return ts84.visitEachChild(node, visitor, ctx);
23054
23020
  };
23055
23021
  return visitor;
23056
23022
  }
@@ -23202,3 +23168,10 @@ export {
23202
23168
  * Use of this source code is governed by an MIT-style license that can be
23203
23169
  * found in the LICENSE file at https://angular.dev/license
23204
23170
  */
23171
+ /**
23172
+ * @license
23173
+ * Copyright Google LLC All Rights Reserved.
23174
+ *
23175
+ * Use of this source code is governed by an MIT-style license that can be
23176
+ * found in the LICENSE file at https://angular.dev/license
23177
+ */