From 7762bd18981e8da36c226b0c36bbc4c00462371a Mon Sep 17 00:00:00 2001 From: Lukas Weiss Date: Fri, 20 Jan 2023 15:55:36 +0100 Subject: [PATCH] update react to version 18 --- package.json | 12 ++++++------ src/async-data/AsyncView.tsx | 6 +++++- src/location-provider/LocationProvider.tsx | 1 + src/useInterval/__test__/useInterval.test.tsx | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 0562174..b36a3b5 100644 --- a/package.json +++ b/package.json @@ -48,11 +48,11 @@ }, "devDependencies": { "@testing-library/jest-dom": "^5.16.4", - "@testing-library/react": "^12.0.0", - "@testing-library/react-hooks": "^8.0.1", + "@testing-library/react": "^13.4.0", "@types/css-mediaquery": "^0.1.1", "@types/jest": "^28.1.3", - "@types/react": "^17.0.0", + "@types/react": "^18.0.0", + "@types/react-dom": "^18.0.0", "@typescript-eslint/eslint-plugin": "^5.30.0", "@typescript-eslint/parser": "^5.30.0", "css-mediaquery": "^0.1.2", @@ -64,12 +64,12 @@ "jest": "^28.1.1", "jest-environment-jsdom": "^28.1.1", "prettier": "^2.7.1", - "react": "^17.0.2", - "react-dom": "^17.0.2", + "react": "^18.0.0", + "react-dom": "^18.0.0", "ts-jest": "^28.0.5", "typescript": "^4.7.4" }, "peerDependencies": { - "react": "^16.0.0 || ^17.0.0" + "react": "^16.0.0 || ^17.0.0 || ^18.0.0" } } diff --git a/src/async-data/AsyncView.tsx b/src/async-data/AsyncView.tsx index de474f9..2c4fe6c 100644 --- a/src/async-data/AsyncView.tsx +++ b/src/async-data/AsyncView.tsx @@ -39,7 +39,11 @@ const AsyncView = ( <>{renderSuccess} ) case AsyncState.FINISHED_WITH_ERROR: - return isFunction(renderError) ? renderError(error) : <>{renderError} + return isFunction(renderError) ? ( + renderError(error as Error) + ) : ( + <>{renderError} + ) } } diff --git a/src/location-provider/LocationProvider.tsx b/src/location-provider/LocationProvider.tsx index a76b31f..1ff47ad 100644 --- a/src/location-provider/LocationProvider.tsx +++ b/src/location-provider/LocationProvider.tsx @@ -14,6 +14,7 @@ export const LocationContext = createContext({ export const LocationProvider: React.FC<{ highAccuracy: boolean delay: number + children?: React.ReactNode }> = ({ highAccuracy, delay, children }) => { const [location, setLocation] = useState({ location: null, diff --git a/src/useInterval/__test__/useInterval.test.tsx b/src/useInterval/__test__/useInterval.test.tsx index bf96ef7..d13daf0 100644 --- a/src/useInterval/__test__/useInterval.test.tsx +++ b/src/useInterval/__test__/useInterval.test.tsx @@ -1,4 +1,4 @@ -import { cleanup, renderHook } from '@testing-library/react-hooks' +import { cleanup, renderHook } from '@testing-library/react' import { useInterval } from '../useInterval' afterEach(cleanup)