@@ -17997,16 +17997,16 @@ namespace ts {
17997
17997
return {
17998
17998
errorInfo,
17999
17999
lastSkippedInfo,
18000
- incompatibleStack: incompatibleStack ? incompatibleStack .slice() : undefined ,
18000
+ incompatibleStack: incompatibleStack? .slice(),
18001
18001
overrideNextErrorInfo,
18002
- relatedInfo: relatedInfo ? relatedInfo .slice() as [DiagnosticRelatedInformation, ...DiagnosticRelatedInformation[]] : undefined,
18002
+ relatedInfo: relatedInfo? .slice() as [DiagnosticRelatedInformation, ...DiagnosticRelatedInformation[]] | undefined,
18003
18003
};
18004
18004
}
18005
18005
18006
18006
function reportIncompatibleError(message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number) {
18007
18007
overrideNextErrorInfo++; // Suppress the next relation error
18008
18008
lastSkippedInfo = undefined; // Reset skipped info cache
18009
- (incompatibleStack || (incompatibleStack = []) ).push([message, arg0, arg1, arg2, arg3]);
18009
+ (incompatibleStack ||= []).push([message, arg0, arg1, arg2, arg3]);
18010
18010
}
18011
18011
18012
18012
function reportIncompatibleStack() {
@@ -18579,18 +18579,9 @@ namespace ts {
18579
18579
}
18580
18580
}
18581
18581
// Check to see if any constituents of the intersection are immediately related to the target.
18582
- //
18583
- // Don't report errors though. Checking whether a constituent is related to the source is not actually
18584
- // useful and leads to some confusing error messages. Instead it is better to let the below checks
18585
- // take care of this, or to not elaborate at all. For instance,
18586
- //
18587
- // - For an object type (such as 'C = A & B'), users are usually more interested in structural errors.
18588
- //
18589
- // - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection
18590
- // than to report that 'D' is not assignable to 'A' or 'B'.
18591
- //
18592
- // - For a primitive type or type parameter (such as 'number = A & B') there is no point in
18593
- // breaking the intersection apart.
18582
+ // Don't report errors though. Elaborating on whether a source constituent is related to the target is
18583
+ // not actually useful and leads to some confusing error messages. Instead, we rely on the caller
18584
+ // checking whether the full intersection viewed as an object is related to the target.
18594
18585
return someTypeRelatedToType(source as IntersectionType, target, /*reportErrors*/ false, IntersectionState.Source);
18595
18586
}
18596
18587
0 commit comments