From b3c686c1e8967caf3313f57f14becbb9fe72ea26 Mon Sep 17 00:00:00 2001 From: ZHAO Jinxiang Date: Mon, 18 Nov 2019 10:07:59 +0800 Subject: [PATCH] fix(module:core): add type guard for isNotNil (#4431) --- components/core/util/check.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/core/util/check.ts b/components/core/util/check.ts index 7b0178f549c..a7d7bd31a51 100644 --- a/components/core/util/check.ts +++ b/components/core/util/check.ts @@ -10,13 +10,11 @@ import { TemplateRef, Type } from '@angular/core'; import { IndexableObject } from '../types/indexable'; -// tslint:disable-next-line:no-any -export function isNotNil(value: any): boolean { +export function isNotNil(value: T): value is NonNullable { return typeof value !== 'undefined' && value !== null; } -// tslint:disable-next-line:no-any -export function isNil(value: any): value is null | undefined { +export function isNil(value: unknown): value is null | undefined { return typeof value === 'undefined' || value === null; }