Skip to content

Conversation

@sandersn
Copy link
Member

Previously they were skipped. The runtime behaviour is to create a property of type undefined, unlike (for example) spreading numbers or other primitives, which are skipped. So now spreading a set-only accessor creates a property of type undefined:

const o: { foo: undefined } = { ...{ set foo(v: number) { } } }

Notably, o.foo: undefined not number.

Fixes #26337

Previously they were skipped. The runtime behaviour is to create a
property of type undefined, unlike (for example) spreading numbers or
other primitives. So now spreading a set-only accessor creates a
property of type undefined:

```ts
const o: { foo: undefined } = { ...{ set foo(v: number) { } } }
```

Notably, `o.foo: undefined` not `number`.

Fixes #26337
@sandersn sandersn requested review from a user, rbuckton and weswigham and removed request for a user October 29, 2018 21:29
@sandersn sandersn merged commit 64ff195 into master Oct 29, 2018
@sandersn sandersn deleted the set-only-accessors-spread-to-undefined branch October 29, 2018 21:51
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants