Skip to content

Commit 519fe63

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

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

app/components/primer/open_project/avatar_fallback.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import {attr, controller} from '@github/catalyst'
1+
import { attr, controller } from '@github/catalyst'
22

33
@controller
44
export class AvatarFallbackElement extends HTMLElement {
55
@attr uniqueId = ''
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)