facebook / facebook/flow

Revocable Proxies are incorrectly Types

Open
#6,387 0 comments 0 reactions 0 assignees View on GitHub
Accepting PRs Library definitions
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Revocable proxies do not return proxy in the object:

```
type Proxy$revocable = T & {
revoke(): void;
};
```

Believe it should be

```
type Proxy$revocable = {
proxy: Proxy;
revoke(): void;
};
```

### Example

```javascript
const { proxy, revoke } = Proxy.revocable({}, {
get: proxyGet,
set: proxySet,
});
```

---

In addition, it seems like it should maybe return an `Object` or similar as its type. It current returns the same type that is received but since Proxies allow you to handle things as desired, they will generally behave like objects (depending on what is defined - I can see how these would be very challenging to provide types for appropriately.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.