2014-07-13 01:04:16 +02:00
|
|
|
//// [genericTypeWithNonGenericBaseMisMatch.ts]
|
|
|
|
interface I {
|
|
|
|
f: (a: { a: number }) => void
|
|
|
|
}
|
|
|
|
class X<T extends { a: string }> implements I {
|
|
|
|
f(a: T): void { }
|
|
|
|
}
|
|
|
|
var x = new X<{ a: string }>();
|
|
|
|
var i: I = x; // Should not be allowed -- type of 'f' is incompatible with 'I'
|
|
|
|
|
|
|
|
|
|
|
|
//// [genericTypeWithNonGenericBaseMisMatch.js]
|
|
|
|
var X = (function () {
|
|
|
|
function X() {
|
|
|
|
}
|
2015-02-07 03:45:09 +01:00
|
|
|
X.prototype.f = function (a) { };
|
2014-07-13 01:04:16 +02:00
|
|
|
return X;
|
|
|
|
})();
|
|
|
|
var x = new X();
|
2014-08-15 22:18:54 +02:00
|
|
|
var i = x; // Should not be allowed -- type of 'f' is incompatible with 'I'
|