Files
tsgo/testdata/baselines/reference/submodule/compiler/covariance1.js

39 lines
657 B
TypeScript

//// [tests/cases/compiler/covariance1.ts] ////
//// [covariance1.ts]
namespace M {
interface X { m1:number; }
export class XX implements X { constructor(public m1:number) { } }
interface Y { x:X; }
export function f(y:Y) { }
var a:X;
f({x:a}); // ok
var b:XX;
f({x:b}); // ok covariant subtype
}
//// [covariance1.js]
"use strict";
var M;
(function (M) {
class XX {
constructor(m1) {
this.m1 = m1;
}
}
M.XX = XX;
function f(y) { }
M.f = f;
var a;
f({ x: a }); // ok
var b;
f({ x: b }); // ok covariant subtype
})(M || (M = {}));