You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which @angular/* package(s) are the source of the bug?
forms
Is this a regression?
No
Description
Hello everyone!
I'm not sure but seems it's strange behaviour when I try to instantiate FormControl<string> object. I have enabled strict mode for TypeScript and then I've got the next error message from compiler:
error TS2322: Type 'FormControl<string | null>' is not assignable to type 'FormControl<string>'.
Type 'string | null' is not assignable to type 'string'.
Type 'null' is not assignable to type 'string'.
I don't wanna change generic type of declared variable to string | null. I absolutely know that null value isn't possible and it must be forbiden to assign. Field is initialized with empty string in the constructor. If null is possible then once it will be certainly happened .
I think that this behaviour should be changed.
error TS2322: Type 'FormControl<string | null>' is not assignable to type 'FormControl<string>'.
Type 'string | null' is not assignable to type 'string'.
Type 'null' is not assignable to type 'string'.
Please provide the environment you discovered this bug in (run ng version)
Which @angular/* package(s) are the source of the bug?
forms
Is this a regression?
No
Description
Hello everyone!
I'm not sure but seems it's strange behaviour when I try to instantiate
FormControl<string>
object. I have enabled strict mode for TypeScript and then I've got the next error message from compiler:I don't wanna change generic type of declared variable to
string | null
. I absolutely know thatnull
value isn't possible and it must be forbiden to assign. Field is initialized with empty string in the constructor. Ifnull
is possible then once it will be certainly happened .I think that this behaviour should be changed.
It's relative to #13721 feature.
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/angular-ivy-n7wfaq?file=src/app/hello.component.ts
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
No response
The text was updated successfully, but these errors were encountered: