Skip to content

Type 'AngularPlugin' is not assignable to type 'ITelemetryPlugin', Angular 15 ( "@angular/common": "15.1.0") error when trying to build the projectΒ #97

Closed

Description

@hladysh

error TS2322: Type 'AngularPlugin' is not assignable to type 'ITelemetryPlugin'.
Types of property 'setNextPlugin' are incompatible.

import { AngularPlugin } from '@microsoft/applicationinsights-angularplugin-js';

    const angularPlugin = new AngularPlugin();
    this.appInsights = new ApplicationInsights({
        config: {
            instrumentationKey: 'key',
            enableAutoRouteTracking: false, // option to log all route changes
            enableCorsCorrelation: true,
            extensions: [angularPlugin],
            extensionConfig: {
                [angularPlugin.identifier]: { router: this.router },
            },
        },
    });
    this.appInsights.loadAppInsights();

extensions: [angularPlugin],
                            ~~~~~~~~~~~~~

"@microsoft/applicationinsights-angularplugin-js": "3.0.1",
"@microsoft/applicationinsights-web": "2.8.9",
"@angular/common": "15.1.0",
"typescript": "4.9.4",

Activity

  1. MSNev commented on Feb 17, 2023

    @MSNev
    Contributor

    Which versions of the plugin and ApplicationInsights are you using?

    We recently release v3.0.1 of the angular plugin which moved the base version of Application Insights to 2.8.10 to address this issue (which is typescript being more pedantic than necessary) #76

    You can safely cast to any to bypass the error, we believe we tracked this down to a change we made to introduce an optional unload function. As we support backward compatibility of the newer ApplicationInsights using older components (plugins).

    If your not using 3.0.1 and 2.8.10 can you please upgrade both (or use the workaround by casting as any to avoid TypeScript complaining).

  2. hladysh commented on Feb 20, 2023

    @hladysh
    Author

    problem was fixed after the update "@microsoft/applicationinsights-web": "2.8.9", to "@microsoft/applicationinsights-web": "2.8.10"

  3. added a commit that references this issue on Apr 21, 2023
  4. OzBob commented on May 12, 2023

    @OzBob

    Nev (@MSNev) the dependencies between the 2 projects are inconsistent.
    Will these old versions ^2.8.12 be upgraded to ^3.0.1?
    https://github.com/microsoft/applicationinsights-angularplugin-js/blob/main/package.json#L67

       "@microsoft/applicationinsights-common": "^2.8.12",
        "@microsoft/applicationinsights-core-js": "^2.8.12",
        "@microsoft/applicationinsights-properties-js": "^2.8.12",
    

    To match the dependencies of '@microsoft/applicationinsights-web'? i.e. v3.0.1?

    For now I will experiment and downgrade @microsoft/applicationinsights-web to v2.8.13

  5. self-assigned this
    on Jun 22, 2023
  6. david-brink-talogy commented on Jul 13, 2023

    @david-brink-talogy

    Is there any update? This still occurs when using the most current version of both these packages

        "@microsoft/applicationinsights-angularplugin-js": "^3.0.1",
        "@microsoft/applicationinsights-web": "^3.0.2",
    
  7. MSNev commented on Jul 13, 2023

    @MSNev
    Contributor

    Still in progress (sorry delay as I was OOF last week), the plan is to finalize the updates and release the update by / before the end of July 23.

  8. david-brink-talogy commented on Aug 1, 2023

    @david-brink-talogy

    Doesn't appear there's been a release still. Can we get this fixed?

  9. MSNev commented on Aug 1, 2023

    @MSNev
    Contributor

    Correct, some other items got in the way of completing and publishing an update, and as part of the next release we want to bump the major version number we also want to consider including some of the community PR's as part of the release(s) (as one of them is bumping to Angular 15) So unlike the react / react-native plugins (which we have release) this one requires some additional time. But we are still working towards publishing as soon as possible (which is now mid to end of Aug 23 ☹️ )

  10. david-brink-talogy commented on Aug 1, 2023

    @david-brink-talogy

    That's unfortunate a seemingly small issue with dependency versions has lingered for so long. You're aware Angular 16 has been out for three months already?

  11. MSNev commented on Aug 1, 2023

    @MSNev
    Contributor

    Yes, it is unfortunate. 😦

    On the Angular 16, No we didn't know (as we don't actual code in Angular, React or React-Native except for these plugins) we are relying on the community to keep us up to date and then we "attempt" (not very well recently) to keep things in sync.

    Or primary goal is to provide a standard (which often means lowest common denominator) "support" for the current frameworks with the current release of Application Insights. AI 3.x is a significant internal change and has required a lot more time than originally estimated.

    One of the reasons for the renumbering (which will also require branching) is so that we can better support multiple versions of the framework with less cognitive hoops (compatibility lookup tables) so that
    plugin 14 => Angular 14
    plugin 15 => Angular 15
    plugin 16 => Angular 16

    Where the main branch will always be the "current" and we will create branches for the older versions (to enable patching) at the point of upgrading main to a newer release.

    Not that any of the above wording helps you and the current state.

    We are hoping that once we complete the v14 release with AI v3.x support (we already have this 2nd part checked in) things should get smoother.
    To complete v14 we need to review the changes proposed in #103 and potentially #114 and take over / incorporate into a new PR's, but as this is not our primary domain we also need to ramp up and understand the changes (after we finish the current tasks which are affecting the timeline)

  12. siyuniu-ms commented on Oct 2, 2023

    @siyuniu-ms
    Contributor
  13. pranjalja1n commented on Jun 26, 2025

    @pranjalja1n

    This issue has been revived because of another update of the @microsoft/applicationinsights-web package. v3.3.9 is the latest (published 2 hrs ago as of writing) but v3.3.8 broke the typings as well. I suspect that's just due to the outdated dependencies in this package. Can we get an update?

  14. MSNev commented on Jul 2, 2025

    @MSNev
    Contributor

    Assigning Co-Pilot to see if there is something we a missing with our current assumptions on why this is happening

  15. blazekv commented on Dec 5, 2025

    @blazekv

    I have same issue with this versions

        "@microsoft/applicationinsights-angularplugin-js": "15.3.8",
        "@microsoft/applicationinsights-web": "3.3.10",
    
  16. MSNev commented on Dec 5, 2025

    @MSNev
    Contributor

    I have same issue with this versions

        "@microsoft/applicationinsights-angularplugin-js": "15.3.8",
        "@microsoft/applicationinsights-web": "3.3.10",
    

    Check your lock file -- perform a full clean, I suspect that while you have changed your package.json you still have an older version being used

  17. blazekv commented on Dec 9, 2025

    @blazekv

    Sorry, my bad, you are right. It looks like it was still cached. These versions work.

  18. added this to the 15.4.0 milestone on Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions