From 603bcfce1d8d0eadc3bcfc8b64c56ffd5b9180b8 Mon Sep 17 00:00:00 2001 From: Sungyu Kang Date: Sat, 20 Apr 2024 22:47:09 +0900 Subject: [PATCH] fix: gets the name of the function as a key (#38) * fix: gets the name of the function as a key * unused code --- .eslintrc.cjs | 1 + packages/react-native/src/createWebView.tsx | 15 +++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 90b31611..eb470bf9 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -25,5 +25,6 @@ module.exports = { "simple-import-sort/imports": "error", "simple-import-sort/exports": "error", "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-unused-vars": "off", }, }; diff --git a/packages/react-native/src/createWebView.tsx b/packages/react-native/src/createWebView.tsx index 50060589..ca6799aa 100644 --- a/packages/react-native/src/createWebView.tsx +++ b/packages/react-native/src/createWebView.tsx @@ -1,9 +1,4 @@ -import type { - AsyncFunction, - Bridge, - BridgeStore, - Primitive, -} from "@webview-bridge/types"; +import type { Bridge, BridgeStore, Primitive } from "@webview-bridge/types"; import { createEvents } from "@webview-bridge/util"; import React, { createRef, @@ -66,10 +61,10 @@ export const createWebView = ({ const bridgeNames = useMemo( () => - Object.values(bridge.getState() ?? {}) - .filter((bridge) => typeof bridge === "function") - .map((func) => { - return `'${(func as AsyncFunction).name}'`; + Object.entries(bridge.getState() ?? {}) + .filter(([_, bridge]) => typeof bridge === "function") + .map(([name]) => { + return `'${name}'`; }), [], );