diff --git a/Jakefile.js b/Jakefile.js index da18b0a638e..58c65952e8f 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -139,11 +139,6 @@ compileOutputConfigFile('src/typescriptServices/tsconfig.json', [], [copyright], // Created by appending 'export = ts;' at the end of the standalone file to turn it into an external module var nodeDefinitionsFileContents = definitionFileContents + "\nexport = ts;"; fs.writeFileSync(nodeDefinitionsFile, nodeDefinitionsFileContents); - - // Node package definition file to be distributed without the package. Created by replacing - // 'ts' namespace with '"typescript"' as a module. - var nodeStandaloneDefinitionsFileContents = definitionFileContents.replace(/declare (namespace|module) ts/g, 'declare module "typescript"'); - fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents); }); compileOutputConfigFile('src/core/tsconfig.json'); compileOutputConfigFile('src/harness/tsconfig.json'); @@ -584,7 +579,6 @@ var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js"); var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts"); var nodePackageFile = path.join(builtLocalDirectory, "typescript.js"); var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts"); -var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_standalone.d.ts"); var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js"); var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts"); diff --git a/tests/baselines/reference/APISample_Watch.errors.txt b/tests/baselines/reference/APISample_Watch.errors.txt deleted file mode 100644 index d4f7638416b..00000000000 --- a/tests/baselines/reference/APISample_Watch.errors.txt +++ /dev/null @@ -1,208 +0,0 @@ -typescript_standalone.d.ts(21,28): error TS1005: ';' expected. -typescript_standalone.d.ts(21,41): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,28): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,42): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,46): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,38): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,57): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,41): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,48): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,47): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,47): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,44): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,35): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,45): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,56): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,36): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,41): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,38): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,71): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,48): error TS1005: ';' expected. - - -==== tests/cases/compiler/APISample_Watch.ts (0 errors) ==== - /* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md#writing-an-incremental-program-watcher - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - - declare var process: any; - declare var console: any; - declare var os: any; - - import ts = require("typescript"); - - const formatHost: ts.FormatDiagnosticsHost = { - getCanonicalFileName: path => path, - getCurrentDirectory: ts.sys.getCurrentDirectory, - getNewLine: () => ts.sys.newLine, - } - - function watchMain() { - const configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json"); - if (!configPath) { - throw new Error("Could not find a valid 'tsconfig.json'."); - } - - // TypeScript can use several different program creation "strategies": - // * ts.createEmitAndSemanticDiagnosticsBuilderProgram, - // * ts.createSemanticDiagnosticsBuilderProgram - // * ts.createAbstractBuilder - // The first two produce "builder programs". These use an incremental strategy to only re-check and emit files whose - // contents may have changed, or whose dependencies may have changes which may impact change the result of prior type-check and emit. - // The last uses an ordinary program which does a full type check after every change. - // Between `createEmitAndSemanticDiagnosticsBuilderProgram` and `createSemanticDiagnosticsBuilderProgram`, the only difference is emit. - // For pure type-checking scenarios, or when another tool/process handles emit, using `createSemanticDiagnosticsBuilderProgram` may be more desirable. - - // Note that there is another overload for `createWatchCompilerHost` that takes a set of root files. - const host = ts.createWatchCompilerHost(configPath, {}, ts.sys, - ts.createSemanticDiagnosticsBuilderProgram, - reportDiagnostic, - reportWatchStatusChanged, - ); - - // You can technically override any given hook on the host, though you probably don't need to. - // Note that we're assuming `origCreateProgram` and `origPostProgramCreate` doesn't use `this` at all. - const origCreateProgram = host.createProgram; - host.createProgram = (rootNames: ReadonlyArray, options, host, oldProgram) => { - console.log("** We're about to create the program! **"); - return origCreateProgram(rootNames, options, host, oldProgram); - } - const origPostProgramCreate = host.afterProgramCreate; - - host.afterProgramCreate = program => { - console.log("** We finished making the program! **"); - origPostProgramCreate!(program); - }; - - // `createWatchProgram` creates an initial program, watches files, and updates the program over time. - ts.createWatchProgram(host); - } - - function reportDiagnostic(diagnostic: ts.Diagnostic) { - console.error("Error", diagnostic.code, ":", - ts.flattenDiagnosticMessageText(diagnostic.messageText, formatHost.getNewLine()) - ); - } - - /** - * Prints a diagnostic every time the watch status changes. - * This is mainly for messages like "Starting compilation" or "Compilation completed". - */ - function reportWatchStatusChanged(diagnostic: ts.Diagnostic) { - console.info(ts.formatDiagnostic(diagnostic, formatHost)); - } - - watchMain(); - \ No newline at end of file diff --git a/tests/baselines/reference/APISample_Watch.js b/tests/baselines/reference/APISample_Watch.js index 5e3a67e827d..e675f2ec4eb 100644 --- a/tests/baselines/reference/APISample_Watch.js +++ b/tests/baselines/reference/APISample_Watch.js @@ -1,7 +1,14 @@ +//// [tests/cases/compiler/APISample_Watch.ts] //// + +//// [index.d.ts] +declare module "typescript" { + export = ts; +} + //// [APISample_Watch.ts] /* * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md#writing-an-incremental-program-watcher + * at: https://github.com/Microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md#writing-an-incremental-program-watcher * Please log a "breaking change" issue for any API breaking change affecting this issue */ @@ -79,7 +86,7 @@ watchMain(); "use strict"; /* * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md#writing-an-incremental-program-watcher + * at: https://github.com/Microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md#writing-an-incremental-program-watcher * Please log a "breaking change" issue for any API breaking change affecting this issue */ exports.__esModule = true; diff --git a/tests/baselines/reference/APISample_WatchWithDefaults.errors.txt b/tests/baselines/reference/APISample_WatchWithDefaults.errors.txt deleted file mode 100644 index 52755e8fe21..00000000000 --- a/tests/baselines/reference/APISample_WatchWithDefaults.errors.txt +++ /dev/null @@ -1,181 +0,0 @@ -typescript_standalone.d.ts(21,28): error TS1005: ';' expected. -typescript_standalone.d.ts(21,41): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,28): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,42): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,46): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,38): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,57): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,41): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,48): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,47): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,47): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,44): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,35): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,45): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,56): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,36): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,41): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,38): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,71): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,48): error TS1005: ';' expected. - - -==== tests/cases/compiler/APISample_WatchWithDefaults.ts (0 errors) ==== - /* - * Note: This test is a public API sample. This uses default sys interface without having to pass anything - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - - declare var console: any; - - import ts = require("typescript"); - - function watchMain() { - const configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json"); - if (!configPath) { - throw new Error("Could not find a valid 'tsconfig.json'."); - } - - // TypeScript can use several different program creation "strategies": - // * ts.createEmitAndSemanticDiagnosticsBuilderProgram, - // * ts.createSemanticDiagnosticsBuilderProgram - // * ts.createAbstractBuilder - // The first two produce "builder programs". These use an incremental strategy to only re-check and emit files whose - // contents may have changed, or whose dependencies may have changes which may impact change the result of prior type-check and emit. - // The last uses an ordinary program which does a full type check after every change. - // Between `createEmitAndSemanticDiagnosticsBuilderProgram` and `createSemanticDiagnosticsBuilderProgram`, the only difference is emit. - // For pure type-checking scenarios, or when another tool/process handles emit, using `createSemanticDiagnosticsBuilderProgram` may be more desirable. - - // Note that there is another overload for `createWatchCompilerHost` that takes a set of root files. - const host = ts.createWatchCompilerHost(configPath, {}, ts.sys); - - // You can technically override any given hook on the host, though you probably don't need to. - // Note that we're assuming `origCreateProgram` and `origPostProgramCreate` doesn't use `this` at all. - const origCreateProgram = host.createProgram; - host.createProgram = (rootNames, options, host, oldProgram) => { - console.log("** We're about to create the program! **"); - return origCreateProgram(rootNames, options, host, oldProgram); - } - const origPostProgramCreate = host.afterProgramCreate; - - host.afterProgramCreate = program => { - console.log("** We finished making the program! **"); - origPostProgramCreate!(program); - }; - - // `createWatchProgram` creates an initial program, watches files, and updates the program over time. - ts.createWatchProgram(host); - } - - watchMain(); - \ No newline at end of file diff --git a/tests/baselines/reference/APISample_WatchWithDefaults.js b/tests/baselines/reference/APISample_WatchWithDefaults.js index 493bef221f6..63bfa4965e5 100644 --- a/tests/baselines/reference/APISample_WatchWithDefaults.js +++ b/tests/baselines/reference/APISample_WatchWithDefaults.js @@ -1,3 +1,10 @@ +//// [tests/cases/compiler/APISample_WatchWithDefaults.ts] //// + +//// [index.d.ts] +declare module "typescript" { + export = ts; +} + //// [APISample_WatchWithDefaults.ts] /* * Note: This test is a public API sample. This uses default sys interface without having to pass anything diff --git a/tests/baselines/reference/APISample_WatchWithOwnWatchHost.errors.txt b/tests/baselines/reference/APISample_WatchWithOwnWatchHost.errors.txt deleted file mode 100644 index 1275cf337b0..00000000000 --- a/tests/baselines/reference/APISample_WatchWithOwnWatchHost.errors.txt +++ /dev/null @@ -1,188 +0,0 @@ -typescript_standalone.d.ts(21,28): error TS1005: ';' expected. -typescript_standalone.d.ts(21,41): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,28): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,42): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,46): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,38): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,57): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,41): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,48): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,47): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,47): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,44): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,35): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,45): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,56): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,36): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,41): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,38): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,71): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,48): error TS1005: ';' expected. - - -==== tests/cases/compiler/APISample_WatchWithOwnWatchHost.ts (0 errors) ==== - /* - * Note: This test is a public API sample. This sample verifies creating abstract builder to watch list of root files - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - - declare var console: any; - - import ts = require("typescript"); - - function watchMain() { - // get list of files and compiler options somehow - const files: string[] = []; - const options: ts.CompilerOptions = {}; - - const host: ts.WatchCompilerHostOfFilesAndCompilerOptions = { - rootFiles: files, - options, - - useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames, - getNewLine: () => ts.sys.newLine, - getCurrentDirectory: ts.sys.getCurrentDirectory, - getDefaultLibFileName: options => ts.getDefaultLibFilePath(options), - - fileExists: ts.sys.fileExists, - readFile: ts.sys.readFile, - directoryExists: ts.sys.directoryExists, - getDirectories: ts.sys.getDirectories, - readDirectory: ts.sys.readDirectory, - realpath: ts.sys.realpath, - - watchFile: ts.sys.watchFile!, - watchDirectory: ts.sys.watchDirectory!, - createProgram: ts.createAbstractBuilder - }; - - // You can technically override any given hook on the host, though you probably don't need to. - // Note that we're assuming `origCreateProgram` and `origPostProgramCreate` doesn't use `this` at all. - const origCreateProgram = host.createProgram; - host.createProgram = (rootNames, options, host, oldProgram) => { - console.log("** We're about to create the program! **"); - return origCreateProgram(rootNames, options, host, oldProgram); - } - const origPostProgramCreate = host.afterProgramCreate; - - host.afterProgramCreate = program => { - console.log("** We finished making the program! **"); - origPostProgramCreate!(program); - }; - - // `createWatchProgram` creates an initial program, watches files, and updates the program over time. - ts.createWatchProgram(host); - } - - watchMain(); - \ No newline at end of file diff --git a/tests/baselines/reference/APISample_WatchWithOwnWatchHost.js b/tests/baselines/reference/APISample_WatchWithOwnWatchHost.js index 95f6df3fb51..75444a614f9 100644 --- a/tests/baselines/reference/APISample_WatchWithOwnWatchHost.js +++ b/tests/baselines/reference/APISample_WatchWithOwnWatchHost.js @@ -1,6 +1,13 @@ +//// [tests/cases/compiler/APISample_WatchWithOwnWatchHost.ts] //// + +//// [index.d.ts] +declare module "typescript" { + export = ts; +} + //// [APISample_WatchWithOwnWatchHost.ts] /* - * Note: This test is a public API sample. This sample verifies creating abstract builder to watch list of root files + * Note: This test is a public API sample. This sample verifies creating abstract builder to watch list of root files * Please log a "breaking change" issue for any API breaking change affecting this issue */ diff --git a/tests/baselines/reference/APISample_compile.errors.txt b/tests/baselines/reference/APISample_compile.errors.txt deleted file mode 100644 index 4af4a173002..00000000000 --- a/tests/baselines/reference/APISample_compile.errors.txt +++ /dev/null @@ -1,171 +0,0 @@ -typescript_standalone.d.ts(21,28): error TS1005: ';' expected. -typescript_standalone.d.ts(21,41): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,28): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,42): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,46): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,38): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,57): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,41): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,48): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,47): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,47): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,44): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,35): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,45): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,56): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,36): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,41): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,38): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,71): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,48): error TS1005: ';' expected. - - -==== tests/cases/compiler/APISample_compile.ts (0 errors) ==== - /* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - - declare var process: any; - declare var console: any; - declare var os: any; - - import ts = require("typescript"); - - export function compile(fileNames: string[], options: ts.CompilerOptions): void { - var program = ts.createProgram(fileNames, options); - var emitResult = program.emit(); - - var allDiagnostics = ts.getPreEmitDiagnostics(program); - - allDiagnostics.forEach(diagnostic => { - var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); - if (!diagnostic.file) { - console.log(message); - return; - } - var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!); - console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); - }); - - var exitCode = emitResult.emitSkipped ? 1 : 0; - console.log(`Process exiting with code '${exitCode}'.`); - process.exit(exitCode); - } - - compile(process.argv.slice(2), { - noEmitOnError: true, noImplicitAny: true, - target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS - }); - \ No newline at end of file diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 35d49350457..5cae4df2c38 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1,7 +1,14 @@ +//// [tests/cases/compiler/APISample_compile.ts] //// + +//// [index.d.ts] +declare module "typescript" { + export = ts; +} + //// [APISample_compile.ts] /* * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler * Please log a "breaking change" issue for any API breaking change affecting this issue */ @@ -42,7 +49,7 @@ compile(process.argv.slice(2), { "use strict"; /* * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler * Please log a "breaking change" issue for any API breaking change affecting this issue */ exports.__esModule = true; diff --git a/tests/baselines/reference/APISample_jsdoc.errors.txt b/tests/baselines/reference/APISample_jsdoc.errors.txt deleted file mode 100644 index b80bb027663..00000000000 --- a/tests/baselines/reference/APISample_jsdoc.errors.txt +++ /dev/null @@ -1,246 +0,0 @@ -typescript_standalone.d.ts(21,28): error TS1005: ';' expected. -typescript_standalone.d.ts(21,41): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,28): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,42): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,46): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,38): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,57): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,41): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,48): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,47): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,47): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,44): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,35): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,45): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,56): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,36): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,41): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,38): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,71): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,48): error TS1005: ';' expected. - - -==== tests/cases/compiler/APISample_jsdoc.ts (0 errors) ==== - /* - * Note: This test is a public API sample. The original sources can be found - * at: https://github.com/YousefED/typescript-json-schema - * https://github.com/vega/ts-json-schema-generator - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - - declare var console: any; - - import * as ts from "typescript"; - - // excerpted from https://github.com/YousefED/typescript-json-schema - // (converted from a method and modified; for example, `this: any` to compensate, among other changes) - function parseCommentsIntoDefinition(this: any, - symbol: ts.Symbol, - definition: {description?: string, [s: string]: string | undefined}, - otherAnnotations: { [s: string]: true}): void { - if (!symbol) { - return; - } - - // the comments for a symbol - let comments = symbol.getDocumentationComment(undefined); - - if (comments.length) { - definition.description = comments.map(comment => comment.kind === "lineBreak" ? comment.text : comment.text.trim().replace(/\r\n/g, "\n")).join(""); - } - - // jsdocs are separate from comments - const jsdocs = symbol.getJsDocTags(); - jsdocs.forEach(doc => { - // if we have @TJS-... annotations, we have to parse them - const { name, text } = doc; - if (this.userValidationKeywords[name]) { - definition[name] = this.parseValue(text); - } else { - // special annotations - otherAnnotations[doc.name] = true; - } - }); - } - - - // excerpted from https://github.com/vega/ts-json-schema-generator - export interface Annotations { - [name: string]: any; - } - function getAnnotations(this: any, node: ts.Node): Annotations | undefined { - const symbol: ts.Symbol = (node as any).symbol; - if (!symbol) { - return undefined; - } - - const jsDocTags: ts.JSDocTagInfo[] = symbol.getJsDocTags(); - if (!jsDocTags || !jsDocTags.length) { - return undefined; - } - - const annotations: Annotations = jsDocTags.reduce((result: Annotations, jsDocTag: ts.JSDocTagInfo) => { - const value = this.parseJsDocTag(jsDocTag); - if (value !== undefined) { - result[jsDocTag.name] = value; - } - - return result; - }, {}); - return Object.keys(annotations).length ? annotations : undefined; - } - - // these examples are artificial and mostly nonsensical - function parseSpecificTags(node: ts.Node) { - if (node.kind === ts.SyntaxKind.Parameter) { - return ts.getJSDocParameterTags(node as ts.ParameterDeclaration); - } - if (node.kind === ts.SyntaxKind.FunctionDeclaration) { - const func = node as ts.FunctionDeclaration; - if (ts.hasJSDocParameterTags(func)) { - const flat: ts.JSDocTag[] = []; - for (const tags of func.parameters.map(ts.getJSDocParameterTags)) { - if (tags) flat.push(...tags); - } - return flat; - } - } - } - - function getReturnTypeFromJSDoc(node: ts.Node) { - if (node.kind === ts.SyntaxKind.FunctionDeclaration) { - return ts.getJSDocReturnType(node); - } - let type = ts.getJSDocType(node); - if (type && type.kind === ts.SyntaxKind.FunctionType) { - return (type as ts.FunctionTypeNode).type; - } - } - - function getAllTags(node: ts.Node) { - ts.getJSDocTags(node); - } - - function getSomeOtherTags(node: ts.Node) { - const tags: (ts.JSDocTag | undefined)[] = []; - tags.push(ts.getJSDocAugmentsTag(node)); - tags.push(ts.getJSDocClassTag(node)); - tags.push(ts.getJSDocReturnTag(node)); - const type = ts.getJSDocTypeTag(node); - if (type) { - tags.push(type); - } - tags.push(ts.getJSDocTemplateTag(node)); - return tags; - } - \ No newline at end of file diff --git a/tests/baselines/reference/APISample_jsdoc.js b/tests/baselines/reference/APISample_jsdoc.js index f28b16d88b6..9c1dd5f824f 100644 --- a/tests/baselines/reference/APISample_jsdoc.js +++ b/tests/baselines/reference/APISample_jsdoc.js @@ -1,3 +1,10 @@ +//// [tests/cases/compiler/APISample_jsdoc.ts] //// + +//// [index.d.ts] +declare module "typescript" { + export = ts; +} + //// [APISample_jsdoc.ts] /* * Note: This test is a public API sample. The original sources can be found diff --git a/tests/baselines/reference/APISample_linter.errors.txt b/tests/baselines/reference/APISample_linter.errors.txt deleted file mode 100644 index 51a0140cf04..00000000000 --- a/tests/baselines/reference/APISample_linter.errors.txt +++ /dev/null @@ -1,196 +0,0 @@ -typescript_standalone.d.ts(21,28): error TS1005: ';' expected. -typescript_standalone.d.ts(21,41): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,28): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,42): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,46): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,38): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,57): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,41): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,48): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,47): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,47): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,44): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,35): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,45): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,56): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,36): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,41): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,38): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,71): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,48): error TS1005: ';' expected. - - -==== tests/cases/compiler/APISample_linter.ts (0 errors) ==== - /* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - - declare var process: any; - declare var console: any; - declare var readFileSync: any; - - import * as ts from "typescript"; - - export function delint(sourceFile: ts.SourceFile) { - delintNode(sourceFile); - - function delintNode(node: ts.Node) { - switch (node.kind) { - case ts.SyntaxKind.ForStatement: - case ts.SyntaxKind.ForInStatement: - case ts.SyntaxKind.WhileStatement: - case ts.SyntaxKind.DoStatement: - if ((node).statement.kind !== ts.SyntaxKind.Block) { - report(node, "A looping statement's contents should be wrapped in a block body."); - } - break; - - case ts.SyntaxKind.IfStatement: - let ifStatement = (node); - if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) { - report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); - } - if (ifStatement.elseStatement && - ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && - ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) { - report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); - } - break; - - case ts.SyntaxKind.BinaryExpression: - let op = (node).operatorToken.kind; - if (op === ts.SyntaxKind.EqualsEqualsToken || op == ts.SyntaxKind.ExclamationEqualsToken) { - report(node, "Use '===' and '!=='.") - } - break; - } - - ts.forEachChild(node, delintNode); - } - - function report(node: ts.Node, message: string) { - let { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart()); - console.log(`${sourceFile.fileName} (${line + 1},${character + 1}): ${message}`); - } - } - - const fileNames: string[] = process.argv.slice(2); - fileNames.forEach(fileName => { - // Parse a file - let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES2015, /*setParentNodes */ true); - - // delint it - delint(sourceFile); - }); \ No newline at end of file diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 51b208c39c9..ea9c018c1a1 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1,7 +1,14 @@ +//// [tests/cases/compiler/APISample_linter.ts] //// + +//// [index.d.ts] +declare module "typescript" { + export = ts; +} + //// [APISample_linter.ts] /* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter + * Note: This test is a public API sample. The sample sources can be found + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter * Please log a "breaking change" issue for any API breaking change affecting this issue */ @@ -67,7 +74,7 @@ fileNames.forEach(fileName => { "use strict"; /* * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter * Please log a "breaking change" issue for any API breaking change affecting this issue */ exports.__esModule = true; diff --git a/tests/baselines/reference/APISample_parseConfig.errors.txt b/tests/baselines/reference/APISample_parseConfig.errors.txt deleted file mode 100644 index f2ccfacdc9f..00000000000 --- a/tests/baselines/reference/APISample_parseConfig.errors.txt +++ /dev/null @@ -1,168 +0,0 @@ -typescript_standalone.d.ts(21,28): error TS1005: ';' expected. -typescript_standalone.d.ts(21,41): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,28): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,42): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,46): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,38): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,57): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,41): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,48): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,47): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,47): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,44): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,35): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,45): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,56): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,36): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,41): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,38): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,71): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,48): error TS1005: ';' expected. - - -==== tests/cases/compiler/APISample_parseConfig.ts (0 errors) ==== - /* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - - declare var process: any; - declare var console: any; - declare var os: any; - - import ts = require("typescript"); - - function printError(error: ts.Diagnostic): void { - if (!error) { - return; - } - console.log(`${error.file && error.file.fileName}: ${error.messageText}`); - } - - export function createProgram(rootFiles: string[], compilerOptionsJson: string): ts.Program | undefined { - const { config, error } = ts.parseConfigFileTextToJson("tsconfig.json", compilerOptionsJson) - if (error) { - printError(error); - return undefined; - } - const basePath: string = process.cwd(); - const settings = ts.convertCompilerOptionsFromJson(config.config["compilerOptions"], basePath); - if (!settings.options) { - for (const err of settings.errors) { - printError(err); - } - return undefined; - } - return ts.createProgram(rootFiles, settings.options); - } \ No newline at end of file diff --git a/tests/baselines/reference/APISample_parseConfig.js b/tests/baselines/reference/APISample_parseConfig.js index 690efb359c6..661376f647e 100644 --- a/tests/baselines/reference/APISample_parseConfig.js +++ b/tests/baselines/reference/APISample_parseConfig.js @@ -1,7 +1,14 @@ +//// [tests/cases/compiler/APISample_parseConfig.ts] //// + +//// [index.d.ts] +declare module "typescript" { + export = ts; +} + //// [APISample_parseConfig.ts] /* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler + * Note: This test is a public API sample. The sample sources can be found + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler * Please log a "breaking change" issue for any API breaking change affecting this issue */ @@ -39,7 +46,7 @@ export function createProgram(rootFiles: string[], compilerOptionsJson: string): "use strict"; /* * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler * Please log a "breaking change" issue for any API breaking change affecting this issue */ exports.__esModule = true; diff --git a/tests/baselines/reference/APISample_transform.errors.txt b/tests/baselines/reference/APISample_transform.errors.txt deleted file mode 100644 index 1680cd61511..00000000000 --- a/tests/baselines/reference/APISample_transform.errors.txt +++ /dev/null @@ -1,148 +0,0 @@ -typescript_standalone.d.ts(21,28): error TS1005: ';' expected. -typescript_standalone.d.ts(21,41): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,28): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,42): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,46): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,38): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,57): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,41): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,48): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,47): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,47): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,44): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,35): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,45): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,56): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,36): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,41): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,38): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,71): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,48): error TS1005: ';' expected. - - -==== tests/cases/compiler/APISample_transform.ts (0 errors) ==== - /* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - - declare var console: any; - - import * as ts from "typescript"; - - const source = "let x: string = 'string'"; - - let result = ts.transpile(source, { module: ts.ModuleKind.CommonJS }); - - console.log(JSON.stringify(result)); \ No newline at end of file diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 47f63f56e70..db25c1bd1dd 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1,7 +1,14 @@ +//// [tests/cases/compiler/APISample_transform.ts] //// + +//// [index.d.ts] +declare module "typescript" { + export = ts; +} + //// [APISample_transform.ts] /* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function + * Note: This test is a public API sample. The sample sources can be found + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function * Please log a "breaking change" issue for any API breaking change affecting this issue */ @@ -19,7 +26,7 @@ console.log(JSON.stringify(result)); "use strict"; /* * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function * Please log a "breaking change" issue for any API breaking change affecting this issue */ exports.__esModule = true; diff --git a/tests/baselines/reference/APISample_watcher.errors.txt b/tests/baselines/reference/APISample_watcher.errors.txt deleted file mode 100644 index 1041d8495bb..00000000000 --- a/tests/baselines/reference/APISample_watcher.errors.txt +++ /dev/null @@ -1,242 +0,0 @@ -typescript_standalone.d.ts(21,28): error TS1005: ';' expected. -typescript_standalone.d.ts(21,41): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,28): error TS1005: ';' expected. -typescript_standalone.d.ts(8921,42): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9181,46): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9531,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9555,36): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,28): error TS1005: ';' expected. -typescript_standalone.d.ts(9642,38): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10807,57): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10818,41): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10828,48): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10903,47): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,28): error TS1005: ';' expected. -typescript_standalone.d.ts(10960,47): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11014,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11034,44): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11044,35): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11078,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11081,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11085,45): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11103,56): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11129,36): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11132,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11144,43): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11174,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11208,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11219,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11243,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11251,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11255,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11285,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11328,41): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11515,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11517,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11521,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11523,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11525,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11527,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11529,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11538,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11540,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11542,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11544,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11546,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11548,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11550,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11552,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11554,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11556,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11558,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11560,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11562,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11564,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11566,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11576,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11578,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11580,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11582,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11584,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11586,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11588,37): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11590,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11592,52): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11664,72): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11666,38): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11668,71): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11670,40): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,28): error TS1005: ';' expected. -typescript_standalone.d.ts(11746,48): error TS1005: ';' expected. - - -==== tests/cases/compiler/APISample_watcher.ts (0 errors) ==== - /* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - - declare var process: any; - declare var console: any; - declare var fs: { - existsSync(path: string): boolean; - readdirSync(path: string): string[]; - readFileSync(filename: string, encoding?: string): string; - writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; } | string): void; - watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: { mtime: Date }, prev: { mtime: Date }) => void): void; - }; - declare var path: any; - - import * as ts from "typescript"; - - function watch(rootFileNames: string[], options: ts.CompilerOptions) { - const files: ts.MapLike<{ version: number }> = {}; - - // initialize the list of files - rootFileNames.forEach(fileName => { - files[fileName] = { version: 0 }; - }); - - // Create the language service host to allow the LS to communicate with the host - const servicesHost: ts.LanguageServiceHost = { - getScriptFileNames: () => rootFileNames, - getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(), - getScriptSnapshot: (fileName) => { - if (!fs.existsSync(fileName)) { - return undefined; - } - - return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); - }, - getCurrentDirectory: () => process.cwd(), - getCompilationSettings: () => options, - getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), - }; - - // Create the language service files - const services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()) - - // Now let's watch the files - rootFileNames.forEach(fileName => { - // First time around, emit all files - emitFile(fileName); - - // Add a watch on the file to handle next change - fs.watchFile(fileName, - { persistent: true, interval: 250 }, - (curr, prev) => { - // Check timestamp - if (+curr.mtime <= +prev.mtime) { - return; - } - - // Update the version to signal a change in the file - files[fileName].version++; - - // write the changes to disk - emitFile(fileName); - }); - }); - - function emitFile(fileName: string) { - let output = services.getEmitOutput(fileName); - - if (!output.emitSkipped) { - console.log(`Emitting ${fileName}`); - } - else { - console.log(`Emitting ${fileName} failed`); - logErrors(fileName); - } - - output.outputFiles.forEach(o => { - fs.writeFileSync(o.name, o.text, "utf8"); - }); - } - - function logErrors(fileName: string) { - let allDiagnostics = services.getCompilerOptionsDiagnostics() - .concat(services.getSyntacticDiagnostics(fileName)) - .concat(services.getSemanticDiagnostics(fileName)); - - allDiagnostics.forEach(diagnostic => { - let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); - if (diagnostic.file) { - let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!); - console.log(` Error ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); - } - else { - console.log(` Error: ${message}`); - } - }); - } - } - - // Initialize files constituting the program as all .ts files in the current directory - const currentDirectoryFiles = fs.readdirSync(process.cwd()). - filter(fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts"); - - // Start the watcher - watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }); - \ No newline at end of file diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index f4d03f8f62f..e93856a3165 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1,7 +1,14 @@ +//// [tests/cases/compiler/APISample_watcher.ts] //// + +//// [index.d.ts] +declare module "typescript" { + export = ts; +} + //// [APISample_watcher.ts] /* * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services * Please log a "breaking change" issue for any API breaking change affecting this issue */ @@ -113,7 +120,7 @@ watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }); "use strict"; /* * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services * Please log a "breaking change" issue for any API breaking change affecting this issue */ exports.__esModule = true; diff --git a/tests/cases/compiler/APISample_Watch.ts b/tests/cases/compiler/APISample_Watch.ts index e1506676426..154e5f90b0e 100644 --- a/tests/cases/compiler/APISample_Watch.ts +++ b/tests/cases/compiler/APISample_Watch.ts @@ -1,12 +1,18 @@ // @module: commonjs // @skipLibCheck: true -// @includebuiltfile: typescript_standalone.d.ts +// @includebuiltfile: typescriptServices.d.ts // @noImplicitAny:true // @strictNullChecks:true +// @filename: node_modules/typescript/index.d.ts +declare module "typescript" { + export = ts; +} + +// @filename: APISample_Watch.ts /* * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md#writing-an-incremental-program-watcher + * at: https://github.com/Microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md#writing-an-incremental-program-watcher * Please log a "breaking change" issue for any API breaking change affecting this issue */ diff --git a/tests/cases/compiler/APISample_WatchWithDefaults.ts b/tests/cases/compiler/APISample_WatchWithDefaults.ts index 24f251daca2..d028d109275 100644 --- a/tests/cases/compiler/APISample_WatchWithDefaults.ts +++ b/tests/cases/compiler/APISample_WatchWithDefaults.ts @@ -1,9 +1,15 @@ // @module: commonjs // @skipLibCheck: true -// @includebuiltfile: typescript_standalone.d.ts +// @includebuiltfile: typescriptServices.d.ts // @noImplicitAny:true -// @strict:true +// @strictNullChecks:true +// @filename: node_modules/typescript/index.d.ts +declare module "typescript" { + export = ts; +} + +// @filename: APISample_WatchWithDefaults.ts /* * Note: This test is a public API sample. This uses default sys interface without having to pass anything * Please log a "breaking change" issue for any API breaking change affecting this issue diff --git a/tests/cases/compiler/APISample_WatchWithOwnWatchHost.ts b/tests/cases/compiler/APISample_WatchWithOwnWatchHost.ts index 18f170bd5f6..18cb5766ce3 100644 --- a/tests/cases/compiler/APISample_WatchWithOwnWatchHost.ts +++ b/tests/cases/compiler/APISample_WatchWithOwnWatchHost.ts @@ -1,11 +1,17 @@ // @module: commonjs // @skipLibCheck: true -// @includebuiltfile: typescript_standalone.d.ts +// @includebuiltfile: typescriptServices.d.ts // @noImplicitAny:true -// @strict:true +// @strictNullChecks:true +// @filename: node_modules/typescript/index.d.ts +declare module "typescript" { + export = ts; +} + +// @filename: APISample_WatchWithOwnWatchHost.ts /* - * Note: This test is a public API sample. This sample verifies creating abstract builder to watch list of root files + * Note: This test is a public API sample. This sample verifies creating abstract builder to watch list of root files * Please log a "breaking change" issue for any API breaking change affecting this issue */ @@ -19,23 +25,23 @@ function watchMain() { const options: ts.CompilerOptions = {}; const host: ts.WatchCompilerHostOfFilesAndCompilerOptions = { - rootFiles: files, - options, - - useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames, - getNewLine: () => ts.sys.newLine, - getCurrentDirectory: ts.sys.getCurrentDirectory, - getDefaultLibFileName: options => ts.getDefaultLibFilePath(options), - - fileExists: ts.sys.fileExists, - readFile: ts.sys.readFile, - directoryExists: ts.sys.directoryExists, - getDirectories: ts.sys.getDirectories, - readDirectory: ts.sys.readDirectory, - realpath: ts.sys.realpath, - - watchFile: ts.sys.watchFile!, - watchDirectory: ts.sys.watchDirectory!, + rootFiles: files, + options, + + useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames, + getNewLine: () => ts.sys.newLine, + getCurrentDirectory: ts.sys.getCurrentDirectory, + getDefaultLibFileName: options => ts.getDefaultLibFilePath(options), + + fileExists: ts.sys.fileExists, + readFile: ts.sys.readFile, + directoryExists: ts.sys.directoryExists, + getDirectories: ts.sys.getDirectories, + readDirectory: ts.sys.readDirectory, + realpath: ts.sys.realpath, + + watchFile: ts.sys.watchFile!, + watchDirectory: ts.sys.watchDirectory!, createProgram: ts.createAbstractBuilder }; diff --git a/tests/cases/compiler/APISample_compile.ts b/tests/cases/compiler/APISample_compile.ts index 35fe8192e78..49d821fae16 100644 --- a/tests/cases/compiler/APISample_compile.ts +++ b/tests/cases/compiler/APISample_compile.ts @@ -1,12 +1,18 @@ // @module: commonjs // @skipLibCheck: true -// @includebuiltfile: typescript_standalone.d.ts +// @includebuiltfile: typescriptServices.d.ts // @noImplicitAny:true // @strictNullChecks:true +// @filename: node_modules/typescript/index.d.ts +declare module "typescript" { + export = ts; +} + +// @filename: APISample_compile.ts /* * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler * Please log a "breaking change" issue for any API breaking change affecting this issue */ diff --git a/tests/cases/compiler/APISample_jsdoc.ts b/tests/cases/compiler/APISample_jsdoc.ts index d40673f1d9e..1ca3c88e550 100644 --- a/tests/cases/compiler/APISample_jsdoc.ts +++ b/tests/cases/compiler/APISample_jsdoc.ts @@ -1,8 +1,15 @@ // @module: commonjs // @skipLibCheck: true -// @includebuiltfile: typescript_standalone.d.ts -// @strict:true +// @includebuiltfile: typescriptServices.d.ts +// @noImplicitAny:true +// @strictNullChecks:true +// @filename: node_modules/typescript/index.d.ts +declare module "typescript" { + export = ts; +} + +// @filename: APISample_jsdoc.ts /* * Note: This test is a public API sample. The original sources can be found * at: https://github.com/YousefED/typescript-json-schema diff --git a/tests/cases/compiler/APISample_linter.ts b/tests/cases/compiler/APISample_linter.ts index 0d8dc0190fe..a6ae00944bb 100644 --- a/tests/cases/compiler/APISample_linter.ts +++ b/tests/cases/compiler/APISample_linter.ts @@ -1,12 +1,18 @@ // @module: commonjs // @skipLibCheck: true -// @includebuiltfile: typescript_standalone.d.ts +// @includebuiltfile: typescriptServices.d.ts // @noImplicitAny:true // @strictNullChecks:true +// @filename: node_modules/typescript/index.d.ts +declare module "typescript" { + export = ts; +} + +// @filename: APISample_linter.ts /* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter + * Note: This test is a public API sample. The sample sources can be found + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter * Please log a "breaking change" issue for any API breaking change affecting this issue */ diff --git a/tests/cases/compiler/APISample_parseConfig.ts b/tests/cases/compiler/APISample_parseConfig.ts index c3094a93988..243e25f995b 100644 --- a/tests/cases/compiler/APISample_parseConfig.ts +++ b/tests/cases/compiler/APISample_parseConfig.ts @@ -1,12 +1,18 @@ // @module: commonjs // @skipLibCheck: true -// @includebuiltfile: typescript_standalone.d.ts +// @includebuiltfile: typescriptServices.d.ts // @noImplicitAny:true // @strictNullChecks:true +// @filename: node_modules/typescript/index.d.ts +declare module "typescript" { + export = ts; +} + +// @filename: APISample_parseConfig.ts /* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler + * Note: This test is a public API sample. The sample sources can be found + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler * Please log a "breaking change" issue for any API breaking change affecting this issue */ diff --git a/tests/cases/compiler/APISample_transform.ts b/tests/cases/compiler/APISample_transform.ts index c7b0fad8e75..a750d0d3595 100644 --- a/tests/cases/compiler/APISample_transform.ts +++ b/tests/cases/compiler/APISample_transform.ts @@ -1,12 +1,18 @@ // @module: commonjs // @skipLibCheck: true -// @includebuiltfile: typescript_standalone.d.ts +// @includebuiltfile: typescriptServices.d.ts // @noImplicitAny:true // @strictNullChecks:true +// @filename: node_modules/typescript/index.d.ts +declare module "typescript" { + export = ts; +} + +// @filename: APISample_transform.ts /* - * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function + * Note: This test is a public API sample. The sample sources can be found + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function * Please log a "breaking change" issue for any API breaking change affecting this issue */ diff --git a/tests/cases/compiler/APISample_watcher.ts b/tests/cases/compiler/APISample_watcher.ts index 5be0e9e38ad..8b46979e092 100644 --- a/tests/cases/compiler/APISample_watcher.ts +++ b/tests/cases/compiler/APISample_watcher.ts @@ -1,12 +1,18 @@ // @module: commonjs // @skipLibCheck: true -// @includebuiltfile: typescript_standalone.d.ts +// @includebuiltfile: typescriptServices.d.ts // @noImplicitAny:true // @strictNullChecks:true +// @filename: node_modules/typescript/index.d.ts +declare module "typescript" { + export = ts; +} + +// @filename: APISample_watcher.ts /* * Note: This test is a public API sample. The sample sources can be found - at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services + * at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services * Please log a "breaking change" issue for any API breaking change affecting this issue */