Skip to content

Commit a316485

Browse files
author
Matt Carroll
committed
Use null instead of undefined when assigning to clear out references
1 parent 216f677 commit a316485

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/datafile-manager/src/httpPollingDatafileManager.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default abstract class HTTPPollingDatafileManager implements DatafileMana
6161

6262
private readonly updateInterval: number
6363

64-
private cancelTimeout?: () => void
64+
private cancelTimeout: (() => void) | null
6565

6666
private isStarted: boolean
6767

@@ -71,7 +71,7 @@ export default abstract class HTTPPollingDatafileManager implements DatafileMana
7171

7272
private timeoutFactory: TimeoutFactory
7373

74-
private currentRequest?: AbortableRequest
74+
private currentRequest: AbortableRequest | null
7575

7676
private backoffController: BackoffController
7777

@@ -123,6 +123,8 @@ export default abstract class HTTPPollingDatafileManager implements DatafileMana
123123
logger.warn('Invalid updateInterval %s, defaulting to %s', updateInterval, DEFAULT_UPDATE_INTERVAL)
124124
this.updateInterval = DEFAULT_UPDATE_INTERVAL
125125
}
126+
this.cancelTimeout = null
127+
this.currentRequest = null
126128
this.backoffController = new BackoffController()
127129
this.syncOnCurrentRequestComplete = false
128130
}
@@ -145,14 +147,14 @@ export default abstract class HTTPPollingDatafileManager implements DatafileMana
145147
this.isStarted = false
146148
if (this.cancelTimeout) {
147149
this.cancelTimeout()
148-
this.cancelTimeout = undefined
150+
this.cancelTimeout = null
149151
}
150152

151153
this.emitter.removeAllListeners()
152154

153155
if (this.currentRequest) {
154156
this.currentRequest.abort()
155-
this.currentRequest = undefined
157+
this.currentRequest = null
156158
}
157159

158160
return Promise.resolve()
@@ -216,7 +218,7 @@ export default abstract class HTTPPollingDatafileManager implements DatafileMana
216218
return
217219
}
218220

219-
this.currentRequest = undefined
221+
this.currentRequest = null
220222

221223
if (!this.isReadyPromiseSettled && !this.autoUpdate) {
222224
// We will never resolve ready, so reject it

0 commit comments

Comments
 (0)