(source, target, unmatchedProperty, requireOptionalProperties)
| 66394 | return related; |
| 66395 | } |
| 66396 | function reportUnmatchedProperty(source, target, unmatchedProperty, requireOptionalProperties) { |
| 66397 | var shouldSkipElaboration = false; |
| 66398 | // give specific error in case where private names have the same description |
| 66399 | if (unmatchedProperty.valueDeclaration |
| 66400 | && ts.isNamedDeclaration(unmatchedProperty.valueDeclaration) |
| 66401 | && ts.isPrivateIdentifier(unmatchedProperty.valueDeclaration.name) |
| 66402 | && source.symbol |
| 66403 | && source.symbol.flags & 32 /* SymbolFlags.Class */) { |
| 66404 | var privateIdentifierDescription = unmatchedProperty.valueDeclaration.name.escapedText; |
| 66405 | var symbolTableKey = ts.getSymbolNameForPrivateIdentifier(source.symbol, privateIdentifierDescription); |
| 66406 | if (symbolTableKey && getPropertyOfType(source, symbolTableKey)) { |
| 66407 | var sourceName = ts.factory.getDeclarationName(source.symbol.valueDeclaration); |
| 66408 | var targetName = ts.factory.getDeclarationName(target.symbol.valueDeclaration); |
| 66409 | reportError(ts.Diagnostics.Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2, diagnosticName(privateIdentifierDescription), diagnosticName(sourceName.escapedText === "" ? anon : sourceName), diagnosticName(targetName.escapedText === "" ? anon : targetName)); |
| 66410 | return; |
| 66411 | } |
| 66412 | } |
| 66413 | var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false)); |
| 66414 | if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code && |
| 66415 | headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) { |
| 66416 | shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it |
| 66417 | } |
| 66418 | if (props.length === 1) { |
| 66419 | var propName = symbolToString(unmatchedProperty); |
| 66420 | reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); |
| 66421 | if (ts.length(unmatchedProperty.declarations)) { |
| 66422 | associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); |
| 66423 | } |
| 66424 | if (shouldSkipElaboration && errorInfo) { |
| 66425 | overrideNextErrorInfo++; |
| 66426 | } |
| 66427 | } |
| 66428 | else if (tryElaborateArrayLikeErrors(source, target, /*reportErrors*/ false)) { |
| 66429 | if (props.length > 5) { // arbitrary cutoff for too-long list form |
| 66430 | reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4); |
| 66431 | } |
| 66432 | else { |
| 66433 | reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", ")); |
| 66434 | } |
| 66435 | if (shouldSkipElaboration && errorInfo) { |
| 66436 | overrideNextErrorInfo++; |
| 66437 | } |
| 66438 | } |
| 66439 | // No array like or unmatched property error - just issue top level error (errorInfo = undefined) |
| 66440 | } |
| 66441 | function propertiesRelatedTo(source, target, reportErrors, excludedProperties, intersectionState) { |
| 66442 | if (relation === identityRelation) { |
| 66443 | return propertiesIdenticalTo(source, target, excludedProperties); |
no test coverage detected