-
Notifications
You must be signed in to change notification settings - Fork 306
Description
🐞 bug report
Is this a regression?
Yes, the previous version in which this bug was not present was: 20.0.3Description
With version 21 the mask directive implemented the FormValueControl interface for signal form support, see https://angular.dev/api/forms/signals/FormValueControl. Notably, this included input properties that are optional in the interface and not used in the mask directive.
Some of these inputs such as readonly or required are native properties of HTML input fields and commonly used by other directives. Therefore, this is unnecessarily restricting the input type so that,
<input nxMask='x' required readonly />
is no longer possible as it flagged by the Angular compiler as
TS2322: Type 'string' is not assignable to type 'boolean'. [plugin angular-compiler]
A workaround is to set
<input nxMask='x' [required]='true' [readonly]='true' />
but the clean solution, given that these inputs are unused and optional in the interface, would be to remove them from the mask directive to minimize overlap.
🔬 Minimal Reproduction
https://stackblitz.com/edit/stackblitz-starters-pinmskip?file=src%2Fmain.ts
🔥 Exception or Error
TS2322: Type 'string' is not assignable to type 'boolean'. [plugin angular-compiler]
🌍 Your Environment
Angular Version: 21.1.3
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI : 21.1.3
Angular : 21.1.3
Node.js : 22.20.0
Package Manager : npm 11.7.0
Operating System : darwin arm64
┌───────────────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 21.1.3 │ 21.1.3 │
│ @angular/cdk │ 21.1.3 │ 21.1.3 │
│ @angular/cli │ 21.1.3 │ 21.1.3 │
│ @angular/common │ 21.1.3 │ 21.1.3 │
│ @angular/compiler │ 21.1.3 │ 21.1.3 │
│ @angular/compiler-cli │ 21.1.3 │ 21.1.3 │
│ @angular/core │ 21.1.3 │ 21.1.3 │
│ @angular/forms │ 21.1.3 │ 21.1.3 │
│ @angular/platform-browser │ 21.1.3 │ 21.1.3 │
│ @angular/platform-browser-dynamic │ 21.1.3 │ 21.1.3 │
│ @angular/router │ 21.1.3 │ 21.1.3 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 5.9.3 │ ~5.9.3 │
│ vitest │ 4.0.18 │ ^4.0.18 │
└───────────────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
Happy to open a PR.