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
// if (nonCallExpressionWithOutKeyword.kind === SyntaxKind.BindingElement) {
24070
+
// debugger;
24071
+
// }
24056
24072
return undefined;
24057
24073
}
24058
24074
@@ -24067,7 +24083,7 @@ namespace ts {
24067
24083
// 1. type A is { a: undefined }.
24068
24084
// 2. type B is { a: never }.
24069
24085
// Now we have `type C = { a: {innerType: 1} }`
24070
-
// for case 1, create `type X = A|C`, it should be filtered through optional chain, and not cause any error although A.a does not have any inner type. Like `root.a?.innerType` is valid.
24086
+
// for case 1, create `type X = A|C`, it should be filtered through optional chain, and not cause any error, although A.a does not have any inner type. Like `root.a?.innerType` is valid.
24071
24087
// for case 2, it is similar, and we do not even need optional chain. Like `root.a.innerType`
24072
24088
24073
24089
let propertyTypeArray: NarrowDeepPropertyInfo[] | undefined;
@@ -24084,27 +24100,45 @@ namespace ts {
24084
24100
24085
24101
return propertyTypeArray;
24086
24102
24103
+
// Assume reference is a
24087
24104
// If expression is a, return []
24088
24105
// If expression is a.b["c"].d(), return ["b","c","d"]
24106
+
// If element is BindingElement 'const x = a.b.c', return ["b", "c"]
24107
+
// If element is BindingElement 'const { c: x } = a.b', return ["b", "c"]
24089
24108
// NOTE: If element expression is not known in compile progress like a.b[f()].d, the result would be undefined
24109
+
// NOTE: Binding element is restricted for now: reference must be more "expanded" than node, which might be a binding element. See this example:
// if (tmp1.c.d === "A") root.a.b // root would be narrowed
24112
+
// if (root.a.b.c.d === "A") tmp1.c.d // however, tmp1 would not be narrowed for now
24113
+
// The result is similar for tmp2
24090
24114
// //NOTE: this function need improvement, ElementAccessExpression argument might could be known in compile time, like "1"+"2", we should check "12" in the path, but how to get the value?
24091
-
function tryGetPropertyPathsOfReferenceFromExpression(expressionOri: Expression, reference: Node): PathInfo[] | undefined {
0 commit comments