29 lines
559 B
TypeScript
29 lines
559 B
TypeScript
//// [assignmentCompatForEnums.ts]
|
|
enum TokenType { One, Two };
|
|
|
|
var list = {};
|
|
|
|
|
|
function returnType(): TokenType { return null; }
|
|
|
|
function foo() {
|
|
var x = returnType();
|
|
|
|
var x: TokenType = list['one'];
|
|
}
|
|
|
|
|
|
|
|
//// [assignmentCompatForEnums.js]
|
|
var TokenType;
|
|
(function (TokenType) {
|
|
TokenType[TokenType["One"] = 0] = "One";
|
|
TokenType[TokenType["Two"] = 1] = "Two";
|
|
})(TokenType || (TokenType = {}));
|
|
;
|
|
var list = {};
|
|
function returnType() { return null; }
|
|
function foo() {
|
|
var x = returnType();
|
|
var x = list['one'];
|
|
}
|