diff --git a/package.json b/package.json index d599635..3b0c1b9 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@types/node": "^18.11.18", "@types/prettier": "^2.7.2", "@types/react": "^18.0.26", + "@types/react-no-ssr": "^1.1.3", "@types/react-dom": "^18.0.10", "@typescript-eslint/eslint-plugin": "^5.47.1", "@typescript-eslint/parser": "^5.47.1", diff --git a/src/components/render/DisplayIconSingle.tsx b/src/components/render/DisplayIconSingle.tsx index 98b2b41..57e095d 100644 --- a/src/components/render/DisplayIconSingle.tsx +++ b/src/components/render/DisplayIconSingle.tsx @@ -27,6 +27,7 @@ const IconInternal: FunctionComponent = ({label, children}) = } const DisplayIconSingle: FunctionComponent = ({setId, id}) => { + // eslint-disable-next-line const IconSet = loadable.lib(() => getIcons(setId)); return } > diff --git a/src/utils/getIcons.ts b/src/utils/getIcons.ts index e9a70df..06eb9d8 100644 --- a/src/utils/getIcons.ts +++ b/src/utils/getIcons.ts @@ -1,4 +1,5 @@ import codegen from "babel-plugin-codegen/macro"; +import {IconType} from "react-icons"; /* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call */ // language=JavaScript @@ -13,7 +14,7 @@ const fn = codegen` `; /* eslint-enable */ -export function getIcons(id: string) { +export function getIcons(id: string): Promise<{[id: string]: IconType}> { /* Dynamic Import with improved performance. Macros are used to avoid bundling unnecessary modules. diff --git a/yarn.lock b/yarn.lock index 82cab6b..ed67976 100644 --- a/yarn.lock +++ b/yarn.lock @@ -244,6 +244,13 @@ dependencies: "@types/react" "*" +"@types/react-no-ssr@^1.1.3": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@types/react-no-ssr/-/react-no-ssr-1.1.3.tgz#895baced8f49e270289c8ad11be1a4a50328d243" + integrity sha512-uMR17qGISe0qTTiVFuRfatP+9plEe/Q0beQ47xy0OXatwb3Z2bEj3OW7FC+9PVqCYEsfR4b01LU9tXw2urzBzw== + dependencies: + "@types/react" "*" + "@types/react@*", "@types/react@^18.0.26": version "18.0.28" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.28.tgz#accaeb8b86f4908057ad629a26635fe641480065"