Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No error when using spead operator on an interal's properties #43270

Closed
jgresty opened this issue Mar 16, 2021 · 2 comments
Closed

No error when using spead operator on an interal's properties #43270

jgresty opened this issue Mar 16, 2021 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@jgresty
Copy link

jgresty commented Mar 16, 2021

Bug Report

πŸ”Ž Search Terms

spread built-in internal

πŸ•— Version & Regression Information

  • This is the behaviour in every version I tried, and I reviewed the FAQ for entries about type system behaviour

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

const a = (buff: { byteLength: number }) => console.log(buff.byteLength)
const buff = new ArrayBuffer(123)
a(buff) // Fine
a({...buff}) // Prints undefined, expected error

πŸ™ Actual behavior

Properties are not copied with the spread operator but the typing of the new object asserts they are present.

πŸ™‚ Expected behavior

The type of an object constructed with the spread operator to not include properties that were not copied to it.

@RyanCavanaugh
Copy link
Member

Duplicate #9726

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Mar 16, 2021
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants