TypeScript/tests/cases/compiler/enumAssignmentCompat3.ts
2015-12-10 11:05:25 -08:00

46 lines
787 B
TypeScript

namespace First {
export enum E {
a, b, c,
}
}
namespace Abc {
export enum E {
a, b, c,
}
export enum Nope {
a, b, c,
}
}
namespace Abcd {
export enum E {
a, b, c, d,
}
}
namespace Ab {
export enum E {
a, b,
}
}
namespace Cd {
export enum E {
c, d,
}
}
var abc: First.E;
var secondAbc: Abc.E;
var secondAbcd: Abcd.E;
var secondAb: Ab.E;
var secondCd: Cd.E;
var nope: Abc.Nope;
abc = secondAbc; // ok
abc = secondAbcd; // missing 'd'
abc = secondAb; // ok
abc = secondCd; // missing 'd'
abc = nope; // nope!
secondAbc = abc; // ok
secondAbcd = abc; // ok
secondAb = abc; // missing 'c'
secondCd = abc; // missing 'a' and 'b'
nope = abc; // nope!