Skip to content

Commit d3b95d2

Browse files
committedOct 29, 2015
Merge pull request #5422 from weswigham/const-enum-deprocdessing
Const enum deconst'ing
2 parents 8e732c9 + b076458 commit d3b95d2

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed
 

Diff for: ‎Jakefile.js

+2
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
452452
// Stanalone/web definition file using global 'ts' namespace
453453
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
454454
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
455+
definitionFileContents = definitionFileContents.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, '$1$2enum $3 {$4');
456+
fs.writeFileSync(standaloneDefinitionsFile, definitionFileContents);
455457

456458
// Official node package definition file, pointed to by 'typings' in package.json
457459
// Created by appending 'export = ts;' at the end of the standalone file to turn it into an external module

Diff for: ‎tests/baselines/reference/APISample_compile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ function compile(fileNames, options) {
5757
exports.compile = compile;
5858
compile(process.argv.slice(2), {
5959
noEmitOnError: true, noImplicitAny: true,
60-
target: 1 /* ES5 */, module: 1 /* CommonJS */
60+
target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS
6161
});

Diff for: ‎tests/baselines/reference/APISample_linter.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -75,28 +75,28 @@ function delint(sourceFile) {
7575
delintNode(sourceFile);
7676
function delintNode(node) {
7777
switch (node.kind) {
78-
case 199 /* ForStatement */:
79-
case 200 /* ForInStatement */:
80-
case 198 /* WhileStatement */:
81-
case 197 /* DoStatement */:
82-
if (node.statement.kind !== 192 /* Block */) {
78+
case ts.SyntaxKind.ForStatement:
79+
case ts.SyntaxKind.ForInStatement:
80+
case ts.SyntaxKind.WhileStatement:
81+
case ts.SyntaxKind.DoStatement:
82+
if (node.statement.kind !== ts.SyntaxKind.Block) {
8383
report(node, "A looping statement's contents should be wrapped in a block body.");
8484
}
8585
break;
86-
case 196 /* IfStatement */:
86+
case ts.SyntaxKind.IfStatement:
8787
var ifStatement = node;
88-
if (ifStatement.thenStatement.kind !== 192 /* Block */) {
88+
if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) {
8989
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
9090
}
9191
if (ifStatement.elseStatement &&
92-
ifStatement.elseStatement.kind !== 192 /* Block */ &&
93-
ifStatement.elseStatement.kind !== 196 /* IfStatement */) {
92+
ifStatement.elseStatement.kind !== ts.SyntaxKind.Block &&
93+
ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) {
9494
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
9595
}
9696
break;
97-
case 181 /* BinaryExpression */:
97+
case ts.SyntaxKind.BinaryExpression:
9898
var op = node.operatorToken.kind;
99-
if (op === 30 /* EqualsEqualsToken */ || op == 31 /* ExclamationEqualsToken */) {
99+
if (op === ts.SyntaxKind.EqualsEqualsToken || op == ts.SyntaxKind.ExclamationEqualsToken) {
100100
report(node, "Use '===' and '!=='.");
101101
}
102102
break;
@@ -112,7 +112,7 @@ exports.delint = delint;
112112
var fileNames = process.argv.slice(2);
113113
fileNames.forEach(function (fileName) {
114114
// Parse a file
115-
var sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), 2 /* ES6 */, /*setParentNodes */ true);
115+
var sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true);
116116
// delint it
117117
delint(sourceFile);
118118
});

Diff for: ‎tests/baselines/reference/APISample_transform.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ console.log(JSON.stringify(result));
2424
*/
2525
var ts = require("typescript");
2626
var source = "let x: string = 'string'";
27-
var result = ts.transpile(source, { module: 1 /* CommonJS */ });
27+
var result = ts.transpile(source, { module: ts.ModuleKind.CommonJS });
2828
console.log(JSON.stringify(result));

Diff for: ‎tests/baselines/reference/APISample_watcher.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,4 @@ function watch(rootFileNames, options) {
181181
var currentDirectoryFiles = fs.readdirSync(process.cwd()).
182182
filter(function (fileName) { return fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts"; });
183183
// Start the watcher
184-
watch(currentDirectoryFiles, { module: 1 /* CommonJS */ });
184+
watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS });

0 commit comments

Comments
 (0)
Please sign in to comment.