Skip to content

Commit 691ffeb

Browse files
committed
fix type error on react18.
1 parent 03abaf8 commit 691ffeb

File tree

9 files changed

+31
-24
lines changed

9 files changed

+31
-24
lines changed

__tests__/device.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ test("usePlayerDevice is not wrapped with Provider", () => {
4747
test("In case useSpotifyPlayer returns null", () => {
4848
mockUseSpotifyPlayer.mockReturnValue(null);
4949
const { result } = renderHook(() => usePlayerDevice(), {
50-
initialProps: {
51-
playbackStateAutoUpdate: true,
52-
playbackStateUpdateDuration_ms: 1000,
53-
},
5450
wrapper: DeviceProvider,
5551
});
5652

package-lock.json

Lines changed: 15 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"@testing-library/react": "^11.2.6",
3232
"@testing-library/react-hooks": "^5.1.2",
3333
"@types/jest": "^26.0.22",
34-
"@types/react": "^17.0.3",
35-
"@types/react-dom": "^17.0.3",
34+
"@types/react": "^18.2.8",
35+
"@types/react-dom": "^18.2.4",
3636
"husky": "^6.0.0",
3737
"jest": "^26.6.3",
3838
"lint-staged": "^10.5.4",

src/device.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export type PlayerDevice = Spotify.WebPlaybackInstance & {
88

99
const DeviceContext = createContext<PlayerDevice | null | undefined>(undefined);
1010

11-
export const DeviceProvider: React.FC = ({ children }) => {
11+
export const DeviceProvider: React.FC<{ children?: React.ReactNode }> = ({
12+
children,
13+
}) => {
1214
const [device, setDevice] = useState<PlayerDevice | null>(null);
1315
const player = useSpotifyPlayer();
1416

src/errorState.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ export type ErrorState = Spotify.Error & { type: Spotify.ErrorTypes };
66

77
const ErrorStateContext = createContext<ErrorState | null | undefined>(undefined);
88

9-
export const ErrorStateProvider: React.FC = ({ children }) => {
9+
export const ErrorStateProvider: React.FC<{ children?: React.ReactNode }> = ({
10+
children,
11+
}) => {
1012
const [errorState, setErrorState] = useState<ErrorState | null>(null);
1113
const player = useSpotifyPlayer();
1214

src/playbackState.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ const PlaybackStateContext = createContext<Spotify.PlaybackState | null | undefi
66
undefined,
77
);
88

9-
export const PlaybackStateProvider: React.FC = ({ children }) => {
9+
export const PlaybackStateProvider: React.FC<{ children?: React.ReactNode }> = ({
10+
children,
11+
}) => {
1012
const [playbackState, setPlaybackState] = useState<Spotify.PlaybackState | null>(
1113
null,
1214
);

src/spotifyPlayer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type ProviderProps = {
1515
getOAuthToken: Spotify.PlayerInit["getOAuthToken"];
1616
initialVolume?: Spotify.PlayerInit["volume"];
1717
connectOnInitialized: boolean;
18+
children?: React.ReactNode;
1819
};
1920

2021
export const SpotifyPlayerProvider: React.FC<ProviderProps> = ({

src/webPlaybackSDK.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type WebPlaybackSDKProps = {
1111
getOAuthToken: Spotify.PlayerInit["getOAuthToken"];
1212
initialVolume?: Spotify.PlayerInit["volume"];
1313
connectOnInitialized?: boolean;
14+
children?: React.ReactNode;
1415
};
1516

1617
export const WebPlaybackSDK: React.FC<WebPlaybackSDKProps> = ({

src/webPlaybackSDKReady.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { MUST_BE_WRAPPED_MESSAGE } from "./constant";
33

44
const WebPlaybackSDKReadyContext = createContext<boolean | undefined>(undefined);
55

6-
export const WebPlaybackSDKReadyProvider: React.FC = ({ children }) => {
6+
export const WebPlaybackSDKReadyProvider: React.FC<{
7+
children?: React.ReactNode;
8+
}> = ({ children }) => {
79
const [webPlaybackSDKReady, setWebPlaybackSDKReady] = useState(false);
810

911
useEffect(() => {

0 commit comments

Comments
 (0)