TypeScript Version: 2.6.0-dev.20170826
Code
const headers = new Headers({
Accept: 'application/json',
'Content-Type': 'application/json'
})
Expected behavior:
Works
Actual behavior:
Argument of type '{ Accept: string; 'Content-Type': string; }' is not assignable to parameter of type 'Headers | string[][]'.
Object literal may only specify known properties, and 'Accept' does not exist in type 'Headers | string[][]'.
According to the docs https://developer.mozilla.org/en-US/docs/Web/API/Headers/Headers it's an object, not a string[][]
Acctually based on https://fetch.spec.whatwg.org/#headers-class, it can be Headers | string[][]| object
@vrachels this is a different issue. please file a new ticket to track that.
I'd just like to add some feedback to this: these kinds of regressions are _extremely_ annoying. Seems like every update of TypeScript (even the minor ones) break my build and I have to adapt my code / revert to a previous version just because of small stuff like this. Please increase the test coverage for the typings!
Most helpful comment
I'd just like to add some feedback to this: these kinds of regressions are _extremely_ annoying. Seems like every update of TypeScript (even the minor ones) break my build and I have to adapt my code / revert to a previous version just because of small stuff like this. Please increase the test coverage for the typings!