Skip to content

Commit a0d7fbd

Browse files
akabirumyabc
andcommitted
img can be HTMLImgElement | null not undefined
Co-authored-by: Alexander Coles <a.coles@openproject.com>
1 parent 71c9af6 commit a0d7fbd

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

app/components/primer/open_project/avatar_fallback.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ export class AvatarFallbackElement extends HTMLElement {
66
@attr altText = ''
77
@attr fallbackSrc = ''
88

9-
private img?: HTMLImageElement
9+
private img: HTMLImageElement | null = null
1010
private boundErrorHandler?: () => void
1111

1212
connectedCallback() {
13-
this.img = this.querySelector<HTMLImageElement>('img') ?? undefined
13+
this.img = this.querySelector<HTMLImageElement>('img') ?? null
1414
if (!this.img) return
1515

1616
this.boundErrorHandler = () => this.handleImageError(this.img!)
@@ -31,7 +31,7 @@ export class AvatarFallbackElement extends HTMLElement {
3131
this.img.removeEventListener('error', this.boundErrorHandler)
3232
}
3333
this.boundErrorHandler = undefined
34-
this.img = undefined
34+
this.img = null
3535
}
3636

3737
private isImageBroken(img: HTMLImageElement): boolean {

0 commit comments

Comments
 (0)