From 2803dc8d593c7a7be4f5addb1c49c96b0f5a6fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=89=B2?= Date: Thu, 9 Nov 2023 20:29:15 +0800 Subject: [PATCH] chore: fix ngDevMode (#1685) --- packages/abc/date-picker/range.directive.ts | 10 ++++++---- packages/util/other/assert.ts | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/abc/date-picker/range.directive.ts b/packages/abc/date-picker/range.directive.ts index c82c3e1e3a..f1458ddbd4 100644 --- a/packages/abc/date-picker/range.directive.ts +++ b/packages/abc/date-picker/range.directive.ts @@ -72,10 +72,12 @@ export class RangePickerDirective implements OnDestroy, AfterViewInit { @Host() @Optional() private nativeComp: NzRangePickerComponent, private vcr: ViewContainerRef ) { - assert( - !!nativeComp, - `It should be attached to nz-range-picker component, for example: ''` - ); + if (typeof ngDevMode === 'undefined' || ngDevMode) { + assert( + !!nativeComp, + `It should be attached to nz-range-picker component, for example: ''` + ); + } const cog = configSrv.merge('dataRange', { nzFormat: 'yyyy-MM-dd', nzAllowClear: true, diff --git a/packages/util/other/assert.ts b/packages/util/other/assert.ts index 781f16e27d..47ca403381 100644 --- a/packages/util/other/assert.ts +++ b/packages/util/other/assert.ts @@ -5,7 +5,7 @@ declare const ngDevMode: boolean; function throwError(msg: string | null | undefined): void; function throwError(msg: string | null | undefined, actual: unknown, expected: unknown, comparison: string): void; function throwError(msg: string | null | undefined, actual?: unknown, expected?: unknown, comparison?: string): void { - if (ngDevMode) { + if (typeof ngDevMode === 'undefined' || ngDevMode) { throw new Error( `ASSERTION ERROR: ${msg}${comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`}` );