Skip to content

Commit f88ea0d

Browse files
committed
fix(webapp): workaround setTimeout/setInterval return type
see also: - microsoft/TypeScript#18588 - microsoft/TypeScript#37053
1 parent b91294c commit f88ea0d

5 files changed

Lines changed: 6 additions & 5 deletions

File tree

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"paths": {
55
"@/*": ["./*"]
66
},
7+
"types": [""],
78
"target": "ESNext",
89
"lib": ["DOM", "DOM.Iterable", "ESNext"],
910
"jsx": "react-jsx",

webapp/components/player/player.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ export default function Player(props: { stream: MediaStream, muted: boolean, aud
8383
const videoTrack = props.stream.getVideoTracks()[0]
8484
const [currentDeviceSpeaker] = useAtom(deviceSpeakerAtom)
8585
const [speakerStatus] = useAtom(speakerStatusAtom)
86-
const refPlayPromise = useRef<Promise<void> | null>(null)
86+
const refPlayPromise = useRef<Promise<void>>()
8787
const refControls = useRef<HTMLDivElement>(null)
8888
const [showControls, setShowControls] = useState(false)
89-
const refTimeoutId = useRef<NodeJS.Timeout | null>(null)
89+
const refTimeoutId = useRef<number>()
9090
const [isMuted, setIsMuted] = useState(false)
9191
const [isFullscreened, setIsFullscreened] = useState(false)
9292
const [isPictureInPictured, setIsPictureInPictured] = useState(false)

webapp/components/use/whep.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class WHEPContext extends Context {
8181
async stop() {
8282
if (this.timer) {
8383
clearInterval(this.timer)
84-
this.timer = null
84+
this.timer = undefined
8585
}
8686
try {
8787
await this.client.stop()

webapp/components/use/whip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class WHIPContext extends Context {
223223
async stop() {
224224
if (this.timer) {
225225
clearInterval(this.timer)
226-
this.timer = null
226+
this.timer = undefined
227227
}
228228
try {
229229
await this.client.stop()

webapp/components/use/whxp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Context extends EventTarget {
2424
screen: false,
2525
}
2626

27-
timer: ReturnType<typeof setInterval> | null = null
27+
timer?: number
2828

2929
constructor(id: string) {
3030
super()

0 commit comments

Comments
 (0)