-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
TS2339: Property '__proto__' does not exist on type 'typeof A1'. #30587
Comments
We're not adding new support for discouraged constructs like |
@RyanCavanaugh anything is like this or replace this? |
Now that it is officially spec'd in the ES spec, why not support it? My experience is that it does behave exactly the same in all major browsers and Node. Are there inconsistencies in modern engines? Old engines don't even have Many people use I much prefer the let o = {
__proto__: otherObject,
foo: 123,
} and how well it combines with spread syntax or with A special case in TS can be made so that |
@bluelovers |
This relates to #37963 (which IMO is a pretty serious correctness/security issue) in that these are equivalent: const safeStringMap: { [key: string]: string } = Object.create(null);
const safeStringMap: { [key: string]: string } = { __proto__: null }; I believe that typescript needs to support const safeStringMap: { [key: string]: string } = {
...someOtherStringMap
}; Adding support for const safeStringMap: { [key: string]: string } = {
__proto__: null,
...someOtherStringMap
}; Otherwise, writing safe indexed objects requires us to avoid spreads entirely: const safeStringMap: { [key: string]: string } = Object.assign(
Object.create(null),
someOtherStringMap
); Also, this may be a duplicate of #13933 (or vice-versa). EDIT: I have turned this into a more thoroughly constructed proposal in #38385. |
This proposal has been submitted as #38385. |
TypeScript Version: 3.4.0-dev.201xxxxx
Search Terms:
Code
maybe this should call as
Feature request
Expected behavior:
no error, and typescript know
superStatic
istypeof P
Feature request here
hope can have something like
make without always write
or a way to get
P
fromA1
, when we didn't know who isA1
parent class in staticActual behavior:
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: