-
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.
It can easily happen that items are undefined as a change when ngOnChanges is called in GalleryComponent. This is a deficiency of the Angular's types that this is not checked, and it slipped through my test suite as well. So I created a stricter type that will keep the possibility of changes being undefined in check and reorganized the test so that the ngOnChanges with undefined `items` change is checked as well.
- Loading branch information
Showing
3 changed files
with
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
import { ComponentRef } from '@angular/core'; | ||
import { ComponentRef, SimpleChange, SimpleChanges } 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; | ||
} | ||
|
||
export type StrictSimpleChanges<T> = SimpleChanges & { | ||
[propName in keyof T]: SimpleChange | undefined; | ||
}; |