mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
57 lines
712 B
TypeScript
57 lines
712 B
TypeScript
//// [tests/cases/conformance/types/primitives/void/invalidVoidValues.ts] ////
|
|
|
|
//// [invalidVoidValues.ts]
|
|
var x: void;
|
|
x = 1;
|
|
x = '';
|
|
x = true;
|
|
|
|
enum E { A }
|
|
x = E;
|
|
x = E.A;
|
|
|
|
class C { foo!: string }
|
|
declare var a: C;
|
|
x = a;
|
|
|
|
interface I { foo: string }
|
|
declare var b: I;
|
|
x = b;
|
|
|
|
x = { f() {} }
|
|
|
|
namespace M { export var x = 1; }
|
|
x = M;
|
|
|
|
function f<T>(a: T) {
|
|
x = a;
|
|
}
|
|
x = f;
|
|
|
|
//// [invalidVoidValues.js]
|
|
"use strict";
|
|
var x;
|
|
x = 1;
|
|
x = '';
|
|
x = true;
|
|
var E;
|
|
(function (E) {
|
|
E[E["A"] = 0] = "A";
|
|
})(E || (E = {}));
|
|
x = E;
|
|
x = E.A;
|
|
class C {
|
|
}
|
|
x = a;
|
|
x = b;
|
|
x = { f() { } };
|
|
var M;
|
|
(function (M) {
|
|
M.x = 1;
|
|
})(M || (M = {}));
|
|
x = M;
|
|
function f(a) {
|
|
x = a;
|
|
}
|
|
x = f;
|