Closed chenrui333 closed 2 years ago
Hi @chenrui333, the reason typescript is complaining is because withLDProvider
now provides better support for component prop type using typescript generics, when a type isnt provided, it defaults to React's default component type of {}
which is incompatible with your prop type AppProps
.
To resolve your issue you must pass your component's type to withLDProvider
like so:
import "../styles/globals.css";
import { withLDProvider } from "launchdarkly-react-client-sdk";
function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}
export default withLDProvider<AppProps>({
clientSideID: process.env.LAUNCHDARKLY_SDK_CLIENT,
user: identifyLDUser(),
options: {
streaming: false
},
reactOptions: {
useCamelCaseFlagKeys: false
}
})(MyApp);
Try the above and let me know if it works for you.
Thanks @ctawiah, let me give a shot now. Cheers!
works for me, closing the issue.
Is this a support request?
Yes.
Describe the bug Have run into some type mismatch when upgrading the react-client-sdk
To reproduce
_app.ts
:Expected behavior Pass the type checking.
Logs See above with the console printout.
SDK version 2.23.1 and 2.23.2. It works with 2.22.3
Language version, developer tools For instance, Go 1.11 or Ruby 2.5.3. If you are using a language that requires a separate compiler, such as C, please include the name and version of the compiler too.