mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
Less code
This commit is contained in:
@@ -15730,17 +15730,13 @@ namespace ts {
|
||||
function reportRelationError(message: DiagnosticMessage | undefined, source: Type, target: Type) {
|
||||
if (incompatibleStack.length) reportIncompatibleStack();
|
||||
const [sourceType, targetType] = getTypeNamesForErrorDisplay(source, target);
|
||||
let generalizedSource: Type;
|
||||
let generalizedSourceType: string;
|
||||
let generalizedSource = source;
|
||||
let generalizedSourceType = sourceType;
|
||||
|
||||
if (isLiteralType(source) && !typeCouldHaveTopLevelSingletonTypes(target)) {
|
||||
generalizedSource = getBaseTypeOfLiteralType(source);
|
||||
generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
|
||||
}
|
||||
else {
|
||||
generalizedSource = source;
|
||||
generalizedSourceType = sourceType;
|
||||
}
|
||||
|
||||
if (target.flags & TypeFlags.TypeParameter) {
|
||||
const constraint = getBaseConstraintOfType(target);
|
||||
|
||||
Reference in New Issue
Block a user