Page MenuHomePhabricator

[web] add flow types for grpc-web unary interceptor
ClosedPublic

Authored by varun on Nov 1 2023, 4:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 13, 12:51 PM
Unknown Object (File)
Wed, Nov 13, 12:51 PM
Unknown Object (File)
Wed, Nov 13, 12:51 PM
Unknown Object (File)
Wed, Nov 13, 12:48 PM
Unknown Object (File)
Tue, Nov 12, 4:07 PM
Unknown Object (File)
Oct 25 2024, 6:09 PM
Unknown Object (File)
Oct 12 2024, 2:23 AM
Unknown Object (File)
Oct 12 2024, 2:23 AM
Subscribers

Details

Summary

added the relevant types using this file as reference: https://github.com/grpc/grpc-web/blob/master/packages/grpc-web/index.d.ts

Depends on D9670

Test Plan

ran flow

Diff Detail

Repository
rCOMM Comm
Branch
grpc-web (branched from master)
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

web/flow-typed/npm/grpc-web_v1.x.x.js
54–66

i carried over the 3 any types above from the reference TypeScript declaration file linked in the summary. i also changed the unknown types from the reference file to mixed.

varun requested review of this revision.Nov 1 2023, 5:17 PM

remove the read-only aspect of the Metadata type

If you want to keep the change to Metadata (or disagree with any of the other comments), please re-request review

web/flow-typed/npm/grpc-web_v1.x.x.js
6 ↗(On Diff #32602)

Let's undo this change unless you have a good reason. TypeScript isn't as robust of a typechecker as Flow... just because they can't handle read-only types doesn't mean we should follow suit. Part of the task of converting TypeScript types to Flow types is considering whether or not they should be made read-only

55 ↗(On Diff #32602)
  1. We should make this read-only
  2. Can we try mixed? It's almost certainly a better idea here
59–64 ↗(On Diff #32602)

Nit to match JS style conventions

This revision is now accepted and ready to land.Nov 2 2023, 6:50 AM
web/flow-typed/npm/grpc-web_v1.x.x.js
6 ↗(On Diff #32602)

Never mind, it's clear in D9672 that this needs to be mutable. Would be good to explain that change in this diff to save me some typing next time