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

New version is not compatible with noImplicitAny #3464

Closed
ghost opened this issue Nov 14, 2019 · 2 comments · Fixed by #3529
Closed

New version is not compatible with noImplicitAny #3464

ghost opened this issue Nov 14, 2019 · 2 comments · Fixed by #3529

Comments

@ghost
Copy link

ghost commented Nov 14, 2019

To reproduce:

  1. Open https://stackblitz.com/edit/angular-qcxzee
  2. Download Project
  3. Do npm install
  4. Do ng build. No errors ✔️
  5. Edit tsconfig.json: add "noImplicitAny": true, to compilerOptions
  6. Do ng build. Build fails ❌

Error:

ERROR in src/app/modal-component.ts(39,11): error TS7022: 'modalRef' implicitly
has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
  1. Downgrade ng-bootstrap: npm i @ng-bootstrap/ng-bootstrap@5.1.1
  2. Do ng build. No errors ✔️

The error is caused by this code:

const modalRef = this.modalService.open(NgbdModalContent, {
  beforeDismiss: () => modalRef.componentInstance.canDismiss(),
});

Which was originally inspired by #2904 (comment)

@maxokorokov
Copy link
Member

maxokorokov commented Nov 14, 2019

@nseni I guess the workaround for you should be... adding a type :)

I think this works for me:

const modalRef: NgbModalRef<typeof NgbdModalContent>

But we broke it in a patch 5.1.2 release, so I'll rollback the change in 5.1.5.

@laserus
Copy link

laserus commented Apr 11, 2021

@maxokorokov Oh, no. You broke my type usage, now I cannot upgrade, it says NgbModalRef is not generic....

gentoo90 added a commit to gentoo90/ng-bootstrap that referenced this issue Apr 19, 2021
gentoo90 added a commit to gentoo90/ng-bootstrap that referenced this issue Jan 30, 2022
gentoo90 added a commit to gentoo90/ng-bootstrap that referenced this issue Oct 17, 2023
gentoo90 added a commit to gentoo90/ng-bootstrap that referenced this issue Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants