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
Expected behavior: An error stating { a: string, b: number, c: number } is not assignable to T.
Actual behavior: Elaboration errors on the b and c property assignments which misleads the user to think the issue is with those properties. The real issue is that no object literal and only a T is assignable to T, and we should not attempt to elaborate here. Generally, the elaboration logic can't rely on the behavior of getIndexedAccess without first validating that a meaningful type is being requested because getIndexedAccess will happily create deferred indexed access types that technically are errors. The elaboration logic needs to be more selective about which target types it descends into. Specifically, I would suggest only descending into non-generic object types and non-generic intersection types.
Additionally, since I didn't get to review #25140, please remove the generator functions and just use normal recursive descent. There's no need for generators here and it is inconsistent with what we do elsewhere (such as the conceptually similar logic to relate types and compute contextual types).
Activity
ahejlsberg commentedon Jul 26, 2018
Additionally, since I didn't get to review #25140, please remove the generator functions and just use normal recursive descent. There's no need for generators here and it is inconsistent with what we do elsewhere (such as the conceptually similar logic to relate types and compute contextual types).