You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the intricacy for the latter is that it's not very type-safe and more error-prone, since everything will toString to something, but it's often not what you expect it to be unless it's a primitive. They use the same thing for dataset/css style values, as well as other writeables, even if the spec allows and/or encourages it (for instance writing to window.location can be done with a string, and is most commonly done as such, but currently it's only writeable with a URL)
Activity
Paril commentedon Jun 5, 2021
I think the intricacy for the latter is that it's not very type-safe and more error-prone, since everything will toString to something, but it's often not what you expect it to be unless it's a primitive. They use the same thing for dataset/css style values, as well as other writeables, even if the spec allows and/or encourages it (for instance writing to
window.locationcan be done with a string, and is most commonly done as such, but currently it's only writeable with a URL)aslilac commentedon Jun 6, 2021
Yeah, it feels like
{ toString(): string }falls into the same pit as{}in that almost anything could be cast to it.orta commentedon Jun 28, 2021
Agree, I think we probably don't want this
orta commentedon Jun 28, 2021
Related: #1003
dnalborczyk commentedon Oct 19, 2021
Actually I would think we do want this.
https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters
dnalborczyk commentedon Oct 19, 2021
speaking of which, this is pretty much the same problem, but has been added:
#331
#332
dnalborczyk commentedon Oct 19, 2021
as well as: #600
fetchfalls pretty much into the same category.similar: microsoft/TypeScript#43066