Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Type 'ReactNativePlugin' is not assignable to type 'ITelemetryPlugin' #1324

Closed
nairmanu opened this issue Jul 21, 2020 · 7 comments · Fixed by #1325
Closed

[BUG] Type 'ReactNativePlugin' is not assignable to type 'ITelemetryPlugin' #1324

nairmanu opened this issue Jul 21, 2020 · 7 comments · Fixed by #1325
Assignees
Labels
Milestone

Comments

@nairmanu
Copy link

Description/Screenshot

Type 'ReactNativePlugin' is not assignable to type 'ITelemetryPlugin'.
Types of property 'setNextPlugin' are incompatible.
Type '(next: ITelemetryPlugin) => void' is not assignable to type '(next: ITelemetryPlugin | ITelemetryPluginChain) => void'.
Types of parameters 'next' and 'next' are incompatible.
Type 'ITelemetryPlugin | ITelemetryPluginChain' is not assignable to type 'ITelemetryPlugin'.
Type 'ITelemetryPluginChain' is missing the following properties from type 'ITelemetryPlugin': priority, initialize, identifier

Steps to Reproduce
When I add the latest versions of applicationinsights-react-native and applicationinsights-web, I get the above error while trying to create a new instance of ApplicationInsights().
ReactNativePlugin is not accepted as a valid value for extensions array.

yarn add @microsoft/applicationinsights-react-native
yarn add @microsoft/applicationinsights-web

Versions installed are,
"@microsoft/applicationinsights-react-native": "^2.2.5",
"@microsoft/applicationinsights-web": "^2.5.6",

  • OS/Browser:
  • SDK Version [e.g. 22]:
  • How you initialized the SDK:

Expected behavior

Additional context
Add any other context about the problem here.

@MSNev MSNev added the bug label Jul 21, 2020
@MSNev
Copy link
Collaborator

MSNev commented Jul 21, 2020

This issue is a method signature issue only, as a workaround you should be able and can safely cast the plugin to an ITelemetryPlugin when assigning the react-native to the extensions.

The ITelemetryPluginChain property is only used if you are creating a shared instance and reusing across multiple AI instances.

@nairmanu
Copy link
Author

thanks! the workaround seems to do the trick. Is there a plan to fix this in the future releases?

@MSNev MSNev self-assigned this Jul 21, 2020
@MSNev
Copy link
Collaborator

MSNev commented Jul 21, 2020

Yep, about to start working on it now -- should be in next release

@nairmanu
Copy link
Author

thank you!

@MSNev
Copy link
Collaborator

MSNev commented Jul 21, 2020

PR is out -- please have a look as I've applied a couple of changes, specifically

  • fixed this issue, by extending from the new base class
  • refactored to use dynamicProto() -- for better minification
  • as part of the refactoring ALL of the private properties are now closure based instance variables (part of the minification changes), but the big change is that they will no longer be available on the instance.

@MSNev MSNev added the fixed - waiting release PR Committed and waiting deployment label Jul 21, 2020
@MSNev MSNev added this to the 2.5.7 milestone Aug 3, 2020
@MSNev MSNev removed the fixed - waiting release PR Committed and waiting deployment label Aug 11, 2020
@MSNev
Copy link
Collaborator

MSNev commented Aug 11, 2020

Fully Deployed to CDN and NPM as version 2.5.7

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants