Address more PR comments

This commit is contained in:
Nathan Shively-Sanders 2016-11-07 13:57:26 -08:00
parent bd5ce284c9
commit e1c50e1c40

View file

@ -4488,10 +4488,9 @@ namespace ts {
function getPropertiesOfType(type: Type): Symbol[] {
type = getApparentType(type);
if (type.flags & TypeFlags.UnionOrIntersection) {
return getPropertiesOfUnionOrIntersectionType(<UnionType>type);
}
return getPropertiesOfObjectType(type);
return type.flags & TypeFlags.UnionOrIntersection ?
getPropertiesOfUnionOrIntersectionType(<UnionType>type) :
getPropertiesOfObjectType(type);
}
/**
@ -4581,9 +4580,6 @@ namespace ts {
result.hasNonUniformType = hasNonUniformType;
result.isPartial = isPartial;
result.declarations = declarations;
if (declarations.length) {
result.valueDeclaration = declarations[0];
}
result.isReadonly = isReadonly;
result.type = containingType.flags & TypeFlags.Union ? getUnionType(propTypes) : getIntersectionType(propTypes);
return result;
@ -5926,9 +5922,6 @@ namespace ts {
result.leftSpread = leftProp;
result.rightSpread = rightProp;
result.declarations = declarations;
if (declarations.length) {
result.valueDeclaration = declarations[0];
}
result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp);
members[leftProp.name] = result;
}
@ -15196,13 +15189,11 @@ namespace ts {
forEach(node.members, checkSourceElement);
if (produceDiagnostics) {
const type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
if (type.flags & TypeFlags.Object) {
checkIndexConstraints(type);
checkTypeForDuplicateIndexSignatures(node);
checkObjectTypeForDuplicateDeclarations(node);
}
}
}
function checkArrayType(node: ArrayTypeNode) {
checkSourceElement(node.elementType);
@ -20538,7 +20529,7 @@ namespace ts {
continue;
}
const name = prop.name;
if (name && name.kind === SyntaxKind.ComputedPropertyName) {
if (name.kind === SyntaxKind.ComputedPropertyName) {
// If the name is not a ComputedPropertyName, the grammar checking will skip it
checkGrammarComputedPropertyName(<ComputedPropertyName>name);
}