Commit graph

2155 commits

Author SHA1 Message Date
Jessica Janiuk
dfdcbf7f91 refactor(compiler): add ts-ignore for typescript upgrade (#64468)
This is a quick ts-ignore add to suppress something for later.

PR Close #64468
2025-10-16 17:32:19 +00:00
Andrew Kushnir
a2d8adb395 Revert "refactor(compiler-cli): add a resource debugName transform (#64172)" (#64418)
This reverts commit e941e6b80f.

PR Close #64418
2025-10-14 14:28:16 -07:00
JoostK
49377d274a perf(compiler-cli): fix performance of "interpolated signal not invoked" check (#64410)
This fixes a performance regression from #63754, which is almost a revert of the
prior performance fix in #57291; the latter was provided as quick fix to address
the severe performance overhead this extended diagnostic used to have, with #57337
as follow-up change to address the false negatives that were introduced in #57291.
That follow-up never landed, though, so this commit is re-applying the changes
from #57337 to fix the performance regression.

Fixes #64403

PR Close #64410
2025-10-14 13:47:20 -07:00
Matthieu Riegler
d03970f9d1 refactor(compiler-cli): remove canVisitStructuralAttributes from TemplateCheckWithVisitor (#63809)
This enables checking of expressions of structural directives in template diagnostics.

PR Close #63809
2025-10-14 11:56:14 -07:00
hawkgs
e941e6b80f refactor(compiler-cli): add a resource debugName transform (#64172)
Add a TS transform for `resource` (and `httpResource`) `debugName`. Test the transformations.

PR Close #64172
2025-10-14 09:31:41 -07:00
SkyZeroZx
563dbd998c feat(compiler-cli): Adds diagnostic for misconfigured @defer triggers (#64069)
Warns when @defer blocks define unreachable or redundant triggers, such as multiple main triggers, ineffective prefetches, or timer delays not scheduled before rendering.

PR Close #64069
2025-10-13 11:06:01 -07:00
Kristiyan Kostadinov
ab98b2425f fix(compiler-cli): capture metadata for undecorated fields (#63957)
Currently if `TestBed.overrideComponent` is used on a class that uses initializer APIs (e.g. `input()`), the initializer metadata will be wiped out, because `overrideComponent` re-compiles the class with the information set by `setClassMetadata`. `setClassMetadata` only captures decorated members at the moment.

These changes introduce some logic to capture the new initializer-based APIs in `setClassMetadata` as well.

Fixes #57944.

PR Close #63957
2025-10-09 14:02:16 -04:00
Kristiyan Kostadinov
8ceac0b8e9 refactor(compiler-cli): track member metadata using output AST (#63957)
Reworks the logic that tracks the decorator metadata for members to do so using the output AST, rather than wrapping the TypeScript AST. This makes it easier to programmatically generate new members that weren't part of the TypeScript AST before.

PR Close #63957
2025-10-09 14:02:16 -04:00
Kristiyan Kostadinov
e2367c8855 refactor(compiler-cli): type check viewport trigger options (#64130)
Updates the template type checker to check the options of the `viewport` trigger against `IntersectionObserver`.

PR Close #64130
2025-10-09 05:32:20 -07:00
hawkgs
c3a949a52d refactor(compiler-cli): include linkedSignal in the signal debugName transformer (#64106)
Add support for `linkedSignal`s in the signal `debugName` transformer. Continuation of #63346

PR Close #64106
2025-09-30 14:52:15 -04:00
Matthieu Riegler
04462ed67f refactor(compiler): Remove the interpolation config (#64071)
After #63474, we don't need that anymore.

PR Close #64071
2025-09-29 15:29:46 -04:00
Alan Agius
fc643c9044 build: adopt moduleResolution: "bundler" (#64125)
This commit updates the TypeScript configuration across the project to use `moduleResolution: "bundler"`. This modernizes our module resolution strategy to align with current TypeScript best practices and bundler behaviors.

The following changes are included:
- Updated `tsconfig.json` files to set `moduleResolution` to `"bundler"`.
- Updated the `rules_angular` bazel dependency to a version compatible with these changes.
- Adjusted related test files and golden files to reflect the new module resolution strategy.

PR Close #64125
2025-09-29 14:20:23 -04:00
Jessica Janiuk
221d5687ae Revert "refactor(compiler): Remove the interpolation config (#64071)" (#64110)
This reverts commit 768a09d3c3.

PR Close #64110
2025-09-26 15:16:53 -04:00
Matthieu Riegler
768a09d3c3 refactor(compiler): Remove the interpolation config (#64071)
After #63474, we don't need that anymore.

PR Close #64071
2025-09-26 12:36:50 -04:00
Matthieu Riegler
7e8e310868 refactor(compiler-cli): Don't emit optional chain non nullable diagnostics on indexed access. (#64007)
When `noUncheckedIndexedAccess` is not enabled, indexed accesses do not include `undefined` in the type.
This makes the OptionalChainNotNullableCheck inconvenient when wanting to safe guard an indexed access (and when the typings isn't helping you).

Ideally project should enable `noUncheckedIndexedAccess` for better typesafety, but this is often inconveninent (we do not enable it by default) and often not the resort of the developer.

So more better coding convinience,  `OptionalChainNotNullableCheck` will not raise an error/warning on indexed Acessed followed by an optional chaining when `noUncheckedIndexedAccess` is not enabled.

See also #63809 which will detect more cases

PR Close #64007
2025-09-24 15:08:05 +00:00
SkyZeroZx
3bd91ded43 fix(compiler-cli): resolve import alias in defer blocks (#63966)
Fixes an error where using an alias in a defer block caused the compiler CLI to fail when parsing. The resolution logic in ComponentDecoratorHandler was updated to correctly handle deferred dependencies with aliased imports.

PR Close #63966
2025-09-22 15:52:16 +00:00
Kristiyan Kostadinov
f5b50ec20d refactor: clean up explicit standalone flags from tests (#63963)
Since standalone is the default, we can dropn the `standalone: true` flags from our tests.

PR Close #63963
2025-09-22 14:27:34 +00:00
Jessica Janiuk
2d232b39d4 Revert "refactor(compiler-cli): track member metadata using output AST (#63904)" (#63952)
This reverts commit ffe94b3a89.

PR Close #63952
2025-09-19 18:59:42 +00:00
Jessica Janiuk
9d3cd16f33 Revert "fix(compiler-cli): capture metadata for undecorated fields (#63904)" (#63952)
This reverts commit 4c091abba6.

PR Close #63952
2025-09-19 18:59:41 +00:00
Kristiyan Kostadinov
4c091abba6 fix(compiler-cli): capture metadata for undecorated fields (#63904)
Currently if `TestBed.overrideComponent` is used on a class that uses initializer APIs (e.g. `input()`), the initializer metadata will be wiped out, because `overrideComponent` re-compiles the class with the information set by `setClassMetadata`. `setClassMetadata` only captures decorated members at the moment.

These changes introduce some logic to capture the new initializer-based APIs in `setClassMetadata` as well.

Fixes #57944.

PR Close #63904
2025-09-18 21:30:15 +00:00
Kristiyan Kostadinov
ffe94b3a89 refactor(compiler-cli): track member metadata using output AST (#63904)
Reworks the logic that tracks the decorator metadata for members to do so using the output AST, rather than wrapping the TypeScript AST. This makes it easier to programmatically generate new members that weren't part of the TypeScript AST before.

PR Close #63904
2025-09-18 21:30:15 +00:00
Kristiyan Kostadinov
f57b104ccd refactor(compiler-cli): support regular expression literals in AOT compiler (#63887)
Handles regular expression literals across the template type checker and the various translators.

PR Close #63887
2025-09-18 15:08:56 +00:00
Kristiyan Kostadinov
539717f58a feat(core): support regular expressions in templates (#63887)
Updates the template syntax to support inline regular expressions.

PR Close #63887
2025-09-18 15:08:56 +00:00
Andrew Kushnir
ae55578b92 Revert "feat(core): support regular expressions in templates (#63857)" (#63883)
This reverts commit 328a2bf719.

PR Close #63883
2025-09-17 19:36:17 +00:00
Andrew Kushnir
f53c6543db Revert "refactor(compiler-cli): support regular expression literals in AOT compiler (#63857)" (#63883)
This reverts commit f2ef838c06.

PR Close #63883
2025-09-17 19:36:17 +00:00
Kristiyan Kostadinov
f2ef838c06 refactor(compiler-cli): support regular expression literals in AOT compiler (#63857)
Handles regular expression literals across the template type checker and the various translators.

PR Close #63857
2025-09-17 16:06:51 +00:00
Kristiyan Kostadinov
328a2bf719 feat(core): support regular expressions in templates (#63857)
Updates the template syntax to support inline regular expressions.

PR Close #63857
2025-09-17 16:06:51 +00:00
JoostK
89cf62f907 fix(compiler-cli): only bind inputs that are part of microsyntax to a structural directive (#52453)
Prior to this change the template type-check generator would incorrectly apply inputs
and attributes to a structural directive, where only the bindings as present in microsyntax
are actually bound to the directive. This introduced a problem where usages of template
variables could not be resolved, because the template variables are out-of-scope of the
template element itself.

Closes #49931

PR Close #52453
2025-09-17 16:05:04 +00:00
Kristiyan Kostadinov
7fd3db0423 fix(compiler-cli): remove internal syntax-related flags (#63787)
Removes the `_enableBlockSyntax` and `_enableLetSyntax` flags in favor of detecting them based on the Angular version.

PR Close #63787
2025-09-16 16:51:17 +00:00
Matthieu Riegler
6dff287bb8 refactor(compiler-cli): Add a diagnostic to detect forbiden invocations of required initializers (#63614)
The diagnostic will raise an error when required initializers (input, model, queries) are invoked the context of property initializers and contructors.

Docs will be provided in a follow-up

fixes #63602

PR Close #63614
2025-09-15 19:34:32 +00:00
Kristiyan Kostadinov
0a60e355e1 fix(compiler-cli): signal not invoked diagnostic not raised when input has same name in template (#63754)
The diagnostic that flags signals which haven't been invoked has some logic to skip over inputs, however it was looking at the used directives across the entire template, not the ones on the specific node.

Fixes #63739.

PR Close #63754
2025-09-15 15:50:45 +00:00
Matthieu Riegler
4d535cfaa4 refactor(core): Error logs links point to the archived version of the docs (#63512)
In order to point the right context, links in error messages will target the archived version of the online doc site (v*.angular.io).

See #44650

PR Close #63512
2025-09-10 22:21:10 +00:00
Kristiyan Kostadinov
0571b335b9 feat(compiler-cli): enable type checking of host bindings by default (#63654)
Type checking of host bindings was added in v20. We're now confident enough in it to enable it by default.

BREAKING CHANGE:
* Previously hidden type issues in host bindings may show up in your builds. Either resolve the type issues or set `"typeCheckHostBindings": false` in the `angularCompilerOptions` section of your tsconfig.

PR Close #63654
2025-09-09 14:34:29 -07:00
Matthieu Riegler
8e8a3fe8cf refactor(compiler-cli): add support for if/switch to the non-invoked signal diagnostic (#63502)
This commit adds the support to the existing "interpolated_signal_not_invoked" diagnostic (even though it's not really a interpolation)

PR Close #63502
2025-09-08 13:17:04 -07:00
Kristiyan Kostadinov
c0791e1887 fix(core): drop support for TypeScript 5.8 (#63589)
Updates the version range to drop support for TypeScript 5.8.

BREAKING CHANGE:
* TypeScript versions less than 5.9 are no longer supported.

PR Close #63589
2025-09-05 13:54:40 -07:00
Hongxu Xu
1f4c5f72aa refactor(bazel): reduce build deps (#63348)
clean up deps in bazel build scripts

PR Close #63348
2025-08-28 09:16:10 -07:00
Joey Perrott
2fcafb65c5 build: rename defaults2.bzl to defaults.bzl (#63383)
Use defaults.bzl for the common macros

PR Close #63383
2025-08-25 15:45:01 -07:00
Kristiyan Kostadinov
7bf4906f27 fix(compiler-cli): account for expression with type arguments during HMR extraction (#63261)
Fixes that the HMR extraction logic didn't accoubnt for expressions with type arguments (e.g. `viewChild('foo', {read: TemplateRef<unknown>})`).

Fixes #63240.

PR Close #63261
2025-08-20 11:31:43 +00:00
ivanwonder
eeeaadc7e9 fix(language-service): Support to resolve the re-export component. (#62585)
In the context of TypeScript (TS), a re-exported symbol is considered a distinct symbol.
This means that a developer can choose to import either the re-exported symbol or
the original symbol. However, in the context of Angular, the re-exported symbol
is treated as the same component because it uses the same selector.

This pull request will utilize the most recent re-export component file to
resolve the module specifier.

PR Close #62585
2025-08-20 09:39:56 +00:00
Jonathan Meier
be7110342b fix(compiler-cli): disallow compiling with the emitDeclarationOnly TS compiler option enabled (#61609)
Running the Angular compiler with declaration-only emission is dangerous
because Angular does not yet support this mode as it relies on the Ivy
compilation which does not run in this mode

In the best case, everything works fine as incidentally there's no
difference in the emitted type declarations (e.g. this is the case for
TS files containing no Angular annotations or only `@Injectable`
annotations).

In the worst case, compilation silently fails in that the compilation
succeeds but the resulting type declarations are missing the Angular
type information and are therefore incomplete. This happens for all
components, directives and modules.

BREAKING CHANGE: The Angular compiler now produces an error when the
the `emitDeclarationOnly` TS compiler option is enabled as this mode is
not supported.

PR Close #61609
2025-08-14 13:03:54 +02:00
Matthieu Riegler
93c735cae7 docs: fix edit links for block/element api entries (#62766)
PR Close #62766
2025-08-14 13:03:00 +02:00
Joey Perrott
c35c0c7f2f build: update to bazel 7.6.0 (#63096)
Update to later version of bazel

PR Close #63096
2025-08-14 13:01:30 +02:00
Paul Gschwendtner
ea78278635 refactor(compiler-cli): ensure JIT transforms with queries work with closure property renaming (#63123)
This map for the JIT transforms accidentally is property-renamed,
breaking the lookups below. This commit fixes this.

PR Close #63123
2025-08-12 13:24:09 -07:00
Kristiyan Kostadinov
a409534d6c feat(core): support as aliases on else if blocks (#63047)
Expands support for the `as` keyword to `@else if` blocks. Previously it was only allowed on `@if`.

PR Close #63047
2025-08-08 08:43:00 -07:00
Kristiyan Kostadinov
c77e51930d fix(compiler-cli): error when type checking host bindings of generic directive (#63061)
Fixes that the compiler was throwing an error if type checking of host bindings is enabled for a generic directive. The problem was that we were always using the `TcbNonGenericDirectiveTypeOp`.

Fixes #63052.

PR Close #63061
2025-08-08 08:42:23 -07:00
Andrew Scott
812463c563 fix(compiler-cli): Ignore diagnostics on ngTemplateContextGuard lines in TCB (#63054)
Deprecated diagnostics can appear on the context guard becaues the
directive itself may be deprecated.

For example, context guards look like `if (i1.NgForOf.ngTemplateContextGuard(_t8, _t9) /*331,378*/) {...}`
and typescript will report the deprecation on the whole element, from
start to end tag, because the span for that node includes it.

fixes https://github.com/angular/vscode-ng-language-service/issues/2203

PR Close #63054
2025-08-07 15:38:38 -07:00
Andrew Scott
45b030b5ce fix(compiler-cli): prevent dom event assertion in TCB generation on older angular versions (#63053)
This fixes an issue caused by
https://github.com/angular/angular/pull/62648 for older versions of
Angular when the newest version of the language service is used. This
prevents the TCB from attempting to use the assertType when it does not
exist.

fixes #63046

PR Close #63053
2025-08-07 15:37:54 -07:00
Ryan Bendel
d24d5742db feat(platform-browser): Add IsolatedShadowDom encapsulation method (#62723)
IsolatedShadowDom encapsulation fixes style leakage in Shadowdom encapsulation by removing sharedstyleshost from dom-renderer IsolatedShadowdom class. Updates docs.

PR Close #62723
2025-08-06 16:48:37 +02:00
ivanwonder
b78de31c94 refactor(language-service): handle the undefined value of a symbol for a type (#63002)
using the `getSymbol` instead of the `type.symbol`, for the primitive type,
the `type.symbol` returns the `undefined` value. The return type of `getSymbol`
includes `undefined`, while `type.symbol` does not.

For example:

```ts
class BarComponent {
   /**
   * @deprecated
   */
  name = ""
}
```

The type of `name` is `string`, the `type.symbol` for the `string`
returns `undefined` here.

e3ef7ff50d/src/services/types.ts (L111)
e3ef7ff50d/src/compiler/types.ts (L6445)

PR Close #63002
2025-08-06 16:46:40 +02:00
Joey Perrott
fa8d8b8396 build: migrate all npm packages to use new rules_js based npm_package rule (#62954)
Use a common rule for all npm_packages

PR Close #62954
2025-08-05 19:08:45 +00:00