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

Support __proto__ in object literal (type-check only) #48816

Closed

Conversation

Jack-Works
Copy link
Contributor

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Apr 23, 2022
@typescript-bot
Copy link
Collaborator

The TypeScript team hasn't accepted the linked issue #13933. If you can get it accepted, this PR will have a better chance of being reviewed.

@DanielRosenwasser
Copy link
Member

To be honest, I don't think we want the complexity of ever thinking about __proto__ in TypeScript. The corresponding issue received 2 votes over 5 years, so I don't think it would make sense to bring this change in.

@bakkot
Copy link
Contributor

bakkot commented Apr 26, 2022

#39882 has another 11, from a mostly different set of people.

Anyway, while I think it's fair to not want to think about prototypes, it seems a shame to say that let x = { __proto__: null }; is forever going to be typed as an object with a __proto__ property of null, meaning that __proto__ is suggested in autocompletes and so on.

@Josh-Cena
Copy link
Contributor

It's standard ECMAScript syntax, so even if we don't bring in the whole prototypical semantics, it should at least be special-cased to not mess with valid things like const map: Record<string, string> = { __proto__: null }

@Jack-Works
Copy link
Contributor Author

This PR doesn't bring "prototype" into the type system. It will treat { __proto__: x, ...rest } as type typeof { ...x, ...rest }.

@sandersn
Copy link
Member

sandersn commented May 4, 2022

@bakkot @Josh-Cena @Jack-Works can you make your case on an issue instead of on a PR? Changes to checker.ts, especially, bit-rot quickly and technical concerns get confused with semantics.

@sandersn
Copy link
Member

sandersn commented Jun 1, 2022

To help with PR housekeeping, I'm going to close this PR while it's still waiting on its bug to be accepted. We can open again once that happens.

@sandersn sandersn closed this Jun 1, 2022
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.

Ignore __proto__
6 participants