Skip to content

Commit e1c50e1

Browse files
committed
Address more PR comments
1 parent bd5ce28 commit e1c50e1

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

src/compiler/checker.ts

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4488,10 +4488,9 @@ namespace ts {
44884488

44894489
function getPropertiesOfType(type: Type): Symbol[] {
44904490
type = getApparentType(type);
4491-
if (type.flags & TypeFlags.UnionOrIntersection) {
4492-
return getPropertiesOfUnionOrIntersectionType(<UnionType>type);
4493-
}
4494-
return getPropertiesOfObjectType(type);
4491+
return type.flags & TypeFlags.UnionOrIntersection ?
4492+
getPropertiesOfUnionOrIntersectionType(<UnionType>type) :
4493+
getPropertiesOfObjectType(type);
44954494
}
44964495

44974496
/**
@@ -4581,9 +4580,6 @@ namespace ts {
45814580
result.hasNonUniformType = hasNonUniformType;
45824581
result.isPartial = isPartial;
45834582
result.declarations = declarations;
4584-
if (declarations.length) {
4585-
result.valueDeclaration = declarations[0];
4586-
}
45874583
result.isReadonly = isReadonly;
45884584
result.type = containingType.flags & TypeFlags.Union ? getUnionType(propTypes) : getIntersectionType(propTypes);
45894585
return result;
@@ -5057,7 +5053,7 @@ namespace ts {
50575053
const declaration = getIndexDeclarationOfSymbol(symbol, kind);
50585054
if (declaration) {
50595055
return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType,
5060-
(getModifierFlags(declaration) & ModifierFlags.Readonly) !== 0, declaration);
5056+
(getModifierFlags(declaration) & ModifierFlags.Readonly) !== 0, declaration);
50615057
}
50625058
return undefined;
50635059
}
@@ -5926,9 +5922,6 @@ namespace ts {
59265922
result.leftSpread = leftProp;
59275923
result.rightSpread = rightProp;
59285924
result.declarations = declarations;
5929-
if (declarations.length) {
5930-
result.valueDeclaration = declarations[0];
5931-
}
59325925
result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp);
59335926
members[leftProp.name] = result;
59345927
}
@@ -15196,11 +15189,9 @@ namespace ts {
1519615189
forEach(node.members, checkSourceElement);
1519715190
if (produceDiagnostics) {
1519815191
const type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
15199-
if (type.flags & TypeFlags.Object) {
15200-
checkIndexConstraints(type);
15201-
checkTypeForDuplicateIndexSignatures(node);
15202-
checkObjectTypeForDuplicateDeclarations(node);
15203-
}
15192+
checkIndexConstraints(type);
15193+
checkTypeForDuplicateIndexSignatures(node);
15194+
checkObjectTypeForDuplicateDeclarations(node);
1520415195
}
1520515196
}
1520615197

@@ -17259,7 +17250,7 @@ namespace ts {
1725917250
// perform property check if property or indexer is declared in 'type'
1726017251
// this allows to rule out cases when both property and indexer are inherited from the base class
1726117252
let errorNode: Node;
17262-
if (prop.valueDeclaration.name.kind === SyntaxKind.ComputedPropertyName || prop.parent === containingType.symbol) {
17253+
if (prop.valueDeclaration.name.kind === SyntaxKind.ComputedPropertyName || prop.parent === containingType.symbol) {
1726317254
errorNode = prop.valueDeclaration;
1726417255
}
1726517256
else if (indexDeclaration) {
@@ -20538,7 +20529,7 @@ namespace ts {
2053820529
continue;
2053920530
}
2054020531
const name = prop.name;
20541-
if (name && name.kind === SyntaxKind.ComputedPropertyName) {
20532+
if (name.kind === SyntaxKind.ComputedPropertyName) {
2054220533
// If the name is not a ComputedPropertyName, the grammar checking will skip it
2054320534
checkGrammarComputedPropertyName(<ComputedPropertyName>name);
2054420535
}

0 commit comments

Comments
 (0)