react-relay-network-layer icon indicating copy to clipboard operation
react-relay-network-layer copied to clipboard

Flowtype failing on my repo

Open golmansax opened this issue 5 years ago • 0 comments

Hi, I believe https://github.com/relay-tools/react-relay-network-layer/commit/84b33615131721928333f6bede1bacaa6c6e4093#diff-98bf0f0a5018817161c912b3742e1b02R17 should make credentials an optional property in Flow.

See the following Flow error I'm getting in my repo. Happy to submit a pull request if you agree with this change.

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/react-relay-network-layer/lib/middleware/batch.js.flow:162:46

Cannot assign object literal to req because property credentials is missing in object literal [1] but exists in
FetchOpts [2].

     node_modules/react-relay-network-layer/lib/middleware/batch.js.flow
     159│     // $FlowFixMe
     160│     const url = isFunction(opts.batchUrl) ? opts.batchUrl(requestMap) : opts.batchUrl;
     161│
 [1] 162│     const req: RRNLRequestObjectBatchQuery = {
     163│       url,
     164│       relayReqId: `BATCH_QUERY:${ids.join(':')}`,
     165│       relayReqMap: requestMap,
     166│       relayReqType: 'batch-query',
     167│       method: 'POST',
     168│       headers: {
     169│         Accept: '*/*',
     170│         'Content-Type': 'application/json',
     171│       },
     172│       body: `[${ids.map(id => requestMap[id].req.body).join(',')}]`,
     173│     };
     174│
     175│     return next(req)
     176│       .then(batchResponse => {

     node_modules/react-relay-network-layer/lib/definition.js.flow
 [2]  37│ export type RRNLRequestObjectBatchQuery = FetchOpts & {

golmansax avatar Feb 11 '19 17:02 golmansax