mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 01:34:55 -06:00
Improve error message for type parameter extending union
This commit is contained in:
parent
1d8fb49f4c
commit
628a5baf4a
@ -4074,8 +4074,8 @@ module ts {
|
||||
}
|
||||
}
|
||||
else if (source.flags & TypeFlags.TypeParameter && sourceOrApparentType.flags & TypeFlags.Union) {
|
||||
if (result = isRelatedTo(sourceOrApparentType, <ObjectType>target, reportStructuralErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
errorInfo = saveErrorInfo;
|
||||
if (result = isRelatedTo(sourceOrApparentType, target, reportErrors)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/typeParameterDiamond3.ts(8,13): error TS2322: Type 'T | U' is not assignable to type 'Top'.
|
||||
Type 'T' is not assignable to type 'Top'.
|
||||
tests/cases/compiler/typeParameterDiamond3.ts(9,13): error TS2322: Type 'Bottom' is not assignable to type 'T | U'.
|
||||
Type 'Bottom' is not assignable to type 'U'.
|
||||
Type 'Top | T | U' is not assignable to type 'U'.
|
||||
Type 'Top | T | U' is not assignable to type 'T | U'.
|
||||
Type 'Top' is not assignable to type 'T | U'.
|
||||
Type 'Top' is not assignable to type 'U'.
|
||||
tests/cases/compiler/typeParameterDiamond3.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'.
|
||||
Type 'Top | T | U' is not assignable to type 'Top'.
|
||||
@ -24,8 +24,8 @@ tests/cases/compiler/typeParameterDiamond3.ts(10,13): error TS2322: Type 'Bottom
|
||||
middle = bottom;
|
||||
~~~~~~
|
||||
!!! error TS2322: Type 'Bottom' is not assignable to type 'T | U'.
|
||||
!!! error TS2322: Type 'Bottom' is not assignable to type 'U'.
|
||||
!!! error TS2322: Type 'Top | T | U' is not assignable to type 'U'.
|
||||
!!! error TS2322: Type 'Top | T | U' is not assignable to type 'T | U'.
|
||||
!!! error TS2322: Type 'Top' is not assignable to type 'T | U'.
|
||||
!!! error TS2322: Type 'Top' is not assignable to type 'U'.
|
||||
top = bottom;
|
||||
~~~
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user