Skip to content

Commit

Permalink
fix(compiler-cli): fix broken version detection condition
Browse files Browse the repository at this point in the history
The version detection condition for signal two-way bindings used an OR
instead of an AND, resulting in every `.0` patch version being considered
as supporting two-way bindings to signals.

This commit fixes the logic and adds additional parentheses to ensure the
meaning of the condition is more clear. Long term, we should switch to
semver version parsing instead.
  • Loading branch information
alxhub committed Feb 14, 2024
1 parent edd10ac commit 46089eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/compiler-cli/src/ngtsc/core/src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,8 @@ export class NgCompiler {
// two-way bindings. We also allow version 0.0.0 in case somebody is using Angular at head.
const allowSignalsInTwoWayBindings = this.angularCoreVersion === null ||
this.angularCoreVersion.major > 17 ||
this.angularCoreVersion.major === 17 && this.angularCoreVersion.minor >= 2 ||
(this.angularCoreVersion.major === 0 && this.angularCoreVersion.minor === 0 ||
(this.angularCoreVersion.major === 17 && this.angularCoreVersion.minor >= 2) ||
(this.angularCoreVersion.major === 0 && this.angularCoreVersion.minor === 0 &&
this.angularCoreVersion.patch === 0);

// First select a type-checking configuration, based on whether full template type-checking is
Expand Down

0 comments on commit 46089eb

Please sign in to comment.