y-hiraoka / react-spotify-web-playback-sdk

A React wrapper for Spotify Web Playback SDK.
https://react-spotify-web-playback-sdk.vercel.app
MIT License
60 stars 3 forks source link

Property 'children' does not exist on type 'IntrinsicAttributes & WebPlaybackSDKProps #2

Closed chuettenrauch closed 1 year ago

chuettenrauch commented 1 year ago

Hey there, first of all, thanks for this package!

I'd love to use it in my React 18.2.0 App, but I get the following error:

TS2322: Type '{ children: Element; initialDeviceName: string; getOAuthToken: (callback: (token: string) => void) => void; initialVolume: number; connectOnInitialized: true; }' is not assignable to type 'IntrinsicAttributes & WebPlaybackSDKProps'.   Property 'children' does not exist on type 'IntrinsicAttributes & WebPlaybackSDKProps'

My code is:

<WebPlaybackSDK
    initialDeviceName="Test device"
    getOAuthToken={getOAuthToken}
    initialVolume={1}
    connectOnInitialized={true}
>
    <TestPlay/>
</WebPlaybackSDK>
export default function TestPlay() {
    const player = useSpotifyPlayer();

    return (
        <>
            {player &&
              <div>
                <button onClick={() => player.resume()}>Resume</button>
                <button onClick={() => player.pause()}>Pause</button>
              </div>
            }
        </>
    )
}

Any ideas, what I'm missing? Or is this due to missing React 18 support?

Best regards

zzulanas commented 1 year ago

Also having this problem, would love to get an update on it

chuettenrauch commented 1 year ago

@zzulanas FYI: Adding @ts-ignore works as a temporary solution:

 /* @ts-ignore */
<WebPlaybackSDK
    initialDeviceName="Test device"
    getOAuthToken={getOAuthToken}
    initialVolume={1}
    connectOnInitialized={true}
>
y-hiraoka commented 1 year ago

Thanks for your reporting! I fixed it. https://github.com/y-hiraoka/react-spotify-web-playback-sdk/releases/tag/v3.0.2