Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow readonly arrays with strictTemplates enabled #843

Closed
dev054 opened this issue Dec 11, 2020 · 1 comment
Closed

Allow readonly arrays with strictTemplates enabled #843

dev054 opened this issue Dec 11, 2020 · 1 comment

Comments

@dev054
Copy link

dev054 commented Dec 11, 2020

🐞 bug report

Is this a regression? No.

Description

Currently we can't pass readonly string[] to dropSpecialCharacters and specialCharacters with strictTemplates enabled.

🔬 Minimal Reproduction

<!-- Argument of type 'readonly [...]' is not assignable to parameter of type 'string[]'.
  The type 'readonly [...]' is 'readonly' and cannot be assigned to the mutable type 'string[]'. ->
<input matInput formControlName="test" mask="testing" [specialCharacters]="specialCharacters">
specialCharacters = ['[', ']', '\\'] as const;

🌍 Your Environment

Angular Version: 10.x.

Anything else relevant? To solve this we can do the following:

dropSpecialCharacters: boolean | string[];
specialCharacters: string[];

- dropSpecialCharacters: boolean | string[];
- specialCharacters: string[];
+ dropSpecialCharacters: boolean | readonly string[];
+ specialCharacters: readonly string[];
@andriikamaldinov1
Copy link
Collaborator

@dev054 Thanks for using Ngx-mask. Pls update to latest version.
It example all work as expected - https://stackblitz.com/edit/stackblitz-starters-epnjbs?file=src%2Fmain.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants