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
Typed NgbModalRef #2479
Comments
@michaeljota oh cool, this looks better as compared to previous attempts (see #1923). |
BTW, if you do this it would mean that we would force people to be on TS >= 2.8.x, right? If so, this would be a breaking change... Even if Angular 6 supports TS 2.8 we need to be in-line when it comes to minimal required TS version... |
Yes. I just going to update it to point out that this is breaking change. |
Just what i ran into, if there's some way i can help, let me know! |
@pkozlowski-opensource I'm doing this right now, I manage to do it in a way that current behavior won't break. However, maybe for a next major release you could update it to return |
I was also typing result, but seems work to another PR. 😄 |
Ok, so #2815 was reverted because of #3464, which is sad. |
Feature request:
When you open a modal from the component, you can access to the modal reference. Currently, if you try to access to the
componentInstance
is typed asany
. Same goes withresult
, and the argument ofclose()
method, both typed as any. Typescript 2.8 introducedconditional types
and one of the helper types introduced wasInstanceType<>
, is a generic type that allows to refer to the instance type of a constructor. With that, is easy to typecomponentInstance
.Minimal changes required:
I'll show how I edit the definitions files to accomplish that goal.
This can be used like this
Version of Angular, ng-bootstrap, and Bootstrap:
Angular: Support for Typescript 2.8 was added in version 6.
ng-bootstrap: N/A
NOTE: This should be a major version feature, as is a minimal, but important, breaking change. One of the reasons is that this now would require TS2.8, and the other reason is that this might break with special/complex use cases.
Bootstrap: N/A
The text was updated successfully, but these errors were encountered: