mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
API sample is building again
This commit is contained in:
parent
066b191982
commit
0050d5d011
@ -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(8910,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(8910,42): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,46): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,57): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,48): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,44): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,35): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,45): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,56): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,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(11232,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11232,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,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(11531,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11531,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,71): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,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<string>, 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();
|
||||
|
||||
@ -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(8910,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(8910,42): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,46): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,57): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,48): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,44): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,35): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,45): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,56): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,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(11232,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11232,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,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(11531,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11531,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,71): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,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();
|
||||
|
||||
@ -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(8910,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(8910,42): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,46): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,57): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,48): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,44): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,35): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,45): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,56): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,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(11232,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11232,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,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(11531,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11531,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,71): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,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<ts.BuilderProgram> = {
|
||||
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();
|
||||
|
||||
@ -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(8910,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(8910,42): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,46): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,57): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,48): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,44): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,35): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,45): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,56): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,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(11232,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11232,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,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(11531,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11531,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,71): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,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
|
||||
});
|
||||
|
||||
@ -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(8910,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(8910,42): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,46): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,57): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,48): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,44): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,35): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,45): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,56): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,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(11232,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11232,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,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(11531,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11531,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,71): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,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;
|
||||
}
|
||||
|
||||
@ -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(8910,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(8910,42): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,46): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,57): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,48): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,44): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,35): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,45): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,56): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,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(11232,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11232,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,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(11531,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11531,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,71): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,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 ((<ts.IterationStatement>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 = (<ts.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 = (<ts.BinaryExpression>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);
|
||||
});
|
||||
@ -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(8910,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(8910,42): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,46): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,57): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,48): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,44): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,35): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,45): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,56): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,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(11232,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11232,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,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(11531,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11531,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,71): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,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);
|
||||
}
|
||||
@ -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(8910,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(8910,42): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,46): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,57): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,48): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,44): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,35): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,45): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,56): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,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(11232,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11232,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,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(11531,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11531,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,71): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,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));
|
||||
@ -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(8910,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(8910,42): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9170,46): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9520,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9544,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(9631,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10796,57): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10807,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10817,48): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10892,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(10949,47): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11003,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11023,44): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11033,35): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11067,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11070,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11074,45): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11092,56): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11118,36): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11121,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11133,43): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11163,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11197,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(11232,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11232,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11240,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11244,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11274,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11317,41): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11504,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11506,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11510,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11512,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11514,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11516,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11518,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(11531,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11531,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11533,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11535,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11537,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11539,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11541,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11543,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11545,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11547,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11549,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11551,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11553,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11555,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11565,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11567,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11569,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11571,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11573,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11575,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11577,37): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11579,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11581,52): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11653,72): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11655,38): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11657,71): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11659,40): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,28): error TS1005: ';' expected.
|
||||
typescript_standalone.d.ts(11735,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 });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user