Skip to content

Don't import Rollbar as a namespace in the Angular example #1278

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

Merged
merged 1 commit into from
Aug 4, 2025

Conversation

matux
Copy link
Contributor

@matux matux commented Aug 4, 2025

Description of the change

The Angular example was importing Rollbar as a namespace which was causing these errors during npm run build:

 [ERROR] TS2709: Cannot use namespace 'Rollbar' as a type. [plugin angular-compiler]

    src/app/app.component.ts:17:27:
      17    private rollbar = inject<Rollbar>(RollbarService);
                                     ~~~~~~~


 [ERROR] TS2709: Cannot use namespace 'Rollbar' as a type. [plugin angular-compiler]

    src/app/rollbar.errorhandler.ts:6:49:
      6  export const RollbarService = new InjectionToken<Rollbar>('rollbar');
                                                          ~~~~~~~

It's not recommended to import Rollbar as a namespace:
https://docs.rollbar.com/docs/importing-or-requiring-rollbar#namespace-import-syntax-not-recommended

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

Related issues

SDK-518/make-sure-all-sdk-examples-work-properly

@matux matux requested a review from Copilot August 4, 2025 19:24
@matux matux self-assigned this Aug 4, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes TypeScript compilation errors in the Angular example by changing from namespace imports to default imports for Rollbar, following the recommended import pattern from Rollbar's documentation.

  • Changes Rollbar import from namespace syntax (import * as Rollbar) to default import syntax (import Rollbar)
  • Resolves TS2709 compilation errors that occurred during npm run build

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
examples/angular/src/app/rollbar.errorhandler.ts Updates Rollbar import from namespace to default import
examples/angular/src/app/app.component.ts Updates Rollbar import from namespace to default import

@matux matux enabled auto-merge (squash) August 4, 2025 19:26
@matux matux merged commit 40ec52f into master Aug 4, 2025
4 checks passed
@matux matux deleted the matux/fix-angular-example branch August 4, 2025 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants