Add stronger types#413
Conversation
| ) => Promise<void>; | ||
| } | ||
|
|
||
| export interface ProviderInterface { |
There was a problem hiding this comment.
Hi, thanks for creating this PR.
The reason why this is typed as any is because it's also like that within the Angular TestBed. Let me think on this for a while longer before deciding to merge this in.
Do you think this could potentially break something?
There was a problem hiding this comment.
Thanks for the feedback. Take your time. I know this is different from the Implementation in Angular and I have been thinking about raising an issue with them as well.
So with all the types I looked at Angular proper (not the Testbed) and adapted accordingly. The imports type is straight from Angular proper.
The providers types I basically looked at what does Angular proper have as type definition and made it a bit more loose. There is a Provider type in Angular, but intentionally I only tried to mimic the structure and not the types. useValue and provide are still any. I basically want to make it easier for people writing tests. Because as it is now you get no auto completion or even error if you make a mistake.
That said I do not know if this could potentially break something.
There was a problem hiding this comment.
I opened an issue in the angular repo: angular/angular#51765
There was a problem hiding this comment.
Apparently the Angular team is already at it: angular/angular#37178
There was a problem hiding this comment.
Thanks @Christian24 , because the Angular team is busy with it I want to wait until they provide the proper types for it. Otherwise it could lead into breaking changes or other things.
There was a problem hiding this comment.
I agree. I subscribed myself to the PR. I will update mine as soon as it is merged.
There was a problem hiding this comment.
Since we're providing better types for inputs and outputs, I kind of want to go forward with this change. Even if the Angular team does not provide it out of the box.
As this is a breaking change, I'll keep it open until our next major release.
What do you think @Christian24 ?
|
Sounds good to me. Do you want me to resolve conflicts or should be just leave it for the next major release? |
|
You can leave it as is for now @Christian24 , thanks! |
|
👋 @Christian24 , I finally see a window to merge this in a new major release. |
|
Sorry @timdeschryver! I was on vacation, so I did not have a look. It looks good to me though. |
|
@Christian24 no worries, I hope you enjoyed your vacation! |
|
@all-contributors please add @Christian24 for code, review |
|
I've put up a pull request to add @Christian24! 🎉 |
* feat: update to Angular 20 (#530) BREAKING CHANGE: The angular minimum version has changed. BEFORE: Angular 17,18,19 were supported. AFTER: Angular 20 (and up) is supported. Reason: The method `TestBed.get` has been removed. * feat: remove animations dependency (#531) BREAKING CHANGE: Angular recommends using CSS animations, https://angular.dev/guide/animations/migration Because of the removal of the animations dependency, the `NoopAnimationsModule` is no longer automatically imported in the render function. BEFORE: The `NoopAnimationsModule` was always imported to the render the component. AFTER: Import the `NoopAnimationsModule` in your render configuration (where needed): ```ts await render(SutComponent, { imports: [NoopAnimationsModule], }); ``` * feat: add stronger types (#413)
Closes #412