WICG / attribution-reporting-api

Attribution Reporting API
https://wicg.github.io/attribution-reporting-api/
Other
347 stars 161 forks source link

Remove Maybe.flatten function #1337

Closed apasel422 closed 2 weeks ago

apasel422 commented 2 weeks ago

It was unsound because it could be called with a Maybe but its type parameter T instantiated with Maybe, resulting in an apparent return type of Maybe<Maybe>, but the instanceof check would cause the original Maybe to be returned.

For example, the following code logs "number" despite y's type indicating that its value should be another Maybe:

const x = Maybe.some(5)
const y: Maybe<Maybe<number>> = Maybe.flatten<Maybe<number>>(x)
console.log(typeof y.value)