You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't use keyof index for indexing intersection of Partial<T> and another type in generic class<T>. #22286
Bug
I'm trying to use an object's key to index an intersection into a partial of an object and another object, but I'm getting an error.
Note: this error only shows up in a generic class. Using plain types I was not able to replicate it.
it is actually (Rum & Partial<T>)[keyof T], which is generic, and not assignable to string | number, since T can have additional properties when it is instantiated.
Activity
mhegazy commentedon Mar 2, 2018
Should be fixed by #22300
Griffork commentedon Mar 3, 2018
Mohamed Hegazy (@mhegazy) does this mean that the best typing I'm going to get is
this.mything[param]: string | number?mhegazy commentedon Mar 3, 2018
it is actually
(Rum & Partial<T>)[keyof T], which is generic, and not assignable tostring | number, sinceTcan have additional properties when it is instantiated.