Skip to content

Conversation

jakebailey
Copy link
Member

Fixes #24688

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test shouldn't have unrelated errors.

const myFirstFunction = <T extends FirstInterface | SecondInterface>(param1: T) => {
const newParam: T & { otherProperty: number } = Object.assign(param1, { otherProperty: 3 })
~~~~~~
!!! error TS2550: Property 'assign' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to have 0 errors by switching to es2015 or higher, or else by moving newParam to being a parameter so it doesn't have an initialiser.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, my bad.

@jakebailey jakebailey merged commit 8a85b2a into microsoft:main Jul 13, 2023
@jakebailey jakebailey deleted the fix-24688 branch July 13, 2023 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Backlog Bug PRs that fix a backlog bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type intersection and union at the same time are not working with generics
3 participants