launchdarkly / react-client-sdk

LaunchDarkly Client-side SDK for React.js
Other
86 stars 68 forks source link

Version 3.0.7 introduces incompatibility with @types/react 17.0.43 #224

Open kbaum opened 10 months ago

kbaum commented 10 months ago

Is this a support request? This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going here or by emailing support@launchdarkly.com.

Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.

Describe the bug We use version 17.0.43 of @types/react. When upgrading from 3.0.6 to 3.0.7 of this library, we get the following typescript errors:

node_modules/launchdarkly-react-client-sdk/lib/index.d.ts:195:30 - error TS2694: Namespace 'React' has no exported member 'JSX'.

195     render(): React__default.JSX.Element;
                                 ~~~

node_modules/launchdarkly-react-client-sdk/lib/index.d.ts:246:22 - error TS2694: Namespace 'React' has no exported member 'JSX'.

246 }) => React__default.JSX.Element>;
                         ~~~

node_modules/launchdarkly-react-client-sdk/lib/index.d.ts:283:140 - error TS2694: Namespace 'React' has no exported member 'JSX'.

283 declare function withLDConsumer(options?: ConsumerOptions): <P>(WrappedComponent: React.ComponentType<P & LDProps>) => (props: P) => React.JSX.Element;
                                                                                                                                               ~~~

Found 3 errors in the same file, starting at: node_modules/launchdarkly-react-client-sdk/lib/index.d.ts:195

To reproduce Steps to reproduce the behavior.

Expected behavior No typescript errors.

Logs If applicable, add any log output related to your problem.

SDK version 3.0.7

Language version, developer tools react 17.0.2 @types/react 17.0.43 typescript 4.7.4

OS/platform macOS Ventura 13.5.2

Additional context Version 3.0.6 does not have this issue.

louis-launchdarkly commented 10 months ago

Hello @kbaum, thank you for raising the question. I have filed 224215 internally to track this.

By the way, is this still happening if you try to use 3.0.8 or 3.0.9? We have added some type-export changes and I wonder would those changes help in this case.

jarivalentine commented 6 months ago

This is still happening in version 3.0.10. We are also using react 17.0.2, @types/react 17.0.45 and typescript 4.9.4.

kbaum commented 5 months ago

Sorry. I am on a different project now and do not have access to the original project I posted this about.