Skip to content

Fix packages/firestore/ usages of @ts-ignore. #1882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 17, 2019

Conversation

mikelehen
Copy link
Contributor

I left the equality_matcher.ts ones for the code we copy/pasted in, but fixed the rest.

The most controversial change is introducing @Indexable as a type alias for {[k: string]: unknown} and casting to it in a few places. I could alternatively just cast directly to {[k: string]: unknown} or any (with ts-lint ignore comment) in those places...

cc/ @hsubox76 FYI. I'll assign this to you once @schmidt-sebastian signs off.

I left the equality_matcher.ts ones for the code we copy/pasted in, but fixed the rest.
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. One type suggestions for your new .d.ts file.

@@ -244,8 +244,7 @@ export class WebChannelConnection implements Connection {
// ReactNative and so we exclude it, which just means ReactNative may be
// subject to the extra network roundtrip for CORS preflight.
if (!isReactNative()) {
// @ts-ignore
request['httpHeadersOverwriteParam'] = '$httpHeaders';
(request as Indexable)['httpHeadersOverwriteParam'] = '$httpHeaders';
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian Jun 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasted more time on this then I should have, but here you go:

interface WebChannelOptions {
  messageHeaders?:StringMap;  
  initMessageHeaders?:StringMap;
  messageContentType?:string;
  messageUrlParam?:StringMap;
  clientProtocolHeaderRequired?:boolean;
  concurrentRequestLimit?:number;
  supportsCrossDomainXhr?:boolean;
  testUrl?:string;
  sendRawJson?:boolean;
  httpSessionIdParam?:string;
  httpHeadersOverwriteParam?:string;
  backgroundChannelTest?:boolean;
  forceLongPolling?:boolean;
  fastHandshake?:boolean;
  disableRedac?:boolean;
  clientProfile?:string;
  internalChannelParams:{[key:string]:boolean|number};
  xmlHttpFactory:unknown;
  requestRefreshThresholds:{[key:string]:number};
}

const request: WebChannelOptions;

This is based on https://cs.corp.google.com/piper///depot/google3/javascript/closure/labs/net/webchannel.js?rcl=242544058&l=196

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Added.

@mikelehen mikelehen assigned hsubox76 and unassigned mikelehen Jun 15, 2019
@mikelehen mikelehen requested a review from hsubox76 June 15, 2019 23:31
@mikelehen
Copy link
Contributor Author

@hsubox76 If you're okay with this, I'll merge it into your PR.

@mikelehen mikelehen merged commit 1c28ffe into ch-strict Jun 17, 2019
@mikelehen mikelehen deleted the mikelehen/firestore-strict-any branch June 17, 2019 19:45
@firebase firebase locked and limited conversation to collaborators Oct 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants