-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The whole codebase relies on `items` being always defined yet this contract was broken in v3 release. I use ngOnChanges since a simple default field value is not enough in cases where `undefined` is assigned to GalleryComponent explicitly. In the test I started using `setInput` which, unlike simple assignment, correctly runs ngOnChanges and marks even OnPush component for check. The default ng's interface for the method is poor however as there is no `keyof Component` checking so I provided my own to cover this blind spot.
- Loading branch information
Showing
5 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ComponentRef } from '@angular/core'; | ||
|
||
export interface StrictComponentRef<C> extends ComponentRef<C> { | ||
// `& string` because otherwise keyof would return string | number | ||
setInput(name: keyof C & string, value: unknown): void; | ||
} |