mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00: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:
parent
66e8385b6a
commit
f50ec42f15
1 changed files with 5 additions and 4 deletions
|
|
@ -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().',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue