Add react-no-ssr types, fix compile-time ESLint/type issues

This commit is contained in:
Xevion
2023-02-16 04:33:31 -06:00
parent e83fd2a568
commit d1cb7c3fb8
4 changed files with 11 additions and 1 deletions

View File

@@ -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",

View File

@@ -27,6 +27,7 @@ const IconInternal: FunctionComponent<IconInternalProps> = ({label, children}) =
}
const DisplayIconSingle: FunctionComponent<DisplayIconSingleProps> = ({setId, id}) => {
// eslint-disable-next-line
const IconSet = loadable.lib(() => getIcons(setId));
return <IconSet fallback={<IconInternal label={"Loading..."} />} >

View File

@@ -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.

View File

@@ -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"