From bd0cebef2f9b832b6ad6be7794b8f812034b4634 Mon Sep 17 00:00:00 2001
From: Alexandru Ciuca <alexandru.ciuca@1and1.ro>
Date: Fri, 9 Oct 2015 12:23:35 +0300
Subject: [PATCH 1/8] Simplify build; de-hardcode typescript typings

---
 build.js                             |    7 +-
 index.ts                             |  165 +-
 package.json                         |    3 +-
 test/errors/tsconfig.json            |    5 +
 test/ignoreDiagnostics/tsconfig.json |    5 +
 test/instance/tsconfig.json          |    5 +
 test/node/tsconfig.json              |    5 +
 test/replacement/tsconfig.json       |    5 +
 tsconfig.json                        |    9 +
 typings/typescript/typescript.d.ts   | 2104 --------------------------
 10 files changed, 121 insertions(+), 2192 deletions(-)
 create mode 100644 test/errors/tsconfig.json
 create mode 100644 test/ignoreDiagnostics/tsconfig.json
 create mode 100644 test/instance/tsconfig.json
 create mode 100644 test/node/tsconfig.json
 create mode 100644 test/replacement/tsconfig.json
 create mode 100644 tsconfig.json
 delete mode 100644 typings/typescript/typescript.d.ts

diff --git a/build.js b/build.js
index 2fe93cade..afeb9a81c 100644
--- a/build.js
+++ b/build.js
@@ -10,9 +10,4 @@ function cb(error, stdout, stderr) {
     }
 }
 
-if (semver.lt(typescript.version, '1.6.0-0')) {
-	exec('tsc index.ts --module commonjs', cb)
-}
-else {
-	exec('tsc index.ts --module commonjs --moduleResolution classic', cb)
-}
\ No newline at end of file
+exec('tsc', cb);
\ No newline at end of file
diff --git a/index.ts b/index.ts
index bfdaadfbd..3c8c4b9e6 100644
--- a/index.ts
+++ b/index.ts
@@ -1,11 +1,10 @@
-///<reference path="typings/typescript/typescript.d.ts" />
 ///<reference path="typings/node/node.d.ts" />
 ///<reference path="typings/loaderUtils/loaderUtils.d.ts" />
 ///<reference path="typings/objectAssign/objectAssign.d.ts" />
 ///<reference path="typings/colors/colors.d.ts" />
 ///<reference path="typings/arrify/arrify.d.ts" />
-import typescript = require('typescript')
-import path = require('path')
+import typescript = require('typescript');
+import path = require('path');
 import fs = require('fs');
 import os = require('os');
 import loaderUtils = require('loader-utils');
@@ -81,7 +80,7 @@ function formatErrors(diagnostics: typescript.Diagnostic[], instance: TSInstance
         .map<WebpackError>(diagnostic => {
             var errorCategory = instance.compiler.DiagnosticCategory[diagnostic.category].toLowerCase();
             var errorCategoryAndCode = errorCategory + ' TS' + diagnostic.code + ': ';
-        
+
             var messageText = errorCategoryAndCode + instance.compiler.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL);
             if (diagnostic.file) {
                 var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
@@ -103,7 +102,7 @@ function formatErrors(diagnostics: typescript.Diagnostic[], instance: TSInstance
         .map(error => <WebpackError>objectAssign(error, merge));
 }
 
-// The tsconfig.json is found using the same method as `tsc`, starting in the current directory 
+// The tsconfig.json is found using the same method as `tsc`, starting in the current directory
 // and continuing up the parent directory chain.
 function findConfigFile(compiler: typeof typescript, searchPath: string, configFileName: string): string {
     while (true) {
@@ -120,7 +119,7 @@ function findConfigFile(compiler: typeof typescript, searchPath: string, configF
     return undefined;
 }
 
-// The loader is executed once for each file seen by webpack. However, we need to keep 
+// The loader is executed once for each file seen by webpack. However, we need to keep
 // a persistent instance of TypeScript that contains all of the files in the program
 // along with definition files and options. This function either creates an instance
 // or returns the existing one. Multiple instances are possible by using the
@@ -132,13 +131,13 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
             console.log.apply(console, messages);
         }
     }
-    
+
     if (hasOwnProperty(instances, loaderOptions.instance)) {
-        return { instance: instances[loaderOptions.instance] };        
+        return { instance: instances[loaderOptions.instance] };
     }
-    
+
     try {
-        var compiler = require(loaderOptions.compiler);
+        var compiler: typeof typescript = require(loaderOptions.compiler);
     }
     catch (e) {
         let message = loaderOptions.compiler == 'typescript'
@@ -150,7 +149,7 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
             loaderSource: 'ts-loader'
         } };
     }
-    
+
     var motd = `ts-loader: Using ${loaderOptions.compiler}@${compiler.version}`,
         compilerCompatible = false;
     if (loaderOptions.compiler == 'typescript') {
@@ -165,7 +164,7 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
     else {
         log(`${motd}. This version may or may not be compatible with ts-loader.`.yellow);
     }
-    
+
     var files = <TSFiles>{};
     var instance: TSInstance = instances[loaderOptions.instance] = {
         compiler,
@@ -174,20 +173,24 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
         files,
         languageService: null
     };
-    
+
     var compilerOptions: typescript.CompilerOptions = {
         module: 1 /* CommonJS */
     };
-    
+
     // Load any available tsconfig.json file
     var filesToLoad = [];
     var configFilePath = findConfigFile(compiler, path.dirname(loader.resourcePath), loaderOptions.configFileName);
+    var configFile: {
+        config?: any;
+        error?: typescript.Diagnostic;
+    };
     if (configFilePath) {
         if (compilerCompatible) log(`${motd} and ${configFilePath}`.green)
         else log(`ts-loader: Using config file at ${configFilePath}`.green)
-        
-        var configFile = compiler.readConfigFile(configFilePath, (filePath) => fs.readFileSync(filePath, 'utf-8'));
-        
+
+        configFile = compiler.readConfigFile(configFilePath);
+
         if (configFile.error) {
             var configFileError = formatErrors([configFile.error], instance, {file: configFilePath })[0];
             return { error: configFileError }
@@ -195,31 +198,31 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
     }
     else {
         if (compilerCompatible) log(motd.green)
-        
-        var configFile:any = {
+
+        configFile = {
             config: {
                 compilerOptions: {},
                 files: []
             }
         }
     }
-    
+
     configFile.config.compilerOptions = objectAssign({},
         configFile.config.compilerOptions,
         loaderOptions.compilerOptions);
-    
+
     // do any necessary config massaging
     if (loaderOptions.transpileOnly) {
         configFile.config.compilerOptions.isolatedModules = true;
     }
-    
+
     var configParseResult = compiler.parseConfigFile(configFile.config, compiler.sys, path.dirname(configFilePath));
-    
+
     if (configParseResult.errors.length) {
         pushArray(
-            loader._module.errors, 
+            loader._module.errors,
             formatErrors(configParseResult.errors, instance, { file: configFilePath }));
-        
+
         return { error: {
             file: configFilePath,
             message: 'error while parsing tsconfig.json'.red,
@@ -227,10 +230,10 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
             loaderSource: 'ts-loader'
         }};
     }
-    
+
     instance.compilerOptions = objectAssign<typescript.CompilerOptions>(compilerOptions, configParseResult.options);
     filesToLoad = configParseResult.fileNames;
-    
+
     var libFileName = 'lib.d.ts';
 
     // Special handling for ES6 targets
@@ -238,25 +241,25 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
         compilerOptions.module = 0 /* None */;
         libFileName = 'lib.es6.d.ts';
     }
-    
+
     if (loaderOptions.transpileOnly) {
         // quick return for transpiling
         // we do need to check for any issues with TS options though
         var program = compiler.createProgram([], compilerOptions),
-            diagnostics = program.getOptionsDiagnostics 
-                ? program.getOptionsDiagnostics() 
-                : program.getCompilerOptionsDiagnostics();
+            diagnostics = program.getOptionsDiagnostics
+                ? program.getOptionsDiagnostics()
+                : languageService.getCompilerOptionsDiagnostics();
         pushArray(
             loader._module.errors,
             formatErrors(diagnostics, instance, {file: configFilePath || 'tsconfig.json'}));
-        
+
         return { instance: instances[loaderOptions.instance] = { compiler, compilerOptions, loaderOptions, files }};
     }
-    
+
     if (!compilerOptions.noLib) {
         filesToLoad.push(path.join(path.dirname(require.resolve(loaderOptions.compiler)), libFileName));
     }
-    
+
     // Load initial files (core lib files, any files specified in tsconfig.json)
     filesToLoad.forEach(filePath => {
         filePath = path.normalize(filePath);
@@ -265,7 +268,7 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
             version: 0
         }
     });
-    
+
     let newLine =
         compilerOptions.newLine === 0 /* CarriageReturnLineFeed */ ? '\r\n' :
         compilerOptions.newLine === 1 /* LineFeed */ ? '\n' :
@@ -275,8 +278,8 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
     let resolver = makeResolver(loader.options);
 
     var moduleResolutionHost = {
-        fileExists: (fileName: string) => { return servicesHost.getScriptSnapshot(fileName) !== undefined; },      
-        readFile: (fileName: string) => { 
+        fileExists: (fileName: string) => { return servicesHost.getScriptSnapshot(fileName) !== undefined; },
+        readFile: (fileName: string) => {
             let snapshot = servicesHost.getScriptSnapshot(fileName);
             return snapshot && snapshot.getText(0, snapshot.getLength());
         }
@@ -291,22 +294,22 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
         },
         getScriptSnapshot: fileName => {
             // This is called any time TypeScript needs a file's text
-            // We either load from memory or from disk 
+            // We either load from memory or from disk
             fileName = path.normalize(fileName);
             var file = files[fileName];
-            
+
             if (!file) {
                 try {
                     file = files[fileName] = {
-                        version: 0, 
+                        version: 0,
                         text: fs.readFileSync(fileName, {encoding: 'utf8'})
                     }
                 }
                 catch (e) {
                     return;
                 }
-            } 
-            
+            }
+
             return compiler.ScriptSnapshot.fromString(file.text);
         },
         getCurrentDirectory: () => process.cwd(),
@@ -316,21 +319,21 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
         log: log,
         resolveModuleNames: (moduleNames: string[], containingFile: string) => {
             let resolvedModules: any[] = [];
-                        
+
             for (let moduleName of moduleNames) {
                 let resolvedFileName: string;
                 let resolutionResult: any;
-                
+
                 try {
                     resolvedFileName = resolver.resolveSync(containingFile, moduleName)
-                    
+
                     if (!resolvedFileName.match(/\.tsx?$/)) resolvedFileName = null;
-                    else resolutionResult = { resolvedFileName }; 
+                    else resolutionResult = { resolvedFileName };
                 }
                 catch (e) { resolvedFileName = null }
-                
+
                 let tsResolution: ResolvedModule = compiler.resolveModuleName(moduleName, containingFile, compilerOptions, moduleResolutionHost);
-                
+
                 if (tsResolution.resolvedModule) {
                     if (resolvedFileName) {
                         if (resolvedFileName == tsResolution.resolvedModule.resolvedFileName) {
@@ -350,22 +353,22 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
             return resolvedModules;
         }
     };
-    
+
     var languageService = instance.languageService = compiler.createLanguageService(servicesHost, compiler.createDocumentRegistry());
-    
+
     var compilerOptionDiagnostics = languageService.getCompilerOptionsDiagnostics();
-    
+
     loader._compiler.plugin("after-compile", (compilation, callback) => {
         let stats = compilation.stats;
-        
+
         // handle all other errors. The basic approach here to get accurate error
         // reporting is to start with a "blank slate" each compilation and gather
         // all errors from all files. Since webpack tracks errors in a module from
         // compilation-to-compilation, and since not every module always runs through
         // the loader, we need to detect and remove any pre-existing errors.
-        
+
         function removeTSLoaderErrors(errors: WebpackError[]) {
-            let index = -1, length = errors.length; 
+            let index = -1, length = errors.length;
             while (++index < length) {
                 if (errors[index].loaderSource == 'ts-loader') {
                     errors.splice(index--, 1);
@@ -373,15 +376,15 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
                 }
             }
         }
-        
+
         removeTSLoaderErrors(compilation.errors);
-        
+
         // handle compiler option errors after the first compile
         pushArray(
             compilation.errors,
             formatErrors(compilerOptionDiagnostics, instance, {file: configFilePath || 'tsconfig.json'}));
         compilerOptionDiagnostics = [];
-        
+
         // build map of all modules based on normalized filename
         // this is used for quick-lookup when trying to find modules
         // based on filepath
@@ -400,21 +403,21 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
                 }
             }
         })
-        
+
         // gather all errors from TypeScript and output them to webpack
         Object.keys(instance.files)
             .filter(filePath => !!filePath.match(/(\.d)?\.ts(x?)$/))
             .forEach(filePath => {
                 let errors = languageService.getSyntacticDiagnostics(filePath).concat(languageService.getSemanticDiagnostics(filePath));
-                
+
                 // if we have access to a webpack module, use that
                 if (hasOwnProperty(modules, filePath)) {
                     let associatedModules = modules[filePath];
-                    
+
                     associatedModules.forEach(module => {
                         // remove any existing errors
                         removeTSLoaderErrors(module.errors);
-                        
+
                         // append errors
                         let formattedErrors = formatErrors(errors, instance, { module });
                         pushArray(module.errors, formattedErrors);
@@ -426,10 +429,10 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
                     pushArray(compilation.errors, formatErrors(errors, instance, {file: filePath}));
                 }
             });
-            
+
         callback();
     });
-    
+
     // manually update changed declaration files
     loader._compiler.plugin("watch-run", (watching, cb) => {
         var mtimes = watching.compiler.watchFileSystem.watcher.mtimes;
@@ -445,7 +448,7 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
             });
         cb()
     })
-    
+
     return { instance };
 }
 
@@ -453,10 +456,10 @@ function loader(contents) {
     this.cacheable && this.cacheable();
     var callback = this.async();
     var filePath = path.normalize(this.resourcePath);
-    
+
     var queryOptions = loaderUtils.parseQuery<LoaderOptions>(this.query);
     var configFileOptions = this.options.ts || {};
-    
+
     var options = objectAssign<LoaderOptions>({}, {
         silent: false,
         instance: 'default',
@@ -466,30 +469,30 @@ function loader(contents) {
         compilerOptions: {}
     }, configFileOptions, queryOptions);
     options.ignoreDiagnostics = arrify(options.ignoreDiagnostics).map(Number);
-    
+
     // differentiate the TypeScript instance based on the webpack instance
     var webpackIndex = webpackInstances.indexOf(this._compiler);
     if (webpackIndex == -1) {
         webpackIndex = webpackInstances.push(this._compiler)-1;
     }
     options.instance = webpackIndex + '_' + options.instance;
-    
+
     var { instance, error } = ensureTypeScriptInstance(options, this);
-    
+
     if (error) {
         callback(error)
         return;
     }
-    
+
     // Update file version
     var file = instance.files[filePath]
     if (!file) {
         file = instance.files[filePath] = <TSFile>{ version: 0 };
     }
     file.version++;
-    
+
     var outputText: string, sourceMapText: string, diagnostics: typescript.Diagnostic[] = [];
-    
+
     if (options.transpileOnly) {
         var fileName = path.basename(filePath);
         // if transpileModule is available, use it (TS 1.6+)
@@ -499,34 +502,34 @@ function loader(contents) {
                 reportDiagnostics: true,
                 fileName
             });
-            
+
             ({ outputText, sourceMapText, diagnostics } = transpileResult);
         } else {
             outputText = instance.compiler.transpile(
-                contents, 
-                instance.compilerOptions, 
+                contents,
+                instance.compilerOptions,
                 fileName, diagnostics);
         }
-        
+
         pushArray(this._module.errors, formatErrors(diagnostics, instance, {module: this._module}));
     }
     else {
         let langService = instance.languageService;
-        
+
         // Update file contents
         file.text = contents;
-        
+
         // Make this file dependent on *all* definition files in the program
         this.clearDependencies();
         this.addDependency(filePath);
         Object.keys(instance.files).filter(filePath => !!filePath.match(/\.d\.ts$/)).forEach(this.addDependency.bind(this));
-    
+
         // Emit Javascript
         var output = langService.getEmitOutput(filePath);
-        
+
         var outputFile = output.outputFiles.filter(file => !!file.name.match(/\.js(x?)$/)).pop();
         if (outputFile) { outputText = outputFile.text }
-    
+
         var sourceMapFile = output.outputFiles.filter(file => !!file.name.match(/\.js(x?)\.map$/)).pop();
         if (sourceMapFile) { sourceMapText = sourceMapFile.text }
     }
diff --git a/package.json b/package.json
index a992c8dc5..70ec2d006 100644
--- a/package.json
+++ b/package.json
@@ -42,6 +42,7 @@
     "mkdirp": "^0.5.1",
     "mocha": "^2.1.0",
     "rimraf": "^2.4.2",
-    "webpack": "^1.11.0"
+    "webpack": "^1.11.0",
+    "typescript": "^1.6.2"
   }
 }
diff --git a/test/errors/tsconfig.json b/test/errors/tsconfig.json
new file mode 100644
index 000000000..fc16344c1
--- /dev/null
+++ b/test/errors/tsconfig.json
@@ -0,0 +1,5 @@
+{
+	"compilerOptions": {
+	},
+    "files": []
+}
\ No newline at end of file
diff --git a/test/ignoreDiagnostics/tsconfig.json b/test/ignoreDiagnostics/tsconfig.json
new file mode 100644
index 000000000..fc16344c1
--- /dev/null
+++ b/test/ignoreDiagnostics/tsconfig.json
@@ -0,0 +1,5 @@
+{
+	"compilerOptions": {
+	},
+    "files": []
+}
\ No newline at end of file
diff --git a/test/instance/tsconfig.json b/test/instance/tsconfig.json
new file mode 100644
index 000000000..fc16344c1
--- /dev/null
+++ b/test/instance/tsconfig.json
@@ -0,0 +1,5 @@
+{
+	"compilerOptions": {
+	},
+    "files": []
+}
\ No newline at end of file
diff --git a/test/node/tsconfig.json b/test/node/tsconfig.json
new file mode 100644
index 000000000..fc16344c1
--- /dev/null
+++ b/test/node/tsconfig.json
@@ -0,0 +1,5 @@
+{
+	"compilerOptions": {
+	},
+    "files": []
+}
\ No newline at end of file
diff --git a/test/replacement/tsconfig.json b/test/replacement/tsconfig.json
new file mode 100644
index 000000000..fc16344c1
--- /dev/null
+++ b/test/replacement/tsconfig.json
@@ -0,0 +1,5 @@
+{
+	"compilerOptions": {
+	},
+    "files": []
+}
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 000000000..35f96a537
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,9 @@
+{
+    "compilerOptions": {
+        "module": "commonjs",
+        "moduleResolution": "node"
+    },
+    "files": [
+        "index.ts"
+    ]
+}
diff --git a/typings/typescript/typescript.d.ts b/typings/typescript/typescript.d.ts
deleted file mode 100644
index 5e66e6624..000000000
--- a/typings/typescript/typescript.d.ts
+++ /dev/null
@@ -1,2104 +0,0 @@
-/*! *****************************************************************************
-Copyright (c) Microsoft Corporation. All rights reserved. 
-Licensed under the Apache License, Version 2.0 (the "License"); you may not use
-this file except in compliance with the License. You may obtain a copy of the
-License at http://www.apache.org/licenses/LICENSE-2.0  
- 
-THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
-WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
-MERCHANTABLITY OR NON-INFRINGEMENT. 
- 
-See the Apache Version 2.0 License for specific language governing permissions
-and limitations under the License.
-***************************************************************************** */
-
-declare module "typescript" {
-    interface Map<T> {
-        [index: string]: T;
-    }
-    interface FileMap<T> {
-        get(fileName: string): T;
-        set(fileName: string, value: T): void;
-        contains(fileName: string): boolean;
-        remove(fileName: string): void;
-        forEachValue(f: (v: T) => void): void;
-    }
-    interface TextRange {
-        pos: number;
-        end: number;
-    }
-    const enum SyntaxKind {
-        Unknown = 0,
-        EndOfFileToken = 1,
-        SingleLineCommentTrivia = 2,
-        MultiLineCommentTrivia = 3,
-        NewLineTrivia = 4,
-        WhitespaceTrivia = 5,
-        ConflictMarkerTrivia = 6,
-        NumericLiteral = 7,
-        StringLiteral = 8,
-        RegularExpressionLiteral = 9,
-        NoSubstitutionTemplateLiteral = 10,
-        TemplateHead = 11,
-        TemplateMiddle = 12,
-        TemplateTail = 13,
-        OpenBraceToken = 14,
-        CloseBraceToken = 15,
-        OpenParenToken = 16,
-        CloseParenToken = 17,
-        OpenBracketToken = 18,
-        CloseBracketToken = 19,
-        DotToken = 20,
-        DotDotDotToken = 21,
-        SemicolonToken = 22,
-        CommaToken = 23,
-        LessThanToken = 24,
-        LessThanSlashToken = 25,
-        GreaterThanToken = 26,
-        LessThanEqualsToken = 27,
-        GreaterThanEqualsToken = 28,
-        EqualsEqualsToken = 29,
-        ExclamationEqualsToken = 30,
-        EqualsEqualsEqualsToken = 31,
-        ExclamationEqualsEqualsToken = 32,
-        EqualsGreaterThanToken = 33,
-        PlusToken = 34,
-        MinusToken = 35,
-        AsteriskToken = 36,
-        SlashToken = 37,
-        PercentToken = 38,
-        PlusPlusToken = 39,
-        MinusMinusToken = 40,
-        LessThanLessThanToken = 41,
-        GreaterThanGreaterThanToken = 42,
-        GreaterThanGreaterThanGreaterThanToken = 43,
-        AmpersandToken = 44,
-        BarToken = 45,
-        CaretToken = 46,
-        ExclamationToken = 47,
-        TildeToken = 48,
-        AmpersandAmpersandToken = 49,
-        BarBarToken = 50,
-        QuestionToken = 51,
-        ColonToken = 52,
-        AtToken = 53,
-        EqualsToken = 54,
-        PlusEqualsToken = 55,
-        MinusEqualsToken = 56,
-        AsteriskEqualsToken = 57,
-        SlashEqualsToken = 58,
-        PercentEqualsToken = 59,
-        LessThanLessThanEqualsToken = 60,
-        GreaterThanGreaterThanEqualsToken = 61,
-        GreaterThanGreaterThanGreaterThanEqualsToken = 62,
-        AmpersandEqualsToken = 63,
-        BarEqualsToken = 64,
-        CaretEqualsToken = 65,
-        Identifier = 66,
-        BreakKeyword = 67,
-        CaseKeyword = 68,
-        CatchKeyword = 69,
-        ClassKeyword = 70,
-        ConstKeyword = 71,
-        ContinueKeyword = 72,
-        DebuggerKeyword = 73,
-        DefaultKeyword = 74,
-        DeleteKeyword = 75,
-        DoKeyword = 76,
-        ElseKeyword = 77,
-        EnumKeyword = 78,
-        ExportKeyword = 79,
-        ExtendsKeyword = 80,
-        FalseKeyword = 81,
-        FinallyKeyword = 82,
-        ForKeyword = 83,
-        FunctionKeyword = 84,
-        IfKeyword = 85,
-        ImportKeyword = 86,
-        InKeyword = 87,
-        InstanceOfKeyword = 88,
-        NewKeyword = 89,
-        NullKeyword = 90,
-        ReturnKeyword = 91,
-        SuperKeyword = 92,
-        SwitchKeyword = 93,
-        ThisKeyword = 94,
-        ThrowKeyword = 95,
-        TrueKeyword = 96,
-        TryKeyword = 97,
-        TypeOfKeyword = 98,
-        VarKeyword = 99,
-        VoidKeyword = 100,
-        WhileKeyword = 101,
-        WithKeyword = 102,
-        ImplementsKeyword = 103,
-        InterfaceKeyword = 104,
-        LetKeyword = 105,
-        PackageKeyword = 106,
-        PrivateKeyword = 107,
-        ProtectedKeyword = 108,
-        PublicKeyword = 109,
-        StaticKeyword = 110,
-        YieldKeyword = 111,
-        AbstractKeyword = 112,
-        AsKeyword = 113,
-        AnyKeyword = 114,
-        AsyncKeyword = 115,
-        AwaitKeyword = 116,
-        BooleanKeyword = 117,
-        ConstructorKeyword = 118,
-        DeclareKeyword = 119,
-        GetKeyword = 120,
-        IsKeyword = 121,
-        ModuleKeyword = 122,
-        NamespaceKeyword = 123,
-        RequireKeyword = 124,
-        NumberKeyword = 125,
-        SetKeyword = 126,
-        StringKeyword = 127,
-        SymbolKeyword = 128,
-        TypeKeyword = 129,
-        FromKeyword = 130,
-        OfKeyword = 131,
-        QualifiedName = 132,
-        ComputedPropertyName = 133,
-        TypeParameter = 134,
-        Parameter = 135,
-        Decorator = 136,
-        PropertySignature = 137,
-        PropertyDeclaration = 138,
-        MethodSignature = 139,
-        MethodDeclaration = 140,
-        Constructor = 141,
-        GetAccessor = 142,
-        SetAccessor = 143,
-        CallSignature = 144,
-        ConstructSignature = 145,
-        IndexSignature = 146,
-        TypePredicate = 147,
-        TypeReference = 148,
-        FunctionType = 149,
-        ConstructorType = 150,
-        TypeQuery = 151,
-        TypeLiteral = 152,
-        ArrayType = 153,
-        TupleType = 154,
-        UnionType = 155,
-        IntersectionType = 156,
-        ParenthesizedType = 157,
-        ObjectBindingPattern = 158,
-        ArrayBindingPattern = 159,
-        BindingElement = 160,
-        ArrayLiteralExpression = 161,
-        ObjectLiteralExpression = 162,
-        PropertyAccessExpression = 163,
-        ElementAccessExpression = 164,
-        CallExpression = 165,
-        NewExpression = 166,
-        TaggedTemplateExpression = 167,
-        TypeAssertionExpression = 168,
-        ParenthesizedExpression = 169,
-        FunctionExpression = 170,
-        ArrowFunction = 171,
-        DeleteExpression = 172,
-        TypeOfExpression = 173,
-        VoidExpression = 174,
-        AwaitExpression = 175,
-        PrefixUnaryExpression = 176,
-        PostfixUnaryExpression = 177,
-        BinaryExpression = 178,
-        ConditionalExpression = 179,
-        TemplateExpression = 180,
-        YieldExpression = 181,
-        SpreadElementExpression = 182,
-        ClassExpression = 183,
-        OmittedExpression = 184,
-        ExpressionWithTypeArguments = 185,
-        AsExpression = 186,
-        TemplateSpan = 187,
-        SemicolonClassElement = 188,
-        Block = 189,
-        VariableStatement = 190,
-        EmptyStatement = 191,
-        ExpressionStatement = 192,
-        IfStatement = 193,
-        DoStatement = 194,
-        WhileStatement = 195,
-        ForStatement = 196,
-        ForInStatement = 197,
-        ForOfStatement = 198,
-        ContinueStatement = 199,
-        BreakStatement = 200,
-        ReturnStatement = 201,
-        WithStatement = 202,
-        SwitchStatement = 203,
-        LabeledStatement = 204,
-        ThrowStatement = 205,
-        TryStatement = 206,
-        DebuggerStatement = 207,
-        VariableDeclaration = 208,
-        VariableDeclarationList = 209,
-        FunctionDeclaration = 210,
-        ClassDeclaration = 211,
-        InterfaceDeclaration = 212,
-        TypeAliasDeclaration = 213,
-        EnumDeclaration = 214,
-        ModuleDeclaration = 215,
-        ModuleBlock = 216,
-        CaseBlock = 217,
-        ImportEqualsDeclaration = 218,
-        ImportDeclaration = 219,
-        ImportClause = 220,
-        NamespaceImport = 221,
-        NamedImports = 222,
-        ImportSpecifier = 223,
-        ExportAssignment = 224,
-        ExportDeclaration = 225,
-        NamedExports = 226,
-        ExportSpecifier = 227,
-        MissingDeclaration = 228,
-        ExternalModuleReference = 229,
-        JsxElement = 230,
-        JsxSelfClosingElement = 231,
-        JsxOpeningElement = 232,
-        JsxText = 233,
-        JsxClosingElement = 234,
-        JsxAttribute = 235,
-        JsxSpreadAttribute = 236,
-        JsxExpression = 237,
-        CaseClause = 238,
-        DefaultClause = 239,
-        HeritageClause = 240,
-        CatchClause = 241,
-        PropertyAssignment = 242,
-        ShorthandPropertyAssignment = 243,
-        EnumMember = 244,
-        SourceFile = 245,
-        JSDocTypeExpression = 246,
-        JSDocAllType = 247,
-        JSDocUnknownType = 248,
-        JSDocArrayType = 249,
-        JSDocUnionType = 250,
-        JSDocTupleType = 251,
-        JSDocNullableType = 252,
-        JSDocNonNullableType = 253,
-        JSDocRecordType = 254,
-        JSDocRecordMember = 255,
-        JSDocTypeReference = 256,
-        JSDocOptionalType = 257,
-        JSDocFunctionType = 258,
-        JSDocVariadicType = 259,
-        JSDocConstructorType = 260,
-        JSDocThisType = 261,
-        JSDocComment = 262,
-        JSDocTag = 263,
-        JSDocParameterTag = 264,
-        JSDocReturnTag = 265,
-        JSDocTypeTag = 266,
-        JSDocTemplateTag = 267,
-        SyntaxList = 268,
-        Count = 269,
-        FirstAssignment = 54,
-        LastAssignment = 65,
-        FirstReservedWord = 67,
-        LastReservedWord = 102,
-        FirstKeyword = 67,
-        LastKeyword = 131,
-        FirstFutureReservedWord = 103,
-        LastFutureReservedWord = 111,
-        FirstTypeNode = 148,
-        LastTypeNode = 157,
-        FirstPunctuation = 14,
-        LastPunctuation = 65,
-        FirstToken = 0,
-        LastToken = 131,
-        FirstTriviaToken = 2,
-        LastTriviaToken = 6,
-        FirstLiteralToken = 7,
-        LastLiteralToken = 10,
-        FirstTemplateToken = 10,
-        LastTemplateToken = 13,
-        FirstBinaryOperator = 24,
-        LastBinaryOperator = 65,
-        FirstNode = 132,
-    }
-    const enum NodeFlags {
-        Export = 1,
-        Ambient = 2,
-        Public = 16,
-        Private = 32,
-        Protected = 64,
-        Static = 128,
-        Abstract = 256,
-        Async = 512,
-        Default = 1024,
-        MultiLine = 2048,
-        Synthetic = 4096,
-        DeclarationFile = 8192,
-        Let = 16384,
-        Const = 32768,
-        OctalLiteral = 65536,
-        Namespace = 131072,
-        ExportContext = 262144,
-        Modifier = 2035,
-        AccessibilityModifier = 112,
-        BlockScoped = 49152,
-    }
-    const enum JsxFlags {
-        None = 0,
-        IntrinsicNamedElement = 1,
-        IntrinsicIndexedElement = 2,
-        ClassElement = 4,
-        UnknownElement = 8,
-        IntrinsicElement = 3,
-    }
-    interface Node extends TextRange {
-        kind: SyntaxKind;
-        flags: NodeFlags;
-        decorators?: NodeArray<Decorator>;
-        modifiers?: ModifiersArray;
-        parent?: Node;
-    }
-    interface NodeArray<T> extends Array<T>, TextRange {
-        hasTrailingComma?: boolean;
-    }
-    interface ModifiersArray extends NodeArray<Node> {
-        flags: number;
-    }
-    interface Identifier extends PrimaryExpression {
-        text: string;
-        originalKeywordKind?: SyntaxKind;
-    }
-    interface QualifiedName extends Node {
-        left: EntityName;
-        right: Identifier;
-    }
-    type EntityName = Identifier | QualifiedName;
-    type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern;
-    interface Declaration extends Node {
-        _declarationBrand: any;
-        name?: DeclarationName;
-    }
-    interface ComputedPropertyName extends Node {
-        expression: Expression;
-    }
-    interface Decorator extends Node {
-        expression: LeftHandSideExpression;
-    }
-    interface TypeParameterDeclaration extends Declaration {
-        name: Identifier;
-        constraint?: TypeNode;
-        expression?: Expression;
-    }
-    interface SignatureDeclaration extends Declaration {
-        typeParameters?: NodeArray<TypeParameterDeclaration>;
-        parameters: NodeArray<ParameterDeclaration>;
-        type?: TypeNode;
-    }
-    interface VariableDeclaration extends Declaration {
-        parent?: VariableDeclarationList;
-        name: Identifier | BindingPattern;
-        type?: TypeNode;
-        initializer?: Expression;
-    }
-    interface VariableDeclarationList extends Node {
-        declarations: NodeArray<VariableDeclaration>;
-    }
-    interface ParameterDeclaration extends Declaration {
-        dotDotDotToken?: Node;
-        name: Identifier | BindingPattern;
-        questionToken?: Node;
-        type?: TypeNode;
-        initializer?: Expression;
-    }
-    interface BindingElement extends Declaration {
-        propertyName?: Identifier;
-        dotDotDotToken?: Node;
-        name: Identifier | BindingPattern;
-        initializer?: Expression;
-    }
-    interface PropertyDeclaration extends Declaration, ClassElement {
-        name: DeclarationName;
-        questionToken?: Node;
-        type?: TypeNode;
-        initializer?: Expression;
-    }
-    interface ObjectLiteralElement extends Declaration {
-        _objectLiteralBrandBrand: any;
-    }
-    interface PropertyAssignment extends ObjectLiteralElement {
-        _propertyAssignmentBrand: any;
-        name: DeclarationName;
-        questionToken?: Node;
-        initializer: Expression;
-    }
-    interface ShorthandPropertyAssignment extends ObjectLiteralElement {
-        name: Identifier;
-        questionToken?: Node;
-    }
-    interface VariableLikeDeclaration extends Declaration {
-        propertyName?: Identifier;
-        dotDotDotToken?: Node;
-        name: DeclarationName;
-        questionToken?: Node;
-        type?: TypeNode;
-        initializer?: Expression;
-    }
-    interface BindingPattern extends Node {
-        elements: NodeArray<BindingElement>;
-    }
-    /**
-     * Several node kinds share function-like features such as a signature,
-     * a name, and a body. These nodes should extend FunctionLikeDeclaration.
-     * Examples:
-     *  FunctionDeclaration
-     *  MethodDeclaration
-     *  AccessorDeclaration
-     */
-    interface FunctionLikeDeclaration extends SignatureDeclaration {
-        _functionLikeDeclarationBrand: any;
-        asteriskToken?: Node;
-        questionToken?: Node;
-        body?: Block | Expression;
-    }
-    interface FunctionDeclaration extends FunctionLikeDeclaration, Statement {
-        name?: Identifier;
-        body?: Block;
-    }
-    interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
-        body?: Block;
-    }
-    interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
-        body?: Block;
-    }
-    interface SemicolonClassElement extends ClassElement {
-        _semicolonClassElementBrand: any;
-    }
-    interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
-        _accessorDeclarationBrand: any;
-        body: Block;
-    }
-    interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement {
-        _indexSignatureDeclarationBrand: any;
-    }
-    interface TypeNode extends Node {
-        _typeNodeBrand: any;
-    }
-    interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration {
-        _functionOrConstructorTypeNodeBrand: any;
-    }
-    interface TypeReferenceNode extends TypeNode {
-        typeName: EntityName;
-        typeArguments?: NodeArray<TypeNode>;
-    }
-    interface TypePredicateNode extends TypeNode {
-        parameterName: Identifier;
-        type: TypeNode;
-    }
-    interface TypeQueryNode extends TypeNode {
-        exprName: EntityName;
-    }
-    interface TypeLiteralNode extends TypeNode, Declaration {
-        members: NodeArray<Node>;
-    }
-    interface ArrayTypeNode extends TypeNode {
-        elementType: TypeNode;
-    }
-    interface TupleTypeNode extends TypeNode {
-        elementTypes: NodeArray<TypeNode>;
-    }
-    interface UnionOrIntersectionTypeNode extends TypeNode {
-        types: NodeArray<TypeNode>;
-    }
-    interface UnionTypeNode extends UnionOrIntersectionTypeNode {
-    }
-    interface IntersectionTypeNode extends UnionOrIntersectionTypeNode {
-    }
-    interface ParenthesizedTypeNode extends TypeNode {
-        type: TypeNode;
-    }
-    interface StringLiteral extends LiteralExpression, TypeNode {
-        _stringLiteralBrand: any;
-    }
-    interface Expression extends Node {
-        _expressionBrand: any;
-        contextualType?: Type;
-    }
-    interface UnaryExpression extends Expression {
-        _unaryExpressionBrand: any;
-    }
-    interface PrefixUnaryExpression extends UnaryExpression {
-        operator: SyntaxKind;
-        operand: UnaryExpression;
-    }
-    interface PostfixUnaryExpression extends PostfixExpression {
-        operand: LeftHandSideExpression;
-        operator: SyntaxKind;
-    }
-    interface PostfixExpression extends UnaryExpression {
-        _postfixExpressionBrand: any;
-    }
-    interface LeftHandSideExpression extends PostfixExpression {
-        _leftHandSideExpressionBrand: any;
-    }
-    interface MemberExpression extends LeftHandSideExpression {
-        _memberExpressionBrand: any;
-    }
-    interface PrimaryExpression extends MemberExpression {
-        _primaryExpressionBrand: any;
-    }
-    interface DeleteExpression extends UnaryExpression {
-        expression: UnaryExpression;
-    }
-    interface TypeOfExpression extends UnaryExpression {
-        expression: UnaryExpression;
-    }
-    interface VoidExpression extends UnaryExpression {
-        expression: UnaryExpression;
-    }
-    interface AwaitExpression extends UnaryExpression {
-        expression: UnaryExpression;
-    }
-    interface YieldExpression extends Expression {
-        asteriskToken?: Node;
-        expression?: Expression;
-    }
-    interface BinaryExpression extends Expression {
-        left: Expression;
-        operatorToken: Node;
-        right: Expression;
-    }
-    interface ConditionalExpression extends Expression {
-        condition: Expression;
-        questionToken: Node;
-        whenTrue: Expression;
-        colonToken: Node;
-        whenFalse: Expression;
-    }
-    interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration {
-        name?: Identifier;
-        body: Block | Expression;
-    }
-    interface ArrowFunction extends Expression, FunctionLikeDeclaration {
-        equalsGreaterThanToken: Node;
-    }
-    interface LiteralExpression extends PrimaryExpression {
-        text: string;
-        isUnterminated?: boolean;
-        hasExtendedUnicodeEscape?: boolean;
-    }
-    interface TemplateExpression extends PrimaryExpression {
-        head: LiteralExpression;
-        templateSpans: NodeArray<TemplateSpan>;
-    }
-    interface TemplateSpan extends Node {
-        expression: Expression;
-        literal: LiteralExpression;
-    }
-    interface ParenthesizedExpression extends PrimaryExpression {
-        expression: Expression;
-    }
-    interface ArrayLiteralExpression extends PrimaryExpression {
-        elements: NodeArray<Expression>;
-    }
-    interface SpreadElementExpression extends Expression {
-        expression: Expression;
-    }
-    interface ObjectLiteralExpression extends PrimaryExpression, Declaration {
-        properties: NodeArray<ObjectLiteralElement>;
-    }
-    interface PropertyAccessExpression extends MemberExpression {
-        expression: LeftHandSideExpression;
-        dotToken: Node;
-        name: Identifier;
-    }
-    interface ElementAccessExpression extends MemberExpression {
-        expression: LeftHandSideExpression;
-        argumentExpression?: Expression;
-    }
-    interface CallExpression extends LeftHandSideExpression {
-        expression: LeftHandSideExpression;
-        typeArguments?: NodeArray<TypeNode>;
-        arguments: NodeArray<Expression>;
-    }
-    interface ExpressionWithTypeArguments extends TypeNode {
-        expression: LeftHandSideExpression;
-        typeArguments?: NodeArray<TypeNode>;
-    }
-    interface NewExpression extends CallExpression, PrimaryExpression {
-    }
-    interface TaggedTemplateExpression extends MemberExpression {
-        tag: LeftHandSideExpression;
-        template: LiteralExpression | TemplateExpression;
-    }
-    type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
-    interface AsExpression extends Expression {
-        expression: Expression;
-        type: TypeNode;
-    }
-    interface TypeAssertion extends UnaryExpression {
-        type: TypeNode;
-        expression: UnaryExpression;
-    }
-    type AssertionExpression = TypeAssertion | AsExpression;
-    interface JsxElement extends PrimaryExpression {
-        openingElement: JsxOpeningElement;
-        children: NodeArray<JsxChild>;
-        closingElement: JsxClosingElement;
-    }
-    interface JsxOpeningElement extends Expression {
-        _openingElementBrand?: any;
-        tagName: EntityName;
-        attributes: NodeArray<JsxAttribute | JsxSpreadAttribute>;
-    }
-    interface JsxSelfClosingElement extends PrimaryExpression, JsxOpeningElement {
-        _selfClosingElementBrand?: any;
-    }
-    type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement;
-    interface JsxAttribute extends Node {
-        name: Identifier;
-        initializer?: Expression;
-    }
-    interface JsxSpreadAttribute extends Node {
-        expression: Expression;
-    }
-    interface JsxClosingElement extends Node {
-        tagName: EntityName;
-    }
-    interface JsxExpression extends Expression {
-        expression?: Expression;
-    }
-    interface JsxText extends Node {
-        _jsxTextExpressionBrand: any;
-    }
-    type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement;
-    interface Statement extends Node {
-        _statementBrand: any;
-    }
-    interface Block extends Statement {
-        statements: NodeArray<Statement>;
-    }
-    interface VariableStatement extends Statement {
-        declarationList: VariableDeclarationList;
-    }
-    interface ExpressionStatement extends Statement {
-        expression: Expression;
-    }
-    interface IfStatement extends Statement {
-        expression: Expression;
-        thenStatement: Statement;
-        elseStatement?: Statement;
-    }
-    interface IterationStatement extends Statement {
-        statement: Statement;
-    }
-    interface DoStatement extends IterationStatement {
-        expression: Expression;
-    }
-    interface WhileStatement extends IterationStatement {
-        expression: Expression;
-    }
-    interface ForStatement extends IterationStatement {
-        initializer?: VariableDeclarationList | Expression;
-        condition?: Expression;
-        incrementor?: Expression;
-    }
-    interface ForInStatement extends IterationStatement {
-        initializer: VariableDeclarationList | Expression;
-        expression: Expression;
-    }
-    interface ForOfStatement extends IterationStatement {
-        initializer: VariableDeclarationList | Expression;
-        expression: Expression;
-    }
-    interface BreakOrContinueStatement extends Statement {
-        label?: Identifier;
-    }
-    interface ReturnStatement extends Statement {
-        expression?: Expression;
-    }
-    interface WithStatement extends Statement {
-        expression: Expression;
-        statement: Statement;
-    }
-    interface SwitchStatement extends Statement {
-        expression: Expression;
-        caseBlock: CaseBlock;
-    }
-    interface CaseBlock extends Node {
-        clauses: NodeArray<CaseOrDefaultClause>;
-    }
-    interface CaseClause extends Node {
-        expression?: Expression;
-        statements: NodeArray<Statement>;
-    }
-    interface DefaultClause extends Node {
-        statements: NodeArray<Statement>;
-    }
-    type CaseOrDefaultClause = CaseClause | DefaultClause;
-    interface LabeledStatement extends Statement {
-        label: Identifier;
-        statement: Statement;
-    }
-    interface ThrowStatement extends Statement {
-        expression: Expression;
-    }
-    interface TryStatement extends Statement {
-        tryBlock: Block;
-        catchClause?: CatchClause;
-        finallyBlock?: Block;
-    }
-    interface CatchClause extends Node {
-        variableDeclaration: VariableDeclaration;
-        block: Block;
-    }
-    interface ClassLikeDeclaration extends Declaration {
-        name?: Identifier;
-        typeParameters?: NodeArray<TypeParameterDeclaration>;
-        heritageClauses?: NodeArray<HeritageClause>;
-        members: NodeArray<ClassElement>;
-    }
-    interface ClassDeclaration extends ClassLikeDeclaration, Statement {
-    }
-    interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
-    }
-    interface ClassElement extends Declaration {
-        _classElementBrand: any;
-    }
-    interface InterfaceDeclaration extends Declaration, Statement {
-        name: Identifier;
-        typeParameters?: NodeArray<TypeParameterDeclaration>;
-        heritageClauses?: NodeArray<HeritageClause>;
-        members: NodeArray<Declaration>;
-    }
-    interface HeritageClause extends Node {
-        token: SyntaxKind;
-        types?: NodeArray<ExpressionWithTypeArguments>;
-    }
-    interface TypeAliasDeclaration extends Declaration, Statement {
-        name: Identifier;
-        typeParameters?: NodeArray<TypeParameterDeclaration>;
-        type: TypeNode;
-    }
-    interface EnumMember extends Declaration {
-        name: DeclarationName;
-        initializer?: Expression;
-    }
-    interface EnumDeclaration extends Declaration, Statement {
-        name: Identifier;
-        members: NodeArray<EnumMember>;
-    }
-    interface ModuleDeclaration extends Declaration, Statement {
-        name: Identifier | LiteralExpression;
-        body: ModuleBlock | ModuleDeclaration;
-    }
-    interface ModuleBlock extends Node, Statement {
-        statements: NodeArray<Statement>;
-    }
-    interface ImportEqualsDeclaration extends Declaration, Statement {
-        name: Identifier;
-        moduleReference: EntityName | ExternalModuleReference;
-    }
-    interface ExternalModuleReference extends Node {
-        expression?: Expression;
-    }
-    interface ImportDeclaration extends Statement {
-        importClause?: ImportClause;
-        moduleSpecifier: Expression;
-    }
-    interface ImportClause extends Declaration {
-        name?: Identifier;
-        namedBindings?: NamespaceImport | NamedImports;
-    }
-    interface NamespaceImport extends Declaration {
-        name: Identifier;
-    }
-    interface ExportDeclaration extends Declaration, Statement {
-        exportClause?: NamedExports;
-        moduleSpecifier?: Expression;
-    }
-    interface NamedImportsOrExports extends Node {
-        elements: NodeArray<ImportOrExportSpecifier>;
-    }
-    type NamedImports = NamedImportsOrExports;
-    type NamedExports = NamedImportsOrExports;
-    interface ImportOrExportSpecifier extends Declaration {
-        propertyName?: Identifier;
-        name: Identifier;
-    }
-    type ImportSpecifier = ImportOrExportSpecifier;
-    type ExportSpecifier = ImportOrExportSpecifier;
-    interface ExportAssignment extends Declaration, Statement {
-        isExportEquals?: boolean;
-        expression: Expression;
-    }
-    interface FileReference extends TextRange {
-        fileName: string;
-    }
-    interface CommentRange extends TextRange {
-        hasTrailingNewLine?: boolean;
-        kind: SyntaxKind;
-    }
-    interface JSDocTypeExpression extends Node {
-        type: JSDocType;
-    }
-    interface JSDocType extends TypeNode {
-        _jsDocTypeBrand: any;
-    }
-    interface JSDocAllType extends JSDocType {
-        _JSDocAllTypeBrand: any;
-    }
-    interface JSDocUnknownType extends JSDocType {
-        _JSDocUnknownTypeBrand: any;
-    }
-    interface JSDocArrayType extends JSDocType {
-        elementType: JSDocType;
-    }
-    interface JSDocUnionType extends JSDocType {
-        types: NodeArray<JSDocType>;
-    }
-    interface JSDocTupleType extends JSDocType {
-        types: NodeArray<JSDocType>;
-    }
-    interface JSDocNonNullableType extends JSDocType {
-        type: JSDocType;
-    }
-    interface JSDocNullableType extends JSDocType {
-        type: JSDocType;
-    }
-    interface JSDocRecordType extends JSDocType, TypeLiteralNode {
-        members: NodeArray<JSDocRecordMember>;
-    }
-    interface JSDocTypeReference extends JSDocType {
-        name: EntityName;
-        typeArguments: NodeArray<JSDocType>;
-    }
-    interface JSDocOptionalType extends JSDocType {
-        type: JSDocType;
-    }
-    interface JSDocFunctionType extends JSDocType, SignatureDeclaration {
-        parameters: NodeArray<ParameterDeclaration>;
-        type: JSDocType;
-    }
-    interface JSDocVariadicType extends JSDocType {
-        type: JSDocType;
-    }
-    interface JSDocConstructorType extends JSDocType {
-        type: JSDocType;
-    }
-    interface JSDocThisType extends JSDocType {
-        type: JSDocType;
-    }
-    interface JSDocRecordMember extends PropertyDeclaration {
-        name: Identifier | LiteralExpression;
-        type?: JSDocType;
-    }
-    interface JSDocComment extends Node {
-        tags: NodeArray<JSDocTag>;
-    }
-    interface JSDocTag extends Node {
-        atToken: Node;
-        tagName: Identifier;
-    }
-    interface JSDocTemplateTag extends JSDocTag {
-        typeParameters: NodeArray<TypeParameterDeclaration>;
-    }
-    interface JSDocReturnTag extends JSDocTag {
-        typeExpression: JSDocTypeExpression;
-    }
-    interface JSDocTypeTag extends JSDocTag {
-        typeExpression: JSDocTypeExpression;
-    }
-    interface JSDocParameterTag extends JSDocTag {
-        preParameterName?: Identifier;
-        typeExpression?: JSDocTypeExpression;
-        postParameterName?: Identifier;
-        isBracketed: boolean;
-    }
-    interface SourceFile extends Declaration {
-        statements: NodeArray<Statement>;
-        endOfFileToken: Node;
-        fileName: string;
-        text: string;
-        amdDependencies: {
-            path: string;
-            name: string;
-        }[];
-        moduleName: string;
-        referencedFiles: FileReference[];
-        languageVariant: LanguageVariant;
-        /**
-         * lib.d.ts should have a reference comment like
-         *
-         *  /// <reference no-default-lib="true"/>
-         *
-         * If any other file has this comment, it signals not to include lib.d.ts
-         * because this containing file is intended to act as a default library.
-         */
-        hasNoDefaultLib: boolean;
-        languageVersion: ScriptTarget;
-    }
-    interface ScriptReferenceHost {
-        getCompilerOptions(): CompilerOptions;
-        getSourceFile(fileName: string): SourceFile;
-        getCurrentDirectory(): string;
-    }
-    interface ParseConfigHost {
-        readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
-    }
-    interface WriteFileCallback {
-        (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
-    }
-    class OperationCanceledException {
-    }
-    interface CancellationToken {
-        isCancellationRequested(): boolean;
-        /** @throws OperationCanceledException if isCancellationRequested is true */
-        throwIfCancellationRequested(): void;
-    }
-    interface Program extends ScriptReferenceHost {
-        /**
-         * Get a list of files in the program
-         */
-        getSourceFiles(): SourceFile[];
-        /**
-         * Emits the JavaScript and declaration files.  If targetSourceFile is not specified, then
-         * the JavaScript and declaration files will be produced for all the files in this program.
-         * If targetSourceFile is specified, then only the JavaScript and declaration for that
-         * specific file will be generated.
-         *
-         * If writeFile is not specified then the writeFile callback from the compiler host will be
-         * used for writing the JavaScript and declaration files.  Otherwise, the writeFile parameter
-         * will be invoked when writing the JavaScript and declaration files.
-         */
-        emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult;
-        getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[];
-        getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[];
-        getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
-        getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
-        getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
-        /**
-         * Gets a type checker that can be used to semantically analyze source fils in the program.
-         */
-        getTypeChecker(): TypeChecker;
-    }
-    interface SourceMapSpan {
-        /** Line number in the .js file. */
-        emittedLine: number;
-        /** Column number in the .js file. */
-        emittedColumn: number;
-        /** Line number in the .ts file. */
-        sourceLine: number;
-        /** Column number in the .ts file. */
-        sourceColumn: number;
-        /** Optional name (index into names array) associated with this span. */
-        nameIndex?: number;
-        /** .ts file (index into sources array) associated with this span */
-        sourceIndex: number;
-    }
-    interface SourceMapData {
-        sourceMapFilePath: string;
-        jsSourceMappingURL: string;
-        sourceMapFile: string;
-        sourceMapSourceRoot: string;
-        sourceMapSources: string[];
-        sourceMapSourcesContent?: string[];
-        inputSourceFileNames: string[];
-        sourceMapNames?: string[];
-        sourceMapMappings: string;
-        sourceMapDecodedMappings: SourceMapSpan[];
-    }
-    /** Return code used by getEmitOutput function to indicate status of the function */
-    enum ExitStatus {
-        Success = 0,
-        DiagnosticsPresent_OutputsSkipped = 1,
-        DiagnosticsPresent_OutputsGenerated = 2,
-    }
-    interface EmitResult {
-        emitSkipped: boolean;
-        diagnostics: Diagnostic[];
-    }
-    interface TypeCheckerHost {
-        getCompilerOptions(): CompilerOptions;
-        getSourceFiles(): SourceFile[];
-        getSourceFile(fileName: string): SourceFile;
-    }
-    interface TypeChecker {
-        getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
-        getDeclaredTypeOfSymbol(symbol: Symbol): Type;
-        getPropertiesOfType(type: Type): Symbol[];
-        getPropertyOfType(type: Type, propertyName: string): Symbol;
-        getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
-        getIndexTypeOfType(type: Type, kind: IndexKind): Type;
-        getBaseTypes(type: InterfaceType): ObjectType[];
-        getReturnTypeOfSignature(signature: Signature): Type;
-        getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
-        getSymbolAtLocation(node: Node): Symbol;
-        getShorthandAssignmentValueSymbol(location: Node): Symbol;
-        getTypeAtLocation(node: Node): Type;
-        typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
-        symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
-        getSymbolDisplayBuilder(): SymbolDisplayBuilder;
-        getFullyQualifiedName(symbol: Symbol): string;
-        getAugmentedPropertiesOfType(type: Type): Symbol[];
-        getRootSymbols(symbol: Symbol): Symbol[];
-        getContextualType(node: Expression): Type;
-        getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature;
-        getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature;
-        isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
-        isUndefinedSymbol(symbol: Symbol): boolean;
-        isArgumentsSymbol(symbol: Symbol): boolean;
-        getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
-        isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
-        getAliasedSymbol(symbol: Symbol): Symbol;
-        getExportsOfModule(moduleSymbol: Symbol): Symbol[];
-        getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type;
-        getJsxIntrinsicTagNames(): Symbol[];
-        isOptionalParameter(node: ParameterDeclaration): boolean;
-    }
-    interface SymbolDisplayBuilder {
-        buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
-        buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void;
-        buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
-        buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
-        buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
-        buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void;
-        buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
-        buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
-        buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
-    }
-    interface SymbolWriter {
-        writeKeyword(text: string): void;
-        writeOperator(text: string): void;
-        writePunctuation(text: string): void;
-        writeSpace(text: string): void;
-        writeStringLiteral(text: string): void;
-        writeParameter(text: string): void;
-        writeSymbol(text: string, symbol: Symbol): void;
-        writeLine(): void;
-        increaseIndent(): void;
-        decreaseIndent(): void;
-        clear(): void;
-        trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void;
-    }
-    const enum TypeFormatFlags {
-        None = 0,
-        WriteArrayAsGenericType = 1,
-        UseTypeOfFunction = 2,
-        NoTruncation = 4,
-        WriteArrowStyleSignature = 8,
-        WriteOwnNameForAnyLike = 16,
-        WriteTypeArgumentsOfSignature = 32,
-        InElementType = 64,
-        UseFullyQualifiedType = 128,
-    }
-    const enum SymbolFormatFlags {
-        None = 0,
-        WriteTypeParametersOrArguments = 1,
-        UseOnlyExternalAliasing = 2,
-    }
-    interface TypePredicate {
-        parameterName: string;
-        parameterIndex: number;
-        type: Type;
-    }
-    const enum SymbolFlags {
-        None = 0,
-        FunctionScopedVariable = 1,
-        BlockScopedVariable = 2,
-        Property = 4,
-        EnumMember = 8,
-        Function = 16,
-        Class = 32,
-        Interface = 64,
-        ConstEnum = 128,
-        RegularEnum = 256,
-        ValueModule = 512,
-        NamespaceModule = 1024,
-        TypeLiteral = 2048,
-        ObjectLiteral = 4096,
-        Method = 8192,
-        Constructor = 16384,
-        GetAccessor = 32768,
-        SetAccessor = 65536,
-        Signature = 131072,
-        TypeParameter = 262144,
-        TypeAlias = 524288,
-        ExportValue = 1048576,
-        ExportType = 2097152,
-        ExportNamespace = 4194304,
-        Alias = 8388608,
-        Instantiated = 16777216,
-        Merged = 33554432,
-        Transient = 67108864,
-        Prototype = 134217728,
-        SyntheticProperty = 268435456,
-        Optional = 536870912,
-        ExportStar = 1073741824,
-        Enum = 384,
-        Variable = 3,
-        Value = 107455,
-        Type = 793056,
-        Namespace = 1536,
-        Module = 1536,
-        Accessor = 98304,
-        FunctionScopedVariableExcludes = 107454,
-        BlockScopedVariableExcludes = 107455,
-        ParameterExcludes = 107455,
-        PropertyExcludes = 107455,
-        EnumMemberExcludes = 107455,
-        FunctionExcludes = 106927,
-        ClassExcludes = 899519,
-        InterfaceExcludes = 792960,
-        RegularEnumExcludes = 899327,
-        ConstEnumExcludes = 899967,
-        ValueModuleExcludes = 106639,
-        NamespaceModuleExcludes = 0,
-        MethodExcludes = 99263,
-        GetAccessorExcludes = 41919,
-        SetAccessorExcludes = 74687,
-        TypeParameterExcludes = 530912,
-        TypeAliasExcludes = 793056,
-        AliasExcludes = 8388608,
-        ModuleMember = 8914931,
-        ExportHasLocal = 944,
-        HasExports = 1952,
-        HasMembers = 6240,
-        BlockScoped = 418,
-        PropertyOrAccessor = 98308,
-        Export = 7340032,
-    }
-    interface Symbol {
-        flags: SymbolFlags;
-        name: string;
-        declarations?: Declaration[];
-        valueDeclaration?: Declaration;
-        members?: SymbolTable;
-        exports?: SymbolTable;
-    }
-    interface SymbolTable {
-        [index: string]: Symbol;
-    }
-    const enum TypeFlags {
-        Any = 1,
-        String = 2,
-        Number = 4,
-        Boolean = 8,
-        Void = 16,
-        Undefined = 32,
-        Null = 64,
-        Enum = 128,
-        StringLiteral = 256,
-        TypeParameter = 512,
-        Class = 1024,
-        Interface = 2048,
-        Reference = 4096,
-        Tuple = 8192,
-        Union = 16384,
-        Intersection = 32768,
-        Anonymous = 65536,
-        Instantiated = 131072,
-        ObjectLiteral = 524288,
-        ESSymbol = 16777216,
-        StringLike = 258,
-        NumberLike = 132,
-        ObjectType = 80896,
-        UnionOrIntersection = 49152,
-        StructuredType = 130048,
-    }
-    interface Type {
-        flags: TypeFlags;
-        symbol?: Symbol;
-    }
-    interface StringLiteralType extends Type {
-        text: string;
-    }
-    interface ObjectType extends Type {
-    }
-    interface InterfaceType extends ObjectType {
-        typeParameters: TypeParameter[];
-        outerTypeParameters: TypeParameter[];
-        localTypeParameters: TypeParameter[];
-    }
-    interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
-        declaredProperties: Symbol[];
-        declaredCallSignatures: Signature[];
-        declaredConstructSignatures: Signature[];
-        declaredStringIndexType: Type;
-        declaredNumberIndexType: Type;
-    }
-    interface TypeReference extends ObjectType {
-        target: GenericType;
-        typeArguments: Type[];
-    }
-    interface GenericType extends InterfaceType, TypeReference {
-    }
-    interface TupleType extends ObjectType {
-        elementTypes: Type[];
-        baseArrayType: TypeReference;
-    }
-    interface UnionOrIntersectionType extends Type {
-        types: Type[];
-    }
-    interface UnionType extends UnionOrIntersectionType {
-    }
-    interface IntersectionType extends UnionOrIntersectionType {
-    }
-    interface TypeParameter extends Type {
-        constraint: Type;
-    }
-    const enum SignatureKind {
-        Call = 0,
-        Construct = 1,
-    }
-    interface Signature {
-        declaration: SignatureDeclaration;
-        typeParameters: TypeParameter[];
-        parameters: Symbol[];
-        typePredicate?: TypePredicate;
-    }
-    const enum IndexKind {
-        String = 0,
-        Number = 1,
-    }
-    interface DiagnosticMessage {
-        key: string;
-        category: DiagnosticCategory;
-        code: number;
-    }
-    /**
-     * A linked list of formatted diagnostic messages to be used as part of a multiline message.
-     * It is built from the bottom up, leaving the head to be the "main" diagnostic.
-     * While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage,
-     * the difference is that messages are all preformatted in DMC.
-     */
-    interface DiagnosticMessageChain {
-        messageText: string;
-        category: DiagnosticCategory;
-        code: number;
-        next?: DiagnosticMessageChain;
-    }
-    interface Diagnostic {
-        file: SourceFile;
-        start: number;
-        length: number;
-        messageText: string | DiagnosticMessageChain;
-        category: DiagnosticCategory;
-        code: number;
-    }
-    enum DiagnosticCategory {
-        Warning = 0,
-        Error = 1,
-        Message = 2,
-    }
-    interface CompilerOptions {
-        allowNonTsExtensions?: boolean;
-        charset?: string;
-        declaration?: boolean;
-        diagnostics?: boolean;
-        emitBOM?: boolean;
-        help?: boolean;
-        inlineSourceMap?: boolean;
-        inlineSources?: boolean;
-        jsx?: JsxEmit;
-        listFiles?: boolean;
-        locale?: string;
-        mapRoot?: string;
-        module?: ModuleKind;
-        newLine?: NewLineKind;
-        noEmit?: boolean;
-        noEmitHelpers?: boolean;
-        noEmitOnError?: boolean;
-        noErrorTruncation?: boolean;
-        noImplicitAny?: boolean;
-        noLib?: boolean;
-        noResolve?: boolean;
-        out?: string;
-        outDir?: string;
-        preserveConstEnums?: boolean;
-        project?: string;
-        removeComments?: boolean;
-        rootDir?: string;
-        sourceMap?: boolean;
-        sourceRoot?: string;
-        suppressImplicitAnyIndexErrors?: boolean;
-        target?: ScriptTarget;
-        version?: boolean;
-        watch?: boolean;
-        isolatedModules?: boolean;
-        experimentalDecorators?: boolean;
-        experimentalAsyncFunctions?: boolean;
-        emitDecoratorMetadata?: boolean;
-        [option: string]: string | number | boolean;
-    }
-    const enum ModuleKind {
-        None = 0,
-        CommonJS = 1,
-        AMD = 2,
-        UMD = 3,
-        System = 4,
-    }
-    const enum JsxEmit {
-        None = 0,
-        Preserve = 1,
-        React = 2,
-    }
-    const enum NewLineKind {
-        CarriageReturnLineFeed = 0,
-        LineFeed = 1,
-    }
-    interface LineAndCharacter {
-        line: number;
-        character: number;
-    }
-    const enum ScriptTarget {
-        ES3 = 0,
-        ES5 = 1,
-        ES6 = 2,
-        Latest = 2,
-    }
-    const enum LanguageVariant {
-        Standard = 0,
-        JSX = 1,
-    }
-    interface ParsedCommandLine {
-        options: CompilerOptions;
-        fileNames: string[];
-        errors: Diagnostic[];
-    }
-    interface CompilerHost {
-        getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
-        getCancellationToken?(): CancellationToken;
-        getDefaultLibFileName(options: CompilerOptions): string;
-        writeFile: WriteFileCallback;
-        getCurrentDirectory(): string;
-        getCanonicalFileName(fileName: string): string;
-        useCaseSensitiveFileNames(): boolean;
-        getNewLine(): string;
-    }
-    interface TextSpan {
-        start: number;
-        length: number;
-    }
-    interface TextChangeRange {
-        span: TextSpan;
-        newLength: number;
-    }
-}
-declare module "typescript" {
-    interface System {
-        args: string[];
-        newLine: string;
-        useCaseSensitiveFileNames: boolean;
-        write(s: string): void;
-        readFile(path: string, encoding?: string): string;
-        writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
-        watchFile?(path: string, callback: (path: string) => void): FileWatcher;
-        resolvePath(path: string): string;
-        fileExists(path: string): boolean;
-        directoryExists(path: string): boolean;
-        createDirectory(path: string): void;
-        getExecutingFilePath(): string;
-        getCurrentDirectory(): string;
-        readDirectory(path: string, extension?: string, exclude?: string[]): string[];
-        getMemoryUsage?(): number;
-        exit(exitCode?: number): void;
-    }
-    interface FileWatcher {
-        close(): void;
-    }
-    var sys: System;
-}
-declare module "typescript" {
-    interface ErrorCallback {
-        (message: DiagnosticMessage, length: number): void;
-    }
-    interface Scanner {
-        getStartPos(): number;
-        getToken(): SyntaxKind;
-        getTextPos(): number;
-        getTokenPos(): number;
-        getTokenText(): string;
-        getTokenValue(): string;
-        hasExtendedUnicodeEscape(): boolean;
-        hasPrecedingLineBreak(): boolean;
-        isIdentifier(): boolean;
-        isReservedWord(): boolean;
-        isUnterminated(): boolean;
-        reScanGreaterToken(): SyntaxKind;
-        reScanSlashToken(): SyntaxKind;
-        reScanTemplateToken(): SyntaxKind;
-        scanJsxIdentifier(): SyntaxKind;
-        reScanJsxToken(): SyntaxKind;
-        scanJsxToken(): SyntaxKind;
-        scan(): SyntaxKind;
-        setText(text: string, start?: number, length?: number): void;
-        setOnError(onError: ErrorCallback): void;
-        setScriptTarget(scriptTarget: ScriptTarget): void;
-        setLanguageVariant(variant: LanguageVariant): void;
-        setTextPos(textPos: number): void;
-        lookAhead<T>(callback: () => T): T;
-        tryScan<T>(callback: () => T): T;
-    }
-    function tokenToString(t: SyntaxKind): string;
-    function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
-    function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
-    function isWhiteSpace(ch: number): boolean;
-    function isLineBreak(ch: number): boolean;
-    function couldStartTrivia(text: string, pos: number): boolean;
-    function getLeadingCommentRanges(text: string, pos: number): CommentRange[];
-    function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
-    function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
-    function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
-}
-declare module "typescript" {
-    function getDefaultLibFileName(options: CompilerOptions): string;
-    function textSpanEnd(span: TextSpan): number;
-    function textSpanIsEmpty(span: TextSpan): boolean;
-    function textSpanContainsPosition(span: TextSpan, position: number): boolean;
-    function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean;
-    function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean;
-    function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan;
-    function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
-    function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
-    function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean;
-    function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
-    function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan;
-    function createTextSpan(start: number, length: number): TextSpan;
-    function createTextSpanFromBounds(start: number, end: number): TextSpan;
-    function textChangeRangeNewSpan(range: TextChangeRange): TextSpan;
-    function textChangeRangeIsUnchanged(range: TextChangeRange): boolean;
-    function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange;
-    let unchangedTextChangeRange: TextChangeRange;
-    /**
-     * Called to merge all the changes that occurred across several versions of a script snapshot
-     * into a single change.  i.e. if a user keeps making successive edits to a script we will
-     * have a text change from V1 to V2, V2 to V3, ..., Vn.
-     *
-     * This function will then merge those changes into a single change range valid between V1 and
-     * Vn.
-     */
-    function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
-    function getTypeParameterOwner(d: Declaration): Declaration;
-}
-declare module "typescript" {
-    function getNodeConstructor(kind: SyntaxKind): new () => Node;
-    function createNode(kind: SyntaxKind): Node;
-    function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
-    function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
-    function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
-}
-declare module "typescript" {
-    /** The version of the TypeScript compiler release */
-    const version: string;
-    function findConfigFile(searchPath: string): string;
-    function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
-    function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
-    function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
-    function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
-}
-declare module "typescript" {
-    function parseCommandLine(commandLine: string[]): ParsedCommandLine;
-    /**
-      * Read tsconfig.json file
-      * @param fileName The path to the config file
-      */
-    function readConfigFile(fileName: string): {
-        config?: any;
-        error?: Diagnostic;
-    };
-    /**
-      * Parse the text of the tsconfig.json file
-      * @param fileName The path to the config file
-      * @param jsonText The text of the config file
-      */
-    function parseConfigFileText(fileName: string, jsonText: string): {
-        config?: any;
-        error?: Diagnostic;
-    };
-    /**
-      * Parse the contents of a config file (tsconfig.json).
-      * @param json The contents of the config file to parse
-      * @param basePath A root directory to resolve relative path entries in the config
-      *    file to. e.g. outDir
-      */
-    function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
-}
-declare module "typescript" {
-    /** The version of the language service API */
-    let servicesVersion: string;
-    interface Node {
-        getSourceFile(): SourceFile;
-        getChildCount(sourceFile?: SourceFile): number;
-        getChildAt(index: number, sourceFile?: SourceFile): Node;
-        getChildren(sourceFile?: SourceFile): Node[];
-        getStart(sourceFile?: SourceFile): number;
-        getFullStart(): number;
-        getEnd(): number;
-        getWidth(sourceFile?: SourceFile): number;
-        getFullWidth(): number;
-        getLeadingTriviaWidth(sourceFile?: SourceFile): number;
-        getFullText(sourceFile?: SourceFile): string;
-        getText(sourceFile?: SourceFile): string;
-        getFirstToken(sourceFile?: SourceFile): Node;
-        getLastToken(sourceFile?: SourceFile): Node;
-    }
-    interface Symbol {
-        getFlags(): SymbolFlags;
-        getName(): string;
-        getDeclarations(): Declaration[];
-        getDocumentationComment(): SymbolDisplayPart[];
-    }
-    interface Type {
-        getFlags(): TypeFlags;
-        getSymbol(): Symbol;
-        getProperties(): Symbol[];
-        getProperty(propertyName: string): Symbol;
-        getApparentProperties(): Symbol[];
-        getCallSignatures(): Signature[];
-        getConstructSignatures(): Signature[];
-        getStringIndexType(): Type;
-        getNumberIndexType(): Type;
-        getBaseTypes(): ObjectType[];
-    }
-    interface Signature {
-        getDeclaration(): SignatureDeclaration;
-        getTypeParameters(): Type[];
-        getParameters(): Symbol[];
-        getReturnType(): Type;
-        getDocumentationComment(): SymbolDisplayPart[];
-    }
-    interface SourceFile {
-        getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
-        getLineStarts(): number[];
-        getPositionOfLineAndCharacter(line: number, character: number): number;
-        update(newText: string, textChangeRange: TextChangeRange): SourceFile;
-    }
-    /**
-     * Represents an immutable snapshot of a script at a specified time.Once acquired, the
-     * snapshot is observably immutable. i.e. the same calls with the same parameters will return
-     * the same values.
-     */
-    interface IScriptSnapshot {
-        /** Gets a portion of the script snapshot specified by [start, end). */
-        getText(start: number, end: number): string;
-        /** Gets the length of this script snapshot. */
-        getLength(): number;
-        /**
-         * Gets the TextChangeRange that describe how the text changed between this text and
-         * an older version.  This information is used by the incremental parser to determine
-         * what sections of the script need to be re-parsed.  'undefined' can be returned if the
-         * change range cannot be determined.  However, in that case, incremental parsing will
-         * not happen and the entire document will be re - parsed.
-         */
-        getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange;
-        /** Releases all resources held by this script snapshot */
-        dispose?(): void;
-    }
-    module ScriptSnapshot {
-        function fromString(text: string): IScriptSnapshot;
-    }
-    interface PreProcessedFileInfo {
-        referencedFiles: FileReference[];
-        importedFiles: FileReference[];
-        isLibFile: boolean;
-    }
-    interface HostCancellationToken {
-        isCancellationRequested(): boolean;
-    }
-    interface LanguageServiceHost {
-        getCompilationSettings(): CompilerOptions;
-        getNewLine?(): string;
-        getProjectVersion?(): string;
-        getScriptFileNames(): string[];
-        getScriptVersion(fileName: string): string;
-        getScriptSnapshot(fileName: string): IScriptSnapshot;
-        getLocalizedDiagnosticMessages?(): any;
-        getCancellationToken?(): HostCancellationToken;
-        getCurrentDirectory(): string;
-        getDefaultLibFileName(options: CompilerOptions): string;
-        log?(s: string): void;
-        trace?(s: string): void;
-        error?(s: string): void;
-        useCaseSensitiveFileNames?(): boolean;
-    }
-    interface LanguageService {
-        cleanupSemanticCache(): void;
-        getSyntacticDiagnostics(fileName: string): Diagnostic[];
-        getSemanticDiagnostics(fileName: string): Diagnostic[];
-        getCompilerOptionsDiagnostics(): Diagnostic[];
-        /**
-         * @deprecated Use getEncodedSyntacticClassifications instead.
-         */
-        getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
-        /**
-         * @deprecated Use getEncodedSemanticClassifications instead.
-         */
-        getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
-        getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
-        getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
-        getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
-        getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails;
-        getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
-        getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan;
-        getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan;
-        getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems;
-        getRenameInfo(fileName: string, position: number): RenameInfo;
-        findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
-        getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
-        getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
-        getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
-        findReferences(fileName: string, position: number): ReferencedSymbol[];
-        getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
-        /** @deprecated */
-        getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
-        getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
-        getNavigationBarItems(fileName: string): NavigationBarItem[];
-        getOutliningSpans(fileName: string): OutliningSpan[];
-        getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
-        getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[];
-        getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number;
-        getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[];
-        getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[];
-        getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[];
-        getEmitOutput(fileName: string): EmitOutput;
-        getProgram(): Program;
-        getSourceFile(fileName: string): SourceFile;
-        dispose(): void;
-    }
-    interface Classifications {
-        spans: number[];
-        endOfLineState: EndOfLineState;
-    }
-    interface ClassifiedSpan {
-        textSpan: TextSpan;
-        classificationType: string;
-    }
-    interface NavigationBarItem {
-        text: string;
-        kind: string;
-        kindModifiers: string;
-        spans: TextSpan[];
-        childItems: NavigationBarItem[];
-        indent: number;
-        bolded: boolean;
-        grayed: boolean;
-    }
-    interface TodoCommentDescriptor {
-        text: string;
-        priority: number;
-    }
-    interface TodoComment {
-        descriptor: TodoCommentDescriptor;
-        message: string;
-        position: number;
-    }
-    class TextChange {
-        span: TextSpan;
-        newText: string;
-    }
-    interface RenameLocation {
-        textSpan: TextSpan;
-        fileName: string;
-    }
-    interface ReferenceEntry {
-        textSpan: TextSpan;
-        fileName: string;
-        isWriteAccess: boolean;
-    }
-    interface DocumentHighlights {
-        fileName: string;
-        highlightSpans: HighlightSpan[];
-    }
-    module HighlightSpanKind {
-        const none: string;
-        const definition: string;
-        const reference: string;
-        const writtenReference: string;
-    }
-    interface HighlightSpan {
-        fileName?: string;
-        textSpan: TextSpan;
-        kind: string;
-    }
-    interface NavigateToItem {
-        name: string;
-        kind: string;
-        kindModifiers: string;
-        matchKind: string;
-        isCaseSensitive: boolean;
-        fileName: string;
-        textSpan: TextSpan;
-        containerName: string;
-        containerKind: string;
-    }
-    interface EditorOptions {
-        IndentSize: number;
-        TabSize: number;
-        NewLineCharacter: string;
-        ConvertTabsToSpaces: boolean;
-    }
-    interface FormatCodeOptions extends EditorOptions {
-        InsertSpaceAfterCommaDelimiter: boolean;
-        InsertSpaceAfterSemicolonInForStatements: boolean;
-        InsertSpaceBeforeAndAfterBinaryOperators: boolean;
-        InsertSpaceAfterKeywordsInControlFlowStatements: boolean;
-        InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
-        InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
-        PlaceOpenBraceOnNewLineForFunctions: boolean;
-        PlaceOpenBraceOnNewLineForControlBlocks: boolean;
-        [s: string]: boolean | number | string;
-    }
-    interface DefinitionInfo {
-        fileName: string;
-        textSpan: TextSpan;
-        kind: string;
-        name: string;
-        containerKind: string;
-        containerName: string;
-    }
-    interface ReferencedSymbol {
-        definition: DefinitionInfo;
-        references: ReferenceEntry[];
-    }
-    enum SymbolDisplayPartKind {
-        aliasName = 0,
-        className = 1,
-        enumName = 2,
-        fieldName = 3,
-        interfaceName = 4,
-        keyword = 5,
-        lineBreak = 6,
-        numericLiteral = 7,
-        stringLiteral = 8,
-        localName = 9,
-        methodName = 10,
-        moduleName = 11,
-        operator = 12,
-        parameterName = 13,
-        propertyName = 14,
-        punctuation = 15,
-        space = 16,
-        text = 17,
-        typeParameterName = 18,
-        enumMemberName = 19,
-        functionName = 20,
-        regularExpressionLiteral = 21,
-    }
-    interface SymbolDisplayPart {
-        text: string;
-        kind: string;
-    }
-    interface QuickInfo {
-        kind: string;
-        kindModifiers: string;
-        textSpan: TextSpan;
-        displayParts: SymbolDisplayPart[];
-        documentation: SymbolDisplayPart[];
-    }
-    interface RenameInfo {
-        canRename: boolean;
-        localizedErrorMessage: string;
-        displayName: string;
-        fullDisplayName: string;
-        kind: string;
-        kindModifiers: string;
-        triggerSpan: TextSpan;
-    }
-    interface SignatureHelpParameter {
-        name: string;
-        documentation: SymbolDisplayPart[];
-        displayParts: SymbolDisplayPart[];
-        isOptional: boolean;
-    }
-    /**
-     * Represents a single signature to show in signature help.
-     * The id is used for subsequent calls into the language service to ask questions about the
-     * signature help item in the context of any documents that have been updated.  i.e. after
-     * an edit has happened, while signature help is still active, the host can ask important
-     * questions like 'what parameter is the user currently contained within?'.
-     */
-    interface SignatureHelpItem {
-        isVariadic: boolean;
-        prefixDisplayParts: SymbolDisplayPart[];
-        suffixDisplayParts: SymbolDisplayPart[];
-        separatorDisplayParts: SymbolDisplayPart[];
-        parameters: SignatureHelpParameter[];
-        documentation: SymbolDisplayPart[];
-    }
-    /**
-     * Represents a set of signature help items, and the preferred item that should be selected.
-     */
-    interface SignatureHelpItems {
-        items: SignatureHelpItem[];
-        applicableSpan: TextSpan;
-        selectedItemIndex: number;
-        argumentIndex: number;
-        argumentCount: number;
-    }
-    interface CompletionInfo {
-        isMemberCompletion: boolean;
-        isNewIdentifierLocation: boolean;
-        entries: CompletionEntry[];
-    }
-    interface CompletionEntry {
-        name: string;
-        kind: string;
-        kindModifiers: string;
-        sortText: string;
-    }
-    interface CompletionEntryDetails {
-        name: string;
-        kind: string;
-        kindModifiers: string;
-        displayParts: SymbolDisplayPart[];
-        documentation: SymbolDisplayPart[];
-    }
-    interface OutliningSpan {
-        /** The span of the document to actually collapse. */
-        textSpan: TextSpan;
-        /** The span of the document to display when the user hovers over the collapsed span. */
-        hintSpan: TextSpan;
-        /** The text to display in the editor for the collapsed region. */
-        bannerText: string;
-        /**
-          * Whether or not this region should be automatically collapsed when
-          * the 'Collapse to Definitions' command is invoked.
-          */
-        autoCollapse: boolean;
-    }
-    interface EmitOutput {
-        outputFiles: OutputFile[];
-        emitSkipped: boolean;
-    }
-    const enum OutputFileType {
-        JavaScript = 0,
-        SourceMap = 1,
-        Declaration = 2,
-    }
-    interface OutputFile {
-        name: string;
-        writeByteOrderMark: boolean;
-        text: string;
-    }
-    const enum EndOfLineState {
-        None = 0,
-        InMultiLineCommentTrivia = 1,
-        InSingleQuoteStringLiteral = 2,
-        InDoubleQuoteStringLiteral = 3,
-        InTemplateHeadOrNoSubstitutionTemplate = 4,
-        InTemplateMiddleOrTail = 5,
-        InTemplateSubstitutionPosition = 6,
-    }
-    enum TokenClass {
-        Punctuation = 0,
-        Keyword = 1,
-        Operator = 2,
-        Comment = 3,
-        Whitespace = 4,
-        Identifier = 5,
-        NumberLiteral = 6,
-        StringLiteral = 7,
-        RegExpLiteral = 8,
-    }
-    interface ClassificationResult {
-        finalLexState: EndOfLineState;
-        entries: ClassificationInfo[];
-    }
-    interface ClassificationInfo {
-        length: number;
-        classification: TokenClass;
-    }
-    interface Classifier {
-        /**
-         * Gives lexical classifications of tokens on a line without any syntactic context.
-         * For instance, a token consisting of the text 'string' can be either an identifier
-         * named 'string' or the keyword 'string', however, because this classifier is not aware,
-         * it relies on certain heuristics to give acceptable results. For classifications where
-         * speed trumps accuracy, this function is preferable; however, for true accuracy, the
-         * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the
-         * lexical, syntactic, and semantic classifiers may issue the best user experience.
-         *
-         * @param text                      The text of a line to classify.
-         * @param lexState                  The state of the lexical classifier at the end of the previous line.
-         * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier.
-         *                                  If there is no syntactic classifier (syntacticClassifierAbsent=true),
-         *                                  certain heuristics may be used in its place; however, if there is a
-         *                                  syntactic classifier (syntacticClassifierAbsent=false), certain
-         *                                  classifications which may be incorrectly categorized will be given
-         *                                  back as Identifiers in order to allow the syntactic classifier to
-         *                                  subsume the classification.
-         * @deprecated Use getLexicalClassifications instead.
-         */
-        getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
-        getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
-    }
-    /**
-      * The document registry represents a store of SourceFile objects that can be shared between
-      * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST)
-      * of files in the context.
-      * SourceFile objects account for most of the memory usage by the language service. Sharing
-      * the same DocumentRegistry instance between different instances of LanguageService allow
-      * for more efficient memory utilization since all projects will share at least the library
-      * file (lib.d.ts).
-      *
-      * A more advanced use of the document registry is to serialize sourceFile objects to disk
-      * and re-hydrate them when needed.
-      *
-      * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it
-      * to all subsequent createLanguageService calls.
-      */
-    interface DocumentRegistry {
-        /**
-          * Request a stored SourceFile with a given fileName and compilationSettings.
-          * The first call to acquire will call createLanguageServiceSourceFile to generate
-          * the SourceFile if was not found in the registry.
-          *
-          * @param fileName The name of the file requested
-          * @param compilationSettings Some compilation settings like target affects the
-          * shape of a the resulting SourceFile. This allows the DocumentRegistry to store
-          * multiple copies of the same file for different compilation settings.
-          * @parm scriptSnapshot Text of the file. Only used if the file was not found
-          * in the registry and a new one was created.
-          * @parm version Current version of the file. Only used if the file was not found
-          * in the registry and a new one was created.
-          */
-        acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
-        /**
-          * Request an updated version of an already existing SourceFile with a given fileName
-          * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
-          * to get an updated SourceFile.
-          *
-          * @param fileName The name of the file requested
-          * @param compilationSettings Some compilation settings like target affects the
-          * shape of a the resulting SourceFile. This allows the DocumentRegistry to store
-          * multiple copies of the same file for different compilation settings.
-          * @param scriptSnapshot Text of the file.
-          * @param version Current version of the file.
-          */
-        updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile;
-        /**
-          * Informs the DocumentRegistry that a file is not needed any longer.
-          *
-          * Note: It is not allowed to call release on a SourceFile that was not acquired from
-          * this registry originally.
-          *
-          * @param fileName The name of the file to be released
-          * @param compilationSettings The compilation settings used to acquire the file
-          */
-        releaseDocument(fileName: string, compilationSettings: CompilerOptions): void;
-        reportStats(): string;
-    }
-    module ScriptElementKind {
-        const unknown: string;
-        const warning: string;
-        const keyword: string;
-        const scriptElement: string;
-        const moduleElement: string;
-        const classElement: string;
-        const localClassElement: string;
-        const interfaceElement: string;
-        const typeElement: string;
-        const enumElement: string;
-        const variableElement: string;
-        const localVariableElement: string;
-        const functionElement: string;
-        const localFunctionElement: string;
-        const memberFunctionElement: string;
-        const memberGetAccessorElement: string;
-        const memberSetAccessorElement: string;
-        const memberVariableElement: string;
-        const constructorImplementationElement: string;
-        const callSignatureElement: string;
-        const indexSignatureElement: string;
-        const constructSignatureElement: string;
-        const parameterElement: string;
-        const typeParameterElement: string;
-        const primitiveType: string;
-        const label: string;
-        const alias: string;
-        const constElement: string;
-        const letElement: string;
-    }
-    module ScriptElementKindModifier {
-        const none: string;
-        const publicMemberModifier: string;
-        const privateMemberModifier: string;
-        const protectedMemberModifier: string;
-        const exportedModifier: string;
-        const ambientModifier: string;
-        const staticModifier: string;
-        const abstractModifier: string;
-    }
-    class ClassificationTypeNames {
-        static comment: string;
-        static identifier: string;
-        static keyword: string;
-        static numericLiteral: string;
-        static operator: string;
-        static stringLiteral: string;
-        static whiteSpace: string;
-        static text: string;
-        static punctuation: string;
-        static className: string;
-        static enumName: string;
-        static interfaceName: string;
-        static moduleName: string;
-        static typeParameterName: string;
-        static typeAliasName: string;
-        static parameterName: string;
-        static docCommentTagName: string;
-    }
-    const enum ClassificationType {
-        comment = 1,
-        identifier = 2,
-        keyword = 3,
-        numericLiteral = 4,
-        operator = 5,
-        stringLiteral = 6,
-        regularExpressionLiteral = 7,
-        whiteSpace = 8,
-        text = 9,
-        punctuation = 10,
-        className = 11,
-        enumName = 12,
-        interfaceName = 13,
-        moduleName = 14,
-        typeParameterName = 15,
-        typeAliasName = 16,
-        parameterName = 17,
-        docCommentTagName = 18,
-    }
-    interface DisplayPartsSymbolWriter extends SymbolWriter {
-        displayParts(): SymbolDisplayPart[];
-    }
-    function displayPartsToString(displayParts: SymbolDisplayPart[]): string;
-    function getDefaultCompilerOptions(): CompilerOptions;
-    interface TranspileOptions {
-        compilerOptions?: CompilerOptions;
-        fileName?: string;
-        reportDiagnostics?: boolean;
-        moduleName?: string;
-    }
-    interface TranspileOutput {
-        outputText: string;
-        diagnostics?: Diagnostic[];
-        sourceMapText?: string;
-    }
-    function transpileModule(input: string, transpileOptions?: TranspileOptions): TranspileOutput;
-    function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
-    function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
-    let disableIncrementalParsing: boolean;
-    function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
-    function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry;
-    function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
-    function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
-    function createClassifier(): Classifier;
-    /**
-      * Get the path of the default library files (lib.d.ts) as distributed with the typescript
-      * node package.
-      * The functionality is not supported if the ts module is consumed outside of a node module.
-      */
-    function getDefaultLibFilePath(options: CompilerOptions): string;
-}

From a0377060399a2e605c3562add3360d0bcf7c3565 Mon Sep 17 00:00:00 2001
From: Alexandru Ciuca <alexandru.ciuca@1and1.ro>
Date: Fri, 9 Oct 2015 13:23:39 +0300
Subject: [PATCH 2/8] Fix order of npm install calls for travis build

---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 028e18fc5..22b2d31de 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,8 +3,8 @@ node_js:
   - "0.12"
 sudo: false
 install:
-  - npm install $TYPESCRIPT
   - npm install
+  - npm install $TYPESCRIPT
 env:
   - TYPESCRIPT=typescript@1.5.3
   - TYPESCRIPT=typescript

From 0d5426954cc56d7950712216de8155cae271c4de Mon Sep 17 00:00:00 2001
From: Alexandru Ciuca <alexandru.ciuca@1and1.ro>
Date: Fri, 9 Oct 2015 13:56:52 +0300
Subject: [PATCH 3/8] Fix signature of readConfigFile

---
 index.ts | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/index.ts b/index.ts
index 3c8c4b9e6..5a97ab94b 100644
--- a/index.ts
+++ b/index.ts
@@ -68,6 +68,28 @@ interface ResolvedModule {
     isExternalLibraryImport?: boolean;
 }
 
+// TODO: figure out how to type individual versions of typescript without hardcoding
+// each d.ts file
+
+// typescript@next specific definitions
+declare namespace TSNext {
+    interface readConfigFile {
+        (fileName: string, readFile: (path: string) => string): {
+            config?: any;
+            error?: typescript.Diagnostic;
+        };
+    }
+}
+// typescript@latest specific definitions
+declare namespace TSLatest {
+    interface readConfigFile {
+        (fileName: string): {
+            config?: any;
+            error?: typescript.Diagnostic;
+        };
+    }
+}
+
 var instances = <TSInstances>{};
 var webpackInstances = [];
 const scriptRegex = /\.tsx?$/i;
@@ -189,7 +211,11 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
         if (compilerCompatible) log(`${motd} and ${configFilePath}`.green)
         else log(`ts-loader: Using config file at ${configFilePath}`.green)
 
-        configFile = compiler.readConfigFile(configFilePath);
+        if (semver.gte(compiler.version, '1.7.0-0')) {
+            configFile = (<TSNext.readConfigFile>compiler.readConfigFile)(configFilePath, compiler.sys.readFile);
+        } else {
+            configFile = (<TSLatest.readConfigFile>compiler.readConfigFile)(configFilePath);
+        }
 
         if (configFile.error) {
             var configFileError = formatErrors([configFile.error], instance, {file: configFilePath })[0];

From ebc6cbd6db34e993a0d7c253ea1685b1ce28c994 Mon Sep 17 00:00:00 2001
From: Alexandru Ciuca <gmail.rulz@yahoo.com>
Date: Sat, 17 Oct 2015 11:38:34 +0300
Subject: [PATCH 4/8] Fixed merge inconsistencies

---
 package.json | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package.json b/package.json
index e87a2a375..8ff6dca97 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "description": "TypeScript loader for webpack",
   "main": "index.js",
   "scripts": {
-    "build": "tsc index.ts --module commonjs --moduleResolution classic",
+    "build": "tsc",
     "test": "mocha --reporter spec test/run.js",
     "prepublish": "npm run build"
   },
@@ -42,7 +42,7 @@
     "mkdirp": "^0.5.1",
     "mocha": "^2.1.0",
     "rimraf": "^2.4.2",
-    "webpack": "^1.11.0"
-    "typescript": "^1.6.2",
+    "webpack": "^1.11.0",
+    "typescript": "^1.6.2"
   }
 }

From 3b81e21dc82eae37691710ddbd76180d4644e7dc Mon Sep 17 00:00:00 2001
From: Alexandru Ciuca <gmail.rulz@yahoo.com>
Date: Sat, 17 Oct 2015 15:25:49 +0300
Subject: [PATCH 5/8] Fixed typescript@next signature

---
 index.ts | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/index.ts b/index.ts
index 5a97ab94b..f1b09f5be 100644
--- a/index.ts
+++ b/index.ts
@@ -72,22 +72,20 @@ interface ResolvedModule {
 // each d.ts file
 
 // typescript@next specific definitions
-declare namespace TSNext {
-    interface readConfigFile {
-        (fileName: string, readFile: (path: string) => string): {
-            config?: any;
-            error?: typescript.Diagnostic;
-        };
-    }
+interface TSNextCompiler {
+    readConfigFile(fileName: string, readFile: (path: string) => string): {
+        config?: any;
+        error?: typescript.Diagnostic;
+    };
+    parseJsonConfigFileContent(json: any, host: typescript.ParseConfigHost, basePath: string): typescript.ParsedCommandLine;
 }
 // typescript@latest specific definitions
-declare namespace TSLatest {
-    interface readConfigFile {
-        (fileName: string): {
-            config?: any;
-            error?: typescript.Diagnostic;
-        };
-    }
+interface TSLatestCompiler {
+    readConfigFile(fileName: string): {
+        config?: any;
+        error?: typescript.Diagnostic;
+    };
+    parseConfigFile(json: any, host: typescript.ParseConfigHost, basePath: string): typescript.ParsedCommandLine;
 }
 
 var instances = <TSInstances>{};
@@ -212,9 +210,9 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
         else log(`ts-loader: Using config file at ${configFilePath}`.green)
 
         if (semver.gte(compiler.version, '1.7.0-0')) {
-            configFile = (<TSNext.readConfigFile>compiler.readConfigFile)(configFilePath, compiler.sys.readFile);
+            configFile = (<TSNextCompiler><any>compiler).readConfigFile(configFilePath, compiler.sys.readFile);
         } else {
-            configFile = (<TSLatest.readConfigFile>compiler.readConfigFile)(configFilePath);
+            configFile = (<TSLatestCompiler><any>compiler).readConfigFile(configFilePath);
         }
 
         if (configFile.error) {
@@ -242,7 +240,12 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
         configFile.config.compilerOptions.isolatedModules = true;
     }
 
-    var configParseResult = compiler.parseConfigFile(configFile.config, compiler.sys, path.dirname(configFilePath));
+    var configParseResult;
+    if (semver.gte(compiler.version, '1.8.0-0')) {
+        configParseResult = (<TSNextCompiler><any>compiler).parseJsonConfigFileContent(configFile.config, compiler.sys, path.dirname(configFilePath));
+    } else {
+         configParseResult = (<TSLatestCompiler><any>compiler).parseConfigFile(configFile.config, compiler.sys, path.dirname(configFilePath));
+    }
 
     if (configParseResult.errors.length) {
         pushArray(

From 39d4331b1b362fab2a138c3107e36215c2e01334 Mon Sep 17 00:00:00 2001
From: Alexandru Ciuca <gmail.rulz@yahoo.com>
Date: Sat, 17 Oct 2015 15:32:31 +0300
Subject: [PATCH 6/8] Removed comment

---
 index.ts | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/index.ts b/index.ts
index f1b09f5be..f02d3782d 100644
--- a/index.ts
+++ b/index.ts
@@ -68,9 +68,6 @@ interface ResolvedModule {
     isExternalLibraryImport?: boolean;
 }
 
-// TODO: figure out how to type individual versions of typescript without hardcoding
-// each d.ts file
-
 // typescript@next specific definitions
 interface TSNextCompiler {
     readConfigFile(fileName: string, readFile: (path: string) => string): {

From aa732858c30aa2da57273c8f8d919faaadab3373 Mon Sep 17 00:00:00 2001
From: Alexandru Ciuca <gmail.rulz@yahoo.com>
Date: Sat, 17 Oct 2015 18:38:00 +0300
Subject: [PATCH 7/8] Removed unused else branch

---
 index.ts | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/index.ts b/index.ts
index f02d3782d..abf55f3fe 100644
--- a/index.ts
+++ b/index.ts
@@ -272,9 +272,8 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
         // quick return for transpiling
         // we do need to check for any issues with TS options though
         var program = compiler.createProgram([], compilerOptions),
-            diagnostics = program.getOptionsDiagnostics
-                ? program.getOptionsDiagnostics()
-                : languageService.getCompilerOptionsDiagnostics();
+            diagnostics = program.getOptionsDiagnostics();
+
         pushArray(
             loader._module.errors,
             formatErrors(diagnostics, instance, {file: configFilePath || 'tsconfig.json'}));

From 68563e877156ef266cb7d3f24a8b63372df2b129 Mon Sep 17 00:00:00 2001
From: Alexandru Ciuca <alexandru.ciuca@1and1.ro>
Date: Mon, 19 Oct 2015 18:20:10 +0300
Subject: [PATCH 8/8] Created single interface for compiler and replaced
 version checking with feature checking

---
 index.ts | 40 +++++++++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 15 deletions(-)

diff --git a/index.ts b/index.ts
index abf55f3fe..d324a4d68 100644
--- a/index.ts
+++ b/index.ts
@@ -68,21 +68,21 @@ interface ResolvedModule {
     isExternalLibraryImport?: boolean;
 }
 
-// typescript@next specific definitions
-interface TSNextCompiler {
+interface TSCompatibleCompiler {
+    // typescript@next 1.7+
     readConfigFile(fileName: string, readFile: (path: string) => string): {
         config?: any;
         error?: typescript.Diagnostic;
     };
-    parseJsonConfigFileContent(json: any, host: typescript.ParseConfigHost, basePath: string): typescript.ParsedCommandLine;
-}
-// typescript@latest specific definitions
-interface TSLatestCompiler {
+    // typescript@latest 1.6.2
     readConfigFile(fileName: string): {
         config?: any;
         error?: typescript.Diagnostic;
     };
-    parseConfigFile(json: any, host: typescript.ParseConfigHost, basePath: string): typescript.ParsedCommandLine;
+    // typescript@next 1.8+
+    parseJsonConfigFileContent?(json: any, host: typescript.ParseConfigHost, basePath: string): typescript.ParsedCommandLine;
+    // typescript@latest 1.6.2
+    parseConfigFile?(json: any, host: typescript.ParseConfigHost, basePath: string): typescript.ParsedCommandLine;
 }
 
 var instances = <TSInstances>{};
@@ -206,11 +206,12 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
         if (compilerCompatible) log(`${motd} and ${configFilePath}`.green)
         else log(`ts-loader: Using config file at ${configFilePath}`.green)
 
-        if (semver.gte(compiler.version, '1.7.0-0')) {
-            configFile = (<TSNextCompiler><any>compiler).readConfigFile(configFilePath, compiler.sys.readFile);
-        } else {
-            configFile = (<TSLatestCompiler><any>compiler).readConfigFile(configFilePath);
-        }
+        // HACK: relies on the fact that passing an extra argument won't break
+        // the old API that has a single parameter
+        configFile = (<TSCompatibleCompiler><any>compiler).readConfigFile(
+            configFilePath,
+            compiler.sys.readFile
+        );
 
         if (configFile.error) {
             var configFileError = formatErrors([configFile.error], instance, {file: configFilePath })[0];
@@ -238,10 +239,19 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
     }
 
     var configParseResult;
-    if (semver.gte(compiler.version, '1.8.0-0')) {
-        configParseResult = (<TSNextCompiler><any>compiler).parseJsonConfigFileContent(configFile.config, compiler.sys, path.dirname(configFilePath));
+    if (typeof (<any>compiler).parseJsonConfigFileContent === 'function') {
+        // parseConfigFile was renamed in nightly 1.8
+        configParseResult = (<TSCompatibleCompiler><any>compiler).parseJsonConfigFileContent(
+            configFile.config,
+            compiler.sys,
+            path.dirname(configFilePath)
+        );
     } else {
-         configParseResult = (<TSLatestCompiler><any>compiler).parseConfigFile(configFile.config, compiler.sys, path.dirname(configFilePath));
+        configParseResult = (<TSCompatibleCompiler><any>compiler).parseConfigFile(
+            configFile.config,
+            compiler.sys,
+            path.dirname(configFilePath)
+        );
     }
 
     if (configParseResult.errors.length) {