-
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
[Suggestion] Global object properties should not surface on type level indexing #18118
Comments
The magic type ValueOf<T, K extends keyof T> = T[K]
type Test4 = ValueOf<1, 'constructor'> // error
type Test5 = 1['constructor'] // OK |
It is consistent with other uses of indexing.. e.g. indexing with numbers.. On the flip side, not having it in |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
TypeScript Version: nightly (2.6.0-dev.20170829)
Code
Expected behavior:
Test1
,Test2
andTest3
should all be errors.User provided types should be considered "exact". No properties should be inherited from
Object
. The current behaviour is of little use, however it's quite confusing and really gets in the way of type level programming.The text was updated successfully, but these errors were encountered: