TypeScript/tests/cases/compiler/ambientConstLiterals.ts

23 lines
481 B
TypeScript
Raw Normal View History

2016-09-26 21:47:22 +02:00
// @declaration: true
function f<T>(x: T): T {
return x;
}
enum E { A, B, C, "non identifier" }
2016-09-26 21:47:22 +02:00
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"];
2016-09-26 21:47:22 +02:00
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;