From c0c518e9baf844bbfc98ddea031417aa180fc29d Mon Sep 17 00:00:00 2001 From: cipchk Date: Mon, 6 Nov 2023 13:51:42 +0800 Subject: [PATCH] chore: fix ngDevMode --- 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]`}` );