types: improve isDef typing (#7124)

* types: improve isDef typing

* chore: update
This commit is contained in:
neverland
2020-09-07 20:16:54 +08:00
committed by GitHub
parent afe4248799
commit c7303786ae
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ export const isServer: boolean = Vue.prototype.$isServer;
// eslint-disable-next-line @typescript-eslint/no-empty-function
export function noop() {}
export function isDef(val: unknown): boolean {
export function isDef<T>(val: T): val is NonNullable<T> {
return val !== undefined && val !== null;
}