mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-12 11:08:26 -05:00
Always take the apparent type when you retrieve a contextual type
This commit is contained in:
@@ -6442,6 +6442,11 @@ namespace ts {
|
||||
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
|
||||
// be "pushed" onto a node using the contextualType property.
|
||||
function getContextualType(node: Expression): Type {
|
||||
let type = getContextualTypeWorker(node);
|
||||
return type && getApparentType(type);
|
||||
}
|
||||
|
||||
function getContextualTypeWorker(node: Expression): Type {
|
||||
if (isInsideWithStatementBody(node)) {
|
||||
// We cannot answer semantic questions within a with block, do not proceed any further
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user