From 43df78a9d66c8df396e9645dc19e477498d6b931 Mon Sep 17 00:00:00 2001 From: jadmsaadaot <91914654+jadmsaadaot@users.noreply.github.com> Date: Mon, 18 Sep 2023 08:23:33 -0700 Subject: [PATCH] check if obj on hasKey is object (#2206) --- met-web/src/utils/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/met-web/src/utils/index.ts b/met-web/src/utils/index.ts index 1ffdae549..a291ee300 100644 --- a/met-web/src/utils/index.ts +++ b/met-web/src/utils/index.ts @@ -1,6 +1,9 @@ import { AxiosResponse } from 'axios'; export function hasKey(obj: O, key: PropertyKey): key is keyof O { + if (typeof obj !== 'object' || !obj) { + return false; + } return key in obj; }