Skip to content

Commit

Permalink
chore: fix ngDevMode
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Nov 6, 2023
1 parent 66e612d commit c0c518e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions packages/abc/date-picker/range.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: '<nz-range-picker [(ngModel)]="i.start" extend [(ngModelEnd)]="i.end" shortcut></nz-range-picker>'`
);
if (typeof ngDevMode === 'undefined' || ngDevMode) {
assert(
!!nativeComp,
`It should be attached to nz-range-picker component, for example: '<nz-range-picker [(ngModel)]="i.start" extend [(ngModelEnd)]="i.end" shortcut></nz-range-picker>'`
);
}
const cog = configSrv.merge('dataRange', {
nzFormat: 'yyyy-MM-dd',
nzAllowClear: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/util/other/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]`}`
);
Expand Down

0 comments on commit c0c518e

Please sign in to comment.