TypeScript/tests/cases/compiler/ambientConstLiterals.ts
Wesley Wigham f8b6a8fc8d
Introduce literal freshness for literal enum member types (#26556)
* Introduce literal freshness for literal enum members, allow enum references in ambient const initializers

* Merge statements

* Add enum literal readonly property test case

* Accept better baselines post-merge
2018-09-07 12:09:07 -07:00

23 lines
481 B
TypeScript

// @declaration: true
function f<T>(x: T): T {
return x;
}
enum E { A, B, C, "non identifier" }
const c1 = "abc";
const c2 = 123;
const c3 = c1;
const c4 = c2;
const c5 = f(123);
const c6 = f(-123);
const c7 = true;
const c8 = E.A;
const c8b = E["non identifier"];
const c9 = { x: "abc" };
const c10 = [123];
const c11 = "abc" + "def";
const c12 = 123 + 456;
const c13 = Math.random() > 0.5 ? "abc" : "def";
const c14 = Math.random() > 0.5 ? 123 : 456;