From e05a94457ed172fd37fd7852cddee0399d245001 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 15 Apr 2015 11:48:26 -0700 Subject: [PATCH] Fix up comment --- src/compiler/checker.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index df5356e7332..c5151c8d438 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4062,7 +4062,8 @@ module ts { } } - // Even if relationship doesn't hold for type arguments, it may hold in a structural comparison + // Even if relationship doesn't hold for unions, type parameters, or generic type references, + // it may hold in a structural comparison. // Report structural errors only if we haven't reported any errors yet let reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; // identity relation does not use apparent type @@ -4074,6 +4075,8 @@ module ts { } } else if (source.flags & TypeFlags.TypeParameter && sourceOrApparentType.flags & TypeFlags.Union) { + // We clear the errors first because the following check often gives a better error than + // the union comparison above if it is applicable. errorInfo = saveErrorInfo; if (result = isRelatedTo(sourceOrApparentType, target, reportErrors)) { return result;