From 0716abf3b9a16f0224220ef7bb554b793e7f507a Mon Sep 17 00:00:00 2001 From: fsubal Date: Tue, 24 Aug 2021 21:24:47 +0900 Subject: [PATCH 1/2] use void 0 for undefined ({})[0] can still be replaced to something else --- src/utils/helper.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils/helper.ts b/src/utils/helper.ts index 8e79ae9a0..cba054660 100644 --- a/src/utils/helper.ts +++ b/src/utils/helper.ts @@ -1,6 +1,5 @@ // `undefined` can possibly be replaced by something else. -export const UNDEFINED: undefined = ({} as any)[0] -export const isUndefined = (v: any): v is undefined => v === UNDEFINED +export const isUndefined = (v: any): v is undefined => v === void 0 export const isFunction = (v: any): v is Function => typeof v === 'function' export const noop = () => {} export const mergeObjects = (a: any, b: any) => Object.assign({}, a, b) From a26ae43013cb3ab6c6bb2505b0312e621f171eb8 Mon Sep 17 00:00:00 2001 From: fsubal Date: Tue, 24 Aug 2021 21:41:16 +0900 Subject: [PATCH 2/2] UNDEFINED should be exported --- src/utils/helper.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/helper.ts b/src/utils/helper.ts index cba054660..ae8cbb45c 100644 --- a/src/utils/helper.ts +++ b/src/utils/helper.ts @@ -1,5 +1,6 @@ // `undefined` can possibly be replaced by something else. -export const isUndefined = (v: any): v is undefined => v === void 0 +export const UNDEFINED = void 0 +export const isUndefined = (v: any): v is undefined => v === UNDEFINED export const isFunction = (v: any): v is Function => typeof v === 'function' export const noop = () => {} export const mergeObjects = (a: any, b: any) => Object.assign({}, a, b)