TypeScript/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.errors.txt

20 lines
1.5 KiB
Text
Raw Normal View History

tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceTransitiveConstraints.ts(2,29): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceTransitiveConstraints.ts(2,42): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceTransitiveConstraints.ts(7,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'd' must be of type '{}[]', but here has type 'Date[]'.
2014-07-13 01:04:16 +02:00
==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceTransitiveConstraints.ts (3 errors) ====
function fn<A extends Date, B extends A, C extends B>(a: A, b: B, c: C) {
~~~~~~~~~~~
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
2014-07-13 01:04:16 +02:00
~~~~~~~~~~~
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
2014-07-13 01:04:16 +02:00
return [a, b, c];
}
var d = fn(new Date(), new Date(), new Date());
var d: Date[]; // Should be OK (d should be Date[])
~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'd' must be of type '{}[]', but here has type 'Date[]'.
2014-07-13 01:04:16 +02:00