mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(forms): guard unsupportedFeatureError with ngDevMode
Move unsupportedFeatureError message behind ngDevMode to keep it dev-only and allow proper tree-shaking.
This commit is contained in:
committed by
Andrew Kushnir
parent
66e8385b6a
commit
f50ec42f15
@@ -346,7 +346,7 @@ export class SignalFormControl<T> extends AbstractControl {
|
||||
|
||||
override set dirty(_: boolean) {
|
||||
throw unsupportedFeatureError(
|
||||
'Setting dirty directly is not supported. Instead use markAsDirty().',
|
||||
ngDevMode && 'Setting dirty directly is not supported. Instead use markAsDirty().',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ export class SignalFormControl<T> extends AbstractControl {
|
||||
|
||||
override set pristine(_: boolean) {
|
||||
throw unsupportedFeatureError(
|
||||
'Setting pristine directly is not supported. Instead use reset().',
|
||||
ngDevMode && 'Setting pristine directly is not supported. Instead use reset().',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -366,7 +366,8 @@ export class SignalFormControl<T> extends AbstractControl {
|
||||
|
||||
override set touched(_: boolean) {
|
||||
throw unsupportedFeatureError(
|
||||
'Setting touched directly is not supported. Instead use markAsTouched() or reset().',
|
||||
ngDevMode &&
|
||||
'Setting touched directly is not supported. Instead use markAsTouched() or reset().',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -376,7 +377,7 @@ export class SignalFormControl<T> extends AbstractControl {
|
||||
|
||||
override set untouched(_: boolean) {
|
||||
throw unsupportedFeatureError(
|
||||
'Setting untouched directly is not supported. Instead use reset().',
|
||||
ngDevMode && 'Setting untouched directly is not supported. Instead use reset().',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user