@@ -225,7 +225,8 @@ namespace ts {
225225 return tryFindAmbientModule(moduleName, /*withAugmentations*/ false);
226226 },
227227 getApparentType,
228- getAllPossiblePropertiesOfType,
228+ isArrayLikeType,
229+ getAllPossiblePropertiesOfTypes,
229230 getSuggestionForNonexistentProperty: (node, type) => unescapeLeadingUnderscores(getSuggestionForNonexistentProperty(node, type)),
230231 getSuggestionForNonexistentSymbol: (location, name, meaning) => unescapeLeadingUnderscores(getSuggestionForNonexistentSymbol(location, escapeLeadingUnderscores(name), meaning)),
231232 getBaseConstraintOfType,
@@ -5925,25 +5926,21 @@ namespace ts {
59255926 getPropertiesOfObjectType(type);
59265927 }
59275928
5928- function getAllPossiblePropertiesOfType(type: Type): Symbol[] {
5929- if (type.flags & TypeFlags.Union) {
5930- const props = createSymbolTable();
5931- for (const memberType of (type as UnionType).types) {
5932- if (memberType.flags & TypeFlags.Primitive) {
5933- continue;
5934- }
5929+ function getAllPossiblePropertiesOfTypes(types: Type[]): Symbol[] {
5930+ const unionType = getUnionType(types);
5931+ if (!(unionType.flags & TypeFlags.Union)) {
5932+ return getPropertiesOfType(unionType);
5933+ }
59355934
5936- for (const { escapedName } of getPropertiesOfType(memberType)) {
5937- if (!props.has(escapedName)) {
5938- props.set(escapedName, createUnionOrIntersectionProperty(type as UnionType, escapedName));
5939- }
5935+ const props = createSymbolTable();
5936+ for (const memberType of types) {
5937+ for (const { escapedName } of getPropertiesOfType(memberType)) {
5938+ if (!props.has(escapedName)) {
5939+ props.set(escapedName, createUnionOrIntersectionProperty(unionType as UnionType, escapedName));
59405940 }
59415941 }
5942- return arrayFrom(props.values());
5943- }
5944- else {
5945- return getPropertiesOfType(type);
59465942 }
5943+ return arrayFrom(props.values());
59475944 }
59485945
59495946 function getConstraintOfType(type: TypeVariable | UnionOrIntersectionType): Type {
0 commit comments