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
It allows 'a', 'b' or 'c' instead of the generic type which is supposed to be the same as the input. The same problem occurs with assigning variables or functions inside the other function. Although the type must be M[O]['data'] and it says that it is that, it acts as if it were no longer generic, as in M[keyof M]['data'].
π Expected behavior
I woud expect it to be M[O]['data'].
Additional information about the issue
You don't have this issue if you remove the object with the data key and replace it with the value of data, for example ''a' instead of { data: 'a'}
The text was updated successfully, but these errors were encountered:
This is the best we have at the moment, since doubly-higher-order indexed operations aren't deferred. If this were an error, we'd have an error on a legal function body:
π Search Terms
generics, generic loses genericness, generics with object types
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.3.0-beta#code/C4TwDgpgBAslC8UDeAoAkAQwFzKgEw2GygHIMSoBfdAIxyX0OJJourQGN7GicSO2KaigBmAVwB2HYAEsA9hKgSAPAHkoEAB7AIEvAGcoAawgg5I2AD4AFHJyqAlDhgBtVQF0XJAkRLvk6ABOEMBigYpkJEIoKBLWLCQOKEA
π» Code
π Actual behavior
It allows 'a', 'b' or 'c' instead of the generic type which is supposed to be the same as the input. The same problem occurs with assigning variables or functions inside the other function. Although the type must be
M[O]['data']
and it says that it is that, it acts as if it were no longer generic, as inM[keyof M]['data']
.π Expected behavior
I woud expect it to be
M[O]['data']
.Additional information about the issue
You don't have this issue if you remove the object with the data key and replace it with the value of data, for example
''a'
instead of{ data: 'a'}
The text was updated successfully, but these errors were encountered: