File tree Expand file tree Collapse file tree 3 files changed +7
-0
lines changed Expand file tree Collapse file tree 3 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -5785,6 +5785,10 @@ namespace ts {
5785
5785
if (type.flags & TypeFlags.Union) {
5786
5786
const props = createMap<Symbol>();
5787
5787
for (const memberType of (type as UnionType).types) {
5788
+ if (memberType.flags & TypeFlags.Primitive) {
5789
+ continue;
5790
+ }
5791
+
5788
5792
for (const { name } of getPropertiesOfType(memberType)) {
5789
5793
if (!props.has(name)) {
5790
5794
props.set(name, createUnionOrIntersectionProperty(type as UnionType, name));
Original file line number Diff line number Diff line change @@ -2587,6 +2587,7 @@ namespace ts {
2587
2587
/**
2588
2588
* For a union, will include a property if it's defined in *any* of the member types.
2589
2589
* So for `{ a } | { b }`, this will include both `a` and `b`.
2590
+ * Does not include properties of primitive types.
2590
2591
*/
2591
2592
/* @internal */ getAllPossiblePropertiesOfType ( type : Type ) : Symbol [ ] ;
2592
2593
}
Original file line number Diff line number Diff line change 10
10
////f({ /*f*/ });
11
11
12
12
goTo . marker ( "x" ) ;
13
+ verify . completionListCount ( 3 ) ;
13
14
verify . completionListContains ( "a" , "(property) a: string | number" ) ;
14
15
verify . completionListContains ( "b" , "(property) b: number | boolean" ) ;
15
16
verify . completionListContains ( "c" , "(property) c: string" ) ;
16
17
17
18
goTo . marker ( "f" ) ;
18
19
verify . completionListContains ( "a" , "(property) a: number" ) ;
20
+ // Also contains array members
You can’t perform that action at this time.
0 commit comments