Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Unioned cf type on RequestInit does not allow re-assignment of properties #37

Closed
third774 opened this issue May 28, 2020 · 1 comment
Closed

Comments

@third774
Copy link
Contributor

The unioned type introduced by PR #18 does not allow re-assignment of properties. Consider the following snippet:

// this assignment works just fine
let init: RequestInit = {
  cf: {
    cacheKey: 'foo',
  },
}

if (init.cf) {
  // but re-writing properties is prevented by the type checker
  init.cf.cacheKey = 'bar'
}

This produces the following type error:

image

The ideal outcome (if possible) would be to extend the RequestInit that fetch uses without obstructing the use case above while still supporting the example identified in issue #15.

Still trying to work out how to do this or if it's possible, but wanted to start a discussion around it :)

@third774 third774 changed the title Unioned cf type on Request does not allow re-assignment of properties Unioned cf type on RequestInit does not allow re-assignment of properties May 29, 2020
@ispivey ispivey added this to the Release 2.0.0 milestone Jun 10, 2020
@1000hz
Copy link
Contributor

1000hz commented Jun 11, 2020

Addressed via #44

@1000hz 1000hz closed this as completed Jun 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants