88 lines
No EOL
5.9 KiB
Text
88 lines
No EOL
5.9 KiB
Text
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(3,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(5,12): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(8,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(9,5): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(10,12): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(13,22): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(14,5): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(15,12): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(18,20): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(19,5): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(20,12): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(23,14): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(24,5): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(25,12): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(28,11): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(29,5): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts(30,12): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
|
|
|
|
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterUsedAsTypeParameterConstraint.ts (18 errors) ====
|
|
// Type parameters are in scope in their own and other type parameter lists
|
|
|
|
function foo<T, U extends T>(x: T, y: U): T {
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
x = y;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
return y;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
}
|
|
|
|
function foo2<U extends T, T>(x: T, y: U): T {
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
x = y;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
return y;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
}
|
|
|
|
var f = function <T, U extends T>(x: T, y: U): T {
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
x = y;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
return y;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
}
|
|
|
|
var f2 = function <U extends T, T>(x: T, y: U): T {
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
x = y;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
return y;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
}
|
|
|
|
var f3 = <T, U extends T>(x: T, y: U): T => {
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
x = y;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
return y;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
}
|
|
|
|
var f4 = <U extends T, T>(x: T, y: U): T => {
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
x = y;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
return y;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
} |