2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/restParameterAssignmentCompatibility.ts ===
class T {
2015-04-16 01:44:20 +02:00
>T : T
2014-08-15 23:33:16 +02:00
m(...p3) {
2015-04-16 01:44:20 +02:00
>m : (...p3: any[]) => void
>p3 : any[]
2014-08-15 23:33:16 +02:00
}
}
class S {
2015-04-16 01:44:20 +02:00
>S : S
2014-08-15 23:33:16 +02:00
m(p1, p2) {
2015-04-16 01:44:20 +02:00
>m : (p1: any, p2: any) => void
>p1 : any
>p2 : any
2014-08-15 23:33:16 +02:00
}
}
var t: T;
2015-04-16 01:44:20 +02:00
>t : T
>T : T
2014-08-15 23:33:16 +02:00
var s: S;
2015-04-16 01:44:20 +02:00
>s : S
>S : S
2014-08-15 23:33:16 +02:00
// M is a non - specialized call or construct signature and S' contains a call or construct signature N where,
// the number of non-optional parameters in N is less than or equal to the total number of parameters in M,
t = s; // Should be valid (rest params correspond to an infinite expansion of parameters)
>t = s : S
2015-04-16 01:44:20 +02:00
>t : T
>s : S
2014-08-15 23:33:16 +02:00
class T1 {
2015-04-16 01:44:20 +02:00
>T1 : T1
2014-08-15 23:33:16 +02:00
m(p1?, p2?) {
2015-04-16 01:44:20 +02:00
>m : (p1?: any, p2?: any) => void
>p1 : any
>p2 : any
2014-08-15 23:33:16 +02:00
}
}
var t1: T1;
2015-04-16 01:44:20 +02:00
>t1 : T1
>T1 : T1
2014-08-15 23:33:16 +02:00
// When comparing call or construct signatures, parameter names are ignored and rest parameters correspond to an unbounded expansion of optional parameters of the rest parameter element type.
t1 = s; // Similar to above, but optionality does not matter here.
>t1 = s : S
2015-04-16 01:44:20 +02:00
>t1 : T1
>s : S
2014-08-15 23:33:16 +02:00