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

Accept generics for defineProperty #42424

Merged
merged 4 commits into from
Mar 11, 2021
Merged

Conversation

sirlancelot
Copy link
Contributor

Both Object.defineProperty() and Object.defineProperties() return their
first argument. Use a generic so that typings can be passed through.

@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jan 20, 2021
@ghost
Copy link

ghost commented Jan 20, 2021

CLA assistant check
All CLA requirements met.

Both `Object.defineProperty()` and `Object.defineProperties()` return their
first argument. Use a generic so that typings can be passed through.
@sirlancelot
Copy link
Contributor Author

Updated baselines.

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.

I'm cautiously optimistic that this won't break anything, since there wasn't much churn in the test baselines. However, I'd like a second opinion. @orta do you think this is a good idea?

@ExE-Boss
Copy link
Contributor

ExE-Boss commented Mar 10, 2021

Arguably, for maximum correctness, it should be what I posted in #41424 (comment), but that might have compatibility issues and be overkill.

See also:

@sirlancelot
Copy link
Contributor Author

Arguably, for maximum correctness, it should be what I posted in #41424 (comment), but that might have compatibility issues and be overkill.

Wow, that's really cool! Regrettably, I'm not as well-versed in TypeScript annotations but I know just enough to be able to appreciate that one. 👍

Copy link
Contributor

@orta orta left a comment

Choose a reason for hiding this comment

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

Yeah, this generally seems reasonable to me ( hah, Exe-boss that version is wild)

I feel like it's a little strange because the object you pass it would always be modified by going through the function so in theory the T wouldn't necessarily match in the return position. But I think this is what you'd pragmatically expect from the function that the shape of the thing going in is the shape of the thing going out.

@sandersn sandersn merged commit dcaefe7 into microsoft:master Mar 11, 2021
@sirlancelot sirlancelot deleted the patch-1 branch March 11, 2021 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants