Skip to content
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

"This type is incompatible with null" on merging {method: 'POST'} with RequestOptions #2164

Closed
jdelStrother opened this issue Aug 1, 2016 · 3 comments

Comments

@jdelStrother
Copy link
Contributor

https://flowtype.org/try/#0PQKgBAAgZgNg9gdzCYAoVUCuA7AxgFwEs5swAHOAZ3wApMAnGALjGvsOwHMAaMOMoiUosASgFMAjpjHUA8gOLZKASjABvVGDD0x+BqSi7cACzqNeagLa7jcACYsA5AAVZAZQAqj3gDo--QSUAX2VUINQgA

I'm trying to supply a default {method: 'POST'} option to whatwg-fetch -

/* @flow */
function post(url: string, options: RequestOptions) {
  return fetch(url, {method: 'POST', ...options})
}
3:   return fetch(url, {method: 'POST', ...options})
                                ^ string. This type is incompatible with
/static/flowlib/bom.js:641:     method?: ?MethodType;
                                          ^ null

A workaround is casting the 'POST' string with ('POST': ?MethodType), but it seems like this ought to work without, no?

@avikchaudhuri
Copy link
Contributor

Hmm, looks like a spread issue.

@villesau
Copy link
Contributor

I think this fixes the issue: #7298

@nmote
Copy link
Contributor

nmote commented Oct 25, 2019

I came up with a minimal repro based on this bug report, and this is fixed in master.

@nmote nmote closed this as completed Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants