@@ -20,8 +20,8 @@ import {
20
20
ErrorCode ,
21
21
EventType ,
22
22
WebChannel ,
23
+ WebChannelOptions ,
23
24
XhrIo
24
- // @ts -ignore
25
25
} from '@firebase/webchannel-wrapper' ;
26
26
27
27
import { isReactNative } from '@firebase/util' ;
@@ -193,7 +193,7 @@ export class WebChannelConnection implements Connection {
193
193
'/channel'
194
194
] ;
195
195
const webchannelTransport = createWebChannelTransport ( ) ;
196
- const request = {
196
+ const request : WebChannelOptions = {
197
197
// Background channel test avoids the initial two test calls and decreases
198
198
// initial cold start time.
199
199
// TODO(dimond): wenboz@ mentioned this might affect use with proxies and
@@ -224,7 +224,7 @@ export class WebChannelConnection implements Connection {
224
224
forceLongPolling : this . forceLongPolling
225
225
} ;
226
226
227
- this . modifyHeadersForRequest ( request . initMessageHeaders , token ) ;
227
+ this . modifyHeadersForRequest ( request . initMessageHeaders ! , token ) ;
228
228
229
229
// Sending the custom headers we just added to request.initMessageHeaders
230
230
// (Authorization, etc.) will trigger the browser to make a CORS preflight
@@ -244,8 +244,7 @@ export class WebChannelConnection implements Connection {
244
244
// ReactNative and so we exclude it, which just means ReactNative may be
245
245
// subject to the extra network roundtrip for CORS preflight.
246
246
if ( ! isReactNative ( ) ) {
247
- // @ts -ignore
248
- request [ 'httpHeadersOverwriteParam' ] = '$httpHeaders' ;
247
+ request . httpHeadersOverwriteParam = '$httpHeaders' ;
249
248
}
250
249
251
250
const url = urlParts . join ( '' ) ;
@@ -345,11 +344,10 @@ export class WebChannelConnection implements Connection {
345
344
// (and only errors) to be wrapped in an extra array. To be forward
346
345
// compatible with the bug we need to check either condition. The latter
347
346
// can be removed once the fix has been rolled out.
347
+ // tslint:disable-next-line:no-any msgData.error is not typed.
348
+ const msgDataAsAny : any = msgData ;
348
349
const error =
349
- // tslint:disable-next-line:no-any msgData.error is not typed.
350
- ( msgData as any ) . error ||
351
- // @ts -ignore
352
- ( msgData [ 0 ] && msgData [ 0 ] . error ) ;
350
+ msgDataAsAny . error || ( msgDataAsAny [ 0 ] && msgDataAsAny [ 0 ] . error ) ;
353
351
if ( error ) {
354
352
log . debug ( LOG_TAG , 'WebChannel received error:' , error ) ;
355
353
// error.status will be a string like 'OK' or 'NOT_FOUND'.
0 commit comments