Address more PR comments
This commit is contained in:
parent
bd5ce284c9
commit
e1c50e1c40
|
@ -4488,10 +4488,9 @@ namespace ts {
|
||||||
|
|
||||||
function getPropertiesOfType(type: Type): Symbol[] {
|
function getPropertiesOfType(type: Type): Symbol[] {
|
||||||
type = getApparentType(type);
|
type = getApparentType(type);
|
||||||
if (type.flags & TypeFlags.UnionOrIntersection) {
|
return type.flags & TypeFlags.UnionOrIntersection ?
|
||||||
return getPropertiesOfUnionOrIntersectionType(<UnionType>type);
|
getPropertiesOfUnionOrIntersectionType(<UnionType>type) :
|
||||||
}
|
getPropertiesOfObjectType(type);
|
||||||
return getPropertiesOfObjectType(type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4581,9 +4580,6 @@ namespace ts {
|
||||||
result.hasNonUniformType = hasNonUniformType;
|
result.hasNonUniformType = hasNonUniformType;
|
||||||
result.isPartial = isPartial;
|
result.isPartial = isPartial;
|
||||||
result.declarations = declarations;
|
result.declarations = declarations;
|
||||||
if (declarations.length) {
|
|
||||||
result.valueDeclaration = declarations[0];
|
|
||||||
}
|
|
||||||
result.isReadonly = isReadonly;
|
result.isReadonly = isReadonly;
|
||||||
result.type = containingType.flags & TypeFlags.Union ? getUnionType(propTypes) : getIntersectionType(propTypes);
|
result.type = containingType.flags & TypeFlags.Union ? getUnionType(propTypes) : getIntersectionType(propTypes);
|
||||||
return result;
|
return result;
|
||||||
|
@ -5057,7 +5053,7 @@ namespace ts {
|
||||||
const declaration = getIndexDeclarationOfSymbol(symbol, kind);
|
const declaration = getIndexDeclarationOfSymbol(symbol, kind);
|
||||||
if (declaration) {
|
if (declaration) {
|
||||||
return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType,
|
return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType,
|
||||||
(getModifierFlags(declaration) & ModifierFlags.Readonly) !== 0, declaration);
|
(getModifierFlags(declaration) & ModifierFlags.Readonly) !== 0, declaration);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -5926,9 +5922,6 @@ namespace ts {
|
||||||
result.leftSpread = leftProp;
|
result.leftSpread = leftProp;
|
||||||
result.rightSpread = rightProp;
|
result.rightSpread = rightProp;
|
||||||
result.declarations = declarations;
|
result.declarations = declarations;
|
||||||
if (declarations.length) {
|
|
||||||
result.valueDeclaration = declarations[0];
|
|
||||||
}
|
|
||||||
result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp);
|
result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp);
|
||||||
members[leftProp.name] = result;
|
members[leftProp.name] = result;
|
||||||
}
|
}
|
||||||
|
@ -15196,11 +15189,9 @@ namespace ts {
|
||||||
forEach(node.members, checkSourceElement);
|
forEach(node.members, checkSourceElement);
|
||||||
if (produceDiagnostics) {
|
if (produceDiagnostics) {
|
||||||
const type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
|
const type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
|
||||||
if (type.flags & TypeFlags.Object) {
|
checkIndexConstraints(type);
|
||||||
checkIndexConstraints(type);
|
checkTypeForDuplicateIndexSignatures(node);
|
||||||
checkTypeForDuplicateIndexSignatures(node);
|
checkObjectTypeForDuplicateDeclarations(node);
|
||||||
checkObjectTypeForDuplicateDeclarations(node);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17259,7 +17250,7 @@ namespace ts {
|
||||||
// perform property check if property or indexer is declared in 'type'
|
// perform property check if property or indexer is declared in 'type'
|
||||||
// this allows to rule out cases when both property and indexer are inherited from the base class
|
// this allows to rule out cases when both property and indexer are inherited from the base class
|
||||||
let errorNode: Node;
|
let errorNode: Node;
|
||||||
if (prop.valueDeclaration.name.kind === SyntaxKind.ComputedPropertyName || prop.parent === containingType.symbol) {
|
if (prop.valueDeclaration.name.kind === SyntaxKind.ComputedPropertyName || prop.parent === containingType.symbol) {
|
||||||
errorNode = prop.valueDeclaration;
|
errorNode = prop.valueDeclaration;
|
||||||
}
|
}
|
||||||
else if (indexDeclaration) {
|
else if (indexDeclaration) {
|
||||||
|
@ -20538,7 +20529,7 @@ namespace ts {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const name = prop.name;
|
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
|
// If the name is not a ComputedPropertyName, the grammar checking will skip it
|
||||||
checkGrammarComputedPropertyName(<ComputedPropertyName>name);
|
checkGrammarComputedPropertyName(<ComputedPropertyName>name);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue