cloudflare / cloudflare/workerd
🐛 Bug Report — Runtime APIs, Reflect.set doesn't respect spread operator for functions
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
```
const object = {}
const toBeSpread = { spreadConst: "foo", spreadFunc: () => "foo"}
Reflect.set(object, Symbol.for("set"), { ...toBeSpread })
const get = Reflect.get(object, Symbol.for("set"))
console.log(get)
```
workerd output:
```workerd/io/worker.c++:1544: info: console.log(); message() = [{"spreadConst":"foo"}]```

node output:
```{ spreadConst: 'foo', spreadFunc: [Function: spreadFunc] }```
This functionality is used in the [Cloudflare Astro Integration](https://github.com/withastro/astro/blob/530fb9ebee77646921ec29d45d9b66484bdfb521/packages/integrations/cloudflare/src/server.advanced.ts#L34) to expose the context object of a request.
Without this functionality, I'm struggling to use functions like waitUntil.
Contributor guide
Assessment
This issue has not been assessed yet.