From c1b37b167ea1d88fb7781aea63a3609955e3c3ff Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 3 Jul 2018 11:34:53 -0700 Subject: [PATCH 01/10] Gulp updates and api baseline fix --- Gulpfile.js | 181 +- scripts/build/browserify.js | 116 +- scripts/build/cancellation.js | 71 + scripts/build/debounce.js | 31 + scripts/build/exec.js | 19 +- scripts/build/options.js | 10 +- scripts/build/prepend.js | 66 + scripts/build/project.js | 21 + scripts/build/sourcemaps.js | 131 + scripts/build/tests.js | 212 +- scripts/build/utils.js | 27 + scripts/build/vinyl.d.ts | 60 + scripts/build/vinyl.js | 1 + scripts/failed-tests.js | 59 +- scripts/run-failed-tests.js | 7 +- src/jsTyping/types.ts | 1 - .../reference/api/tsserverlibrary.d.ts | 8380 +++-------------- tests/baselines/reference/api/typescript.d.ts | 1281 +-- 18 files changed, 2331 insertions(+), 8343 deletions(-) create mode 100644 scripts/build/cancellation.js create mode 100644 scripts/build/debounce.js create mode 100644 scripts/build/prepend.js create mode 100644 scripts/build/sourcemaps.js create mode 100644 scripts/build/utils.js create mode 100644 scripts/build/vinyl.d.ts create mode 100644 scripts/build/vinyl.js diff --git a/Gulpfile.js b/Gulpfile.js index e202b2d983c2b..dfd9d8de19f71 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -12,6 +12,7 @@ const sourcemaps = require("gulp-sourcemaps"); const del = require("del"); const fold = require("travis-fold"); const rename = require("gulp-rename"); +const through2 = require("through2"); const mkdirp = require("./scripts/build/mkdirp"); const gulp = require("./scripts/build/gulp"); const getDirSize = require("./scripts/build/getDirSize"); @@ -24,6 +25,9 @@ const baselineAccept = require("./scripts/build/baselineAccept"); const cmdLineOptions = require("./scripts/build/options"); const exec = require("./scripts/build/exec"); const browserify = require("./scripts/build/browserify"); +const debounce = require("./scripts/build/debounce"); +const prepend = require("./scripts/build/prepend"); +const { CancelSource, CancelError } = require("./scripts/build/cancellation"); const { libraryTargets, generateLibs } = require("./scripts/build/lib"); const { runConsoleTests, cleanTestDirs, writeTestConfigFile, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline } = require("./scripts/build/tests"); @@ -44,17 +48,9 @@ const generateLocalizedDiagnosticMessagesJs = "scripts/generateLocalizedDiagnost const buildProtocolJs = "scripts/buildProtocol.js"; const produceLKGJs = "scripts/produceLKG.js"; const word2mdJs = "scripts/word2md.js"; -gulp.task("scripts", /*help*/ false, () => project.compile(scriptsProject), { - aliases: [ - configurePrereleaseJs, - processDiagnosticMessagesJs, - generateLocalizedDiagnosticMessagesJs, - produceLKGJs, - buildProtocolJs, - word2mdJs - ] -}); -gulp.task("clean-scripts", /*help*/ false, () => project.clean(scriptsProject)); +const scriptsTaskAliases = [configurePrereleaseJs, processDiagnosticMessagesJs, generateLocalizedDiagnosticMessagesJs, produceLKGJs, buildProtocolJs, word2mdJs]; +gulp.task("scripts", /*help*/ false, () => project.compile(scriptsProject), { aliases: scriptsTaskAliases }); +gulp.task("clean:scripts", /*help*/ false, () => project.clean(scriptsProject), { aliases: scriptsTaskAliases.map(alias => `clean:${alias}`)}); // Nightly management tasks gulp.task( @@ -73,7 +69,7 @@ gulp.task( const importDefinitelyTypedTestsProject = "scripts/importDefinitelyTypedTests/tsconfig.json"; const importDefinitelyTypedTestsJs = "scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.js"; gulp.task(importDefinitelyTypedTestsJs, /*help*/ false, () => project.compile(importDefinitelyTypedTestsProject)); -gulp.task("clean:" + importDefinitelyTypedTestsJs, /*help*/ false, () => project.clean(importDefinitelyTypedTestsProject)); +gulp.task(`clean:${importDefinitelyTypedTestsJs}`, /*help*/ false, () => project.clean(importDefinitelyTypedTestsProject)); gulp.task( "importDefinitelyTypedTests", @@ -95,7 +91,7 @@ gulp.task(diagnosticInformationMapTs, /*help*/ false, [processDiagnosticMessages return exec(host, [processDiagnosticMessagesJs, diagnosticMessagesJson]); } }); -gulp.task("clean:" + diagnosticInformationMapTs, /*help*/ false, () => del([diagnosticInformationMapTs, diagnosticMessagesGeneratedJson])); +gulp.task(`clean:${diagnosticInformationMapTs}`, /*help*/ false, () => del([diagnosticInformationMapTs, diagnosticMessagesGeneratedJson])); const builtGeneratedDiagnosticMessagesJson = "built/local/diagnosticMessages.generated.json"; gulp.task(builtGeneratedDiagnosticMessagesJson, /*help*/ false, [diagnosticInformationMapTs], () => @@ -142,6 +138,7 @@ gulp.task(typescriptServicesProject, /*help*/ false, () => { compilerOptions: { "removeComments": true, "stripInternal": true, + "declarationMap": false, "outFile": "typescriptServices.js" } }); @@ -150,7 +147,13 @@ gulp.task(typescriptServicesProject, /*help*/ false, () => { const typescriptServicesJs = "built/local/typescriptServices.js"; const typescriptServicesDts = "built/local/typescriptServices.d.ts"; gulp.task(typescriptServicesJs, /*help*/ false, ["lib", "generate-diagnostics", typescriptServicesProject], () => - project.compile(typescriptServicesProject, { dts: files => files.pipe(convertConstEnums()) }), + project.compile(typescriptServicesProject, { + js: files => files + .pipe(prepend.file(copyright)), + dts: files => files + .pipe(prepend.file(copyright)) + .pipe(convertConstEnums()) + }), { aliases: [typescriptServicesDts] }); const typescriptJs = "built/local/typescript.js"; @@ -179,29 +182,39 @@ gulp.task(typescriptStandaloneDts, /*help*/ false, [typescriptServicesDts], () = // build all 'typescriptServices'-related outputs gulp.task("services", /*help*/ false, [typescriptServicesJs, typescriptServicesDts, typescriptJs, typescriptDts, typescriptStandaloneDts]); +const useCompiler = cmdLineOptions.lkg ? "lkg" : "built"; +const useCompilerDeps = cmdLineOptions.lkg ? ["lib", "generate-diagnostics"] : [typescriptServicesJs]; + const tscProject = "src/tsc/tsconfig.json"; const tscJs = "built/local/tsc.js"; -gulp.task(tscJs, /*help*/ false, [typescriptServicesJs], () => project.compile(tscProject, { typescript: "built" })); +gulp.task(tscJs, /*help*/ false, useCompilerDeps, () => + project.compile(tscProject, { + typescript: useCompiler, + js: files => files.pipe(prepend.file(copyright)) + })); const tscReleaseProject = "src/tsc/tsconfig.release.json"; const tscReleaseJs = "built/local/tsc.release.js"; -gulp.task(tscReleaseJs, /*help*/ false, () => project.compile(tscReleaseProject)); +gulp.task(tscReleaseJs, /*help*/ false, () => + project.compile(tscReleaseProject, { + js: files => files.pipe(prepend.file(copyright)) + })); const cancellationTokenProject = "src/cancellationToken/tsconfig.json"; const cancellationTokenJs = "built/local/cancellationToken.js"; -gulp.task(cancellationTokenJs, /*help*/ false, [typescriptServicesJs], () => project.compile(cancellationTokenProject, { typescript: "built" })); +gulp.task(cancellationTokenJs, /*help*/ false, useCompilerDeps, () => project.compile(cancellationTokenProject, { typescript: useCompiler })); const typingsInstallerProject = "src/typingsInstaller/tsconfig.json"; const typingsInstallerJs = "built/local/typingsInstaller.js"; -gulp.task(typingsInstallerJs, /*help*/ false, [typescriptServicesJs], () => project.compile(typingsInstallerProject, { typescript: "built" })); +gulp.task(typingsInstallerJs, /*help*/ false, useCompilerDeps, () => project.compile(typingsInstallerProject, { typescript: useCompiler })); const tsserverProject = "src/tsserver/tsconfig.json"; const tsserverJs = "built/local/tsserver.js"; -gulp.task(tsserverJs, /*help*/ false, [typescriptServicesJs], () => project.compile(tsserverProject, { typescript: "built" })); +gulp.task(tsserverJs, /*help*/ false, useCompilerDeps, () => project.compile(tsserverProject, { typescript: useCompiler })); const watchGuardProject = "src/watchGuard/tsconfig.json"; const watchGuardJs = "built/local/watchGuard.js"; -gulp.task(watchGuardJs, /*help*/ false, [typescriptServicesJs], () => project.compile(watchGuardProject, { typescript: "built" })); +gulp.task(watchGuardJs, /*help*/ false, useCompilerDeps, () => project.compile(watchGuardProject, { typescript: useCompiler })); const typesMapJson = "built/local/typesMap.json"; gulp.task(typesMapJson, /*help*/ false, [], () => @@ -216,8 +229,9 @@ gulp.task(tsserverlibraryProject, /*help*/ false, () => { project.flatten("src/tsserver/tsconfig.json", tsserverlibraryProject, { exclude: ["src/tsserver/server.ts"], compilerOptions: { - "removeComments": true, + "removeComments": false, "stripInternal": true, + "declarationMap": false, "outFile": "tsserverlibrary.js" } }); @@ -225,12 +239,16 @@ gulp.task(tsserverlibraryProject, /*help*/ false, () => { const tsserverlibraryJs = "built/local/tsserverlibrary.js"; const tsserverlibraryDts = "built/local/tsserverlibrary.d.ts"; -gulp.task(tsserverlibraryJs, /*help*/ false, [typescriptServicesJs, tsserverlibraryProject], () => +gulp.task(tsserverlibraryJs, /*help*/ false, useCompilerDeps.concat([tsserverlibraryProject]), () => project.compile(tsserverlibraryProject, { + js: files => files + .pipe(prepend.file(copyright)), dts: files => files + .pipe(through2.obj((file, _, cb) => { file.sourceMap = undefined; cb(null, file); })) + .pipe(prepend.file(copyright)) .pipe(convertConstEnums()) .pipe(append("\nexport = ts;\nexport as namespace ts;")), - typescript: "built" + typescript: useCompiler }), { aliases: [tsserverlibraryDts] }); gulp.task( @@ -294,29 +312,29 @@ gulp.task( // Task to build the tests infrastructure using the built compiler const testRunnerProject = "src/testRunner/tsconfig.json"; const runJs = "built/local/run.js"; -gulp.task(runJs, /*help*/ false, [typescriptServicesJs, tsserverlibraryDts], () => project.compile(testRunnerProject, { typescript: "built" })); +gulp.task(runJs, /*help*/ false, useCompilerDeps, () => project.compile(testRunnerProject, { typescript: useCompiler })); gulp.task( "tests", "Builds the test infrastructure using the built compiler", - [runJs]); + [runJs, tsserverlibraryDts]); gulp.task( "runtests-parallel", "Runs all the tests in parallel using the built run.js file. Optional arguments are: --t[ests]=category1|category2|... --d[ebug]=true.", - ["build-rules", "tests"], - () => runConsoleTests(runJs, "min", /*runInParallel*/ true)); + ["build-rules", "tests", "services", tsserverlibraryDts], + () => runConsoleTests(runJs, "min", /*runInParallel*/ true, /*watchMode*/ false)); gulp.task( "runtests", "Runs the tests using the built run.js file. Optional arguments are: --t[ests]=regex --r[eporter]=[list|spec|json|] --d[ebug]=true --color[s]=false --lint=true.", - ["build-rules", "tests"], - () => runConsoleTests(runJs, "mocha-fivemat-progress-reporter", /*runInParallel*/ false)); + ["build-rules", "tests", "services", tsserverlibraryDts], + () => runConsoleTests(runJs, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ false)); const webTestServerProject = "tests/webTestServer.tsconfig.json"; const webTestServerJs = "tests/webTestServer.js"; -gulp.task(webTestServerJs, /*help*/ false, [typescriptServicesJs], () => project.compile(webTestServerProject, { typescript: "built" })); -gulp.task("clean:" + webTestServerJs, /*help*/ false, () => project.clean(webTestServerProject)); +gulp.task(webTestServerJs, /*help*/ false, useCompilerDeps, () => project.compile(webTestServerProject, { typescript: useCompiler })); +gulp.task(`clean:${webTestServerJs}`, /*help*/ false, () => project.clean(webTestServerProject)); const bundlePath = path.resolve("built/local/bundle.js"); @@ -392,8 +410,8 @@ gulp.task( // Webhost const webtscProject = "tests/webhost/webtsc.tsconfig.json"; const webtscJs = "tests/webhost/webtsc.js"; -gulp.task(webtscJs, /*help*/ false, [typescriptServicesJs], () => project.compile(webtscProject, { typescript: "built" })); -gulp.task("clean:" + webtscJs, /*help*/ false, () => project.clean(webtscProject)); +gulp.task(webtscJs, /*help*/ false, useCompilerDeps, () => project.compile(webtscProject, { typescript: useCompiler })); +gulp.task(`clean:${webtscJs}`, /*help*/ false, () => project.clean(webtscProject)); gulp.task("webhost", "Builds the tsc web host", [webtscJs], () => gulp.src("built/local/lib.d.ts") @@ -402,8 +420,8 @@ gulp.task("webhost", "Builds the tsc web host", [webtscJs], () => // Perf compiler const perftscProject = "tests/perftsc.tsconfig.json"; const perftscJs = "built/local/perftsc.js"; -gulp.task(perftscJs, /*help*/ false, [typescriptServicesJs], () => project.compile(perftscProject, { typescript: "built" })); -gulp.task("clean:" + perftscJs, /*help*/ false, () => project.clean(perftscProject)); +gulp.task(perftscJs, /*help*/ false, useCompilerDeps, () => project.compile(perftscProject, { typescript: useCompiler })); +gulp.task(`clean:${perftscJs}`, /*help*/ false, () => project.clean(perftscProject)); gulp.task( "perftsc", @@ -423,7 +441,7 @@ gulp.task(loggedIOJs, /*help*/ false, [], (done) => { const instrumenterProject = "src/instrumenter/tsconfig.json"; const instrumenterJs = "built/local/instrumenter.js"; gulp.task(instrumenterJs, /*help*/ false, () => project.compile(instrumenterProject)); -gulp.task("clean:" + instrumenterJs, /*help*/ false, () => project.clean(instrumenterProject)); +gulp.task(`clean:${instrumenterJs}`, /*help*/ false, () => project.clean(instrumenterProject)); gulp.task( "tsc-instrumented", @@ -479,43 +497,102 @@ gulp.task( gulp.task( "watch-tsc", /*help*/ false, - ["watch-diagnostics", "watch-lib", typescriptServicesJs], - () => project.watch(tscProject, { typescript: "built" })); + ["watch-diagnostics", "watch-lib"].concat(useCompilerDeps), + () => project.watch(tscProject, { typescript: useCompiler })); + +const watchServicesPatterns = [ + "src/compiler/**/*", + "src/jsTypings/**/*", + "src/services/**/*" +]; gulp.task( "watch-services", /*help*/ false, - ["watch-diagnostics", "watch-lib", typescriptServicesJs], - () => project.watch(servicesProject, { typescript: "built" })); + ["watch-diagnostics", "watch-lib"], + () => gulp.watch(watchServicesPatterns, ["services"])); + +const watchLsslPatterns = [ + ...watchServicesPatterns, + "src/server/**/*", + "src/tsserver/tsconfig.json" +]; + +gulp.task( + "watch-lssl", + /*help*/ false, + () => gulp.watch(watchLsslPatterns, ["lssl"])); gulp.task( "watch-server", /*help*/ false, - ["watch-diagnostics", "watch-lib", typescriptServicesJs], - () => project.watch(tsserverProject, { typescript: "built" })); + ["watch-diagnostics", "watch-lib"].concat(useCompilerDeps), + () => project.watch(tsserverProject, { typescript: useCompiler })); gulp.task( "watch-local", /*help*/ false, ["watch-lib", "watch-tsc", "watch-services", "watch-server"]); +gulp.task( + "watch-runner", + /*help*/ false, + useCompilerDeps, + () => project.watch(testRunnerProject, { typescript: useCompiler })); + +const watchPatterns = [ + runJs, + typescriptDts, + tsserverlibraryDts +]; + gulp.task( "watch", - "Watches for changes to the build inputs for built/local/run.js executes runtests-parallel.", - [typescriptServicesJs], - () => project.watch(testRunnerProject, { typescript: "built" }, ["runtests-parallel"])); + "Watches for changes to the build inputs for built/local/run.js, then executes runtests-parallel.", + ["build-rules", "watch-runner", "watch-services", "watch-lssl"], + () => { + /** @type {CancelSource | undefined} */ + let runTestsSource; + + const fn = debounce(() => { + runTests().catch(error => { + if (error instanceof CancelError) { + log.warn("Operation was canceled"); + } + else { + log.error(error); + } + }); + }, /*timeout*/ 100, { max: 500 }); + + gulp.watch(watchPatterns, () => project.wait().then(fn)); + + // NOTE: gulp.watch is far too slow when watching tests/cases/**/* as it first enumerates *every* file + const testFilePattern = /(\.ts|[\\/]tsconfig\.json)$/; + fs.watch("tests/cases", { recursive: true }, (_, file) => { + if (testFilePattern.test(file)) project.wait().then(fn); + }); + + function runTests() { + if (runTestsSource) runTestsSource.cancel(); + runTestsSource = new CancelSource(); + return cmdLineOptions.tests || cmdLineOptions.failed + ? runConsoleTests(runJs, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ true, runTestsSource.token) + : runConsoleTests(runJs, "min", /*runInParallel*/ true, /*watchMode*/ true, runTestsSource.token); + } + }); -gulp.task("clean-built", /*help*/ false, ["clean:" + diagnosticInformationMapTs], () => del(["built"])); +gulp.task("clean-built", /*help*/ false, [`clean:${diagnosticInformationMapTs}`], () => del(["built"])); gulp.task( "clean", "Cleans the compiler output, declare files, and tests", [ - "clean:" + importDefinitelyTypedTestsJs, - "clean:" + webtscJs, - "clean:" + perftscJs, - "clean:" + instrumenterJs, - "clean:" + webTestServerJs, - "clean-scripts", + `clean:${importDefinitelyTypedTestsJs}`, + `clean:${webtscJs}`, + `clean:${perftscJs}`, + `clean:${instrumenterJs}`, + `clean:${webTestServerJs}`, + "clean:scripts", "clean-rules", "clean-built" ]); \ No newline at end of file diff --git a/scripts/build/browserify.js b/scripts/build/browserify.js index 3d9fffa9fa652..1fa5bbdeaf368 100644 --- a/scripts/build/browserify.js +++ b/scripts/build/browserify.js @@ -1,120 +1,34 @@ // @ts-check -const Browserify = require("browserify"); -const Vinyl = require("vinyl"); -const fs = require("fs"); -const path = require("path"); -const convertMap = require("convert-source-map"); -const applySourceMap = require("vinyl-sourcemaps-apply"); -const { Transform, Readable } = require("stream"); +const browserify = require("browserify"); +const Vinyl = require("./vinyl"); +const { Transform } = require("stream"); +const { streamFromFile } = require("./utils"); +const { replaceContents } = require("./sourcemaps"); -module.exports = browserify; +module.exports = browserifyFile; /** * @param {import("browserify").Options} [opts] */ -function browserify(opts) { +function browserifyFile(opts) { return new Transform({ objectMode: true, /** - * @param {string | Buffer | File} input + * @param {string | Buffer | Vinyl} input */ transform(input, _, cb) { if (typeof input === "string" || Buffer.isBuffer(input)) return cb(new Error("Only Vinyl files are supported.")); try { - const sourceMap = input.sourceMap; - const cwd = input.cwd || process.cwd(); - const base = input.base || cwd; - const output = /**@type {File}*/(new Vinyl({ path: input.path, base: input.base })); - const stream = streamFromFile(input); - const b = new Browserify(Object.assign({}, opts, { debug: !!sourceMap, basedir: input.base })); - b.add(stream, { file: input.path, basedir: input.base }); - b.bundle((err, contents) => { - if (err) return cb(err); - output.contents = contents; - if (sourceMap) { - output.sourceMap = typeof sourceMap === "string" ? JSON.parse(sourceMap) : sourceMap; - const sourceRoot = output.sourceMap.sourceRoot; - makeAbsoluteSourceMap(cwd, base, output.sourceMap); - const stringContents = contents.toString("utf8"); - const newSourceMapConverter = convertMap.fromSource(stringContents); - if (newSourceMapConverter) { - const newSourceMap = newSourceMapConverter.toObject(); - makeAbsoluteSourceMap(cwd, base, newSourceMap); - applySourceMap(output, newSourceMap); - makeRelativeSourceMap(cwd, base, sourceRoot, output.sourceMap); - output.contents = new Buffer(convertMap.removeComments(stringContents), "utf8"); - } - } - cb(null, output); - }); + browserify(Object.assign({}, opts, { debug: !!input.sourceMap, basedir: input.base })) + .add(streamFromFile(input), { file: input.path, basedir: input.base }) + .bundle((err, contents) => { + if (err) return cb(err); + cb(null, replaceContents(input, contents)); + }); } catch (e) { cb(e); } } }); -} - -/** - * @param {string | undefined} cwd - * @param {string | undefined} base - * @param {RawSourceMap} sourceMap - * - * @typedef RawSourceMap - * @property {string} version - * @property {string} file - * @property {string} [sourceRoot] - * @property {string[]} sources - * @property {string[]} [sourcesContents] - * @property {string} mappings - * @property {string[]} [names] - */ -function makeAbsoluteSourceMap(cwd = process.cwd(), base = "", sourceMap) { - const sourceRoot = sourceMap.sourceRoot || ""; - const resolvedBase = path.resolve(cwd, base); - const resolvedSourceRoot = path.resolve(resolvedBase, sourceRoot); - sourceMap.file = path.resolve(resolvedBase, sourceMap.file).replace(/\\/g, "/"); - sourceMap.sources = sourceMap.sources.map(source => path.resolve(resolvedSourceRoot, source).replace(/\\/g, "/")); - sourceMap.sourceRoot = ""; -} - -/** - * @param {string | undefined} cwd - * @param {string | undefined} base - * @param {string} sourceRoot - * @param {RawSourceMap} sourceMap - */ -function makeRelativeSourceMap(cwd = process.cwd(), base = "", sourceRoot, sourceMap) { - makeAbsoluteSourceMap(cwd, base, sourceMap); - const resolvedBase = path.resolve(cwd, base); - const resolvedSourceRoot = path.resolve(resolvedBase, sourceRoot); - sourceMap.file = path.relative(resolvedBase, sourceMap.file).replace(/\\/g, "/"); - sourceMap.sources = sourceMap.sources.map(source => path.relative(resolvedSourceRoot, source).replace(/\\/g, "/")); - sourceMap.sourceRoot = sourceRoot; -} - -/** - * @param {File} file - */ -function streamFromFile(file) { - return file.isBuffer() ? streamFromBuffer(file.contents) : - file.isStream() ? file.contents : - fs.createReadStream(file.path, { autoClose: true }); -} - -/** - * @param {Buffer} buffer - */ -function streamFromBuffer(buffer) { - return new Readable({ - read() { - this.push(buffer); - this.push(null); - } - }); -} - -/** - * @typedef {import("vinyl") & { sourceMap?: any }} File - */ -void 0; \ No newline at end of file +} \ No newline at end of file diff --git a/scripts/build/cancellation.js b/scripts/build/cancellation.js new file mode 100644 index 0000000000000..793aaf19d868c --- /dev/null +++ b/scripts/build/cancellation.js @@ -0,0 +1,71 @@ +// @ts-check +const symSource = Symbol("CancelToken.source"); +const symToken = Symbol("CancelSource.token"); +const symCancellationRequested = Symbol("CancelSource.cancellationRequested"); +const symCancellationCallbacks = Symbol("CancelSource.cancellationCallbacks"); + +class CancelSource { + constructor() { + this[symCancellationRequested] = false; + this[symCancellationCallbacks] = []; + } + + /** @type {CancelToken} */ + get token() { + return this[symToken] || (this[symToken] = new CancelToken(this)); + } + + cancel() { + if (!this[symCancellationRequested]) { + this[symCancellationRequested] = true; + for (const callback of this[symCancellationCallbacks]) { + callback(); + } + } + } +} +exports.CancelSource = CancelSource; + +class CancelToken { + /** + * @param {CancelSource} source + */ + constructor(source) { + if (source[symToken]) return source[symToken]; + this[symSource] = source; + } + + /** @type {boolean} */ + get cancellationRequested() { + return this[symSource][symCancellationRequested]; + } + + /** + * @param {() => void} callback + */ + subscribe(callback) { + const source = this[symSource]; + if (source[symCancellationRequested]) { + callback(); + return; + } + + source[symCancellationCallbacks].push(callback); + + return { + unsubscribe() { + const index = source[symCancellationCallbacks].indexOf(callback); + if (index !== -1) source[symCancellationCallbacks].splice(index, 1); + } + }; + } +} +exports.CancelToken = CancelToken; + +class CancelError extends Error { + constructor(message = "Operation was canceled") { + super(message); + this.name = "CancelError"; + } +} +exports.CancelError = CancelError; \ No newline at end of file diff --git a/scripts/build/debounce.js b/scripts/build/debounce.js new file mode 100644 index 0000000000000..7020cb61bbd16 --- /dev/null +++ b/scripts/build/debounce.js @@ -0,0 +1,31 @@ +// @ts-check +module.exports = debounce; + +/** + * @param {() => void} cb + * @param {number} timeout + * @param {DebounceOptions} [opts] + * + * @typedef DebounceOptions + * @property {number} [max] + */ +function debounce(cb, timeout, opts = {}) { + if (timeout < 10) timeout = 10; + let max = opts.max || 10; + if (max < timeout) max = timeout; + let minTimer; + let maxTimer; + return trigger; + + function trigger() { + if (max > timeout && !maxTimer) maxTimer = setTimeout(done, max); + if (minTimer) clearTimeout(minTimer); + minTimer = setTimeout(done, timeout); + } + + function done() { + if (maxTimer) maxTimer = void clearTimeout(maxTimer); + if (minTimer) minTimer = void clearTimeout(minTimer); + cb(); + } +} \ No newline at end of file diff --git a/scripts/build/exec.js b/scripts/build/exec.js index ca7c6e3f6c961..04336321dd468 100644 --- a/scripts/build/exec.js +++ b/scripts/build/exec.js @@ -3,6 +3,7 @@ const cp = require("child_process"); const log = require("fancy-log"); // was `require("gulp-util").log (see https://github.com/gulpjs/gulp-util) const isWin = /^win/.test(process.platform); const chalk = require("./chalk"); +const { CancelToken, CancelError } = require("./cancellation"); module.exports = exec; @@ -10,8 +11,11 @@ module.exports = exec; * Executes the provided command once with the supplied arguments. * @param {string} cmd * @param {string[]} args - * @param {object} [options] - * @param {boolean} [options.ignoreExitCode] + * @param {ExecOptions} [options] + * + * @typedef ExecOptions + * @property {boolean} [ignoreExitCode] + * @property {CancelToken} [cancelToken] */ function exec(cmd, args, options = {}) { return /**@type {Promise<{exitCode: number}>}*/(new Promise((resolve, reject) => { @@ -20,7 +24,13 @@ function exec(cmd, args, options = {}) { const subshellFlag = isWin ? "/c" : "-c"; const command = isWin ? [possiblyQuote(cmd), ...args] : [`${cmd} ${args.join(" ")}`]; const ex = cp.spawn(isWin ? "cmd" : "/bin/sh", [subshellFlag, ...command], { stdio: "inherit", windowsVerbatimArguments: true }); + const subscription = options.cancelToken && options.cancelToken.subscribe(() => { + ex.kill("SIGINT"); + ex.kill("SIGTERM"); + reject(new CancelError()); + }); ex.on("exit", exitCode => { + subscription && subscription.unsubscribe(); if (exitCode === 0 || options.ignoreExitCode) { resolve({ exitCode }); } @@ -28,7 +38,10 @@ function exec(cmd, args, options = {}) { reject(new Error(`Process exited with code: ${exitCode}`)); } }); - ex.on("error", reject); + ex.on("error", error => { + subscription && subscription.unsubscribe(); + reject(error); + }); })); } diff --git a/scripts/build/options.js b/scripts/build/options.js index b69358f0f9874..e9e3bfb7b1bc6 100644 --- a/scripts/build/options.js +++ b/scripts/build/options.js @@ -4,7 +4,7 @@ const os = require("os"); /** @type {CommandLineOptions} */ module.exports = minimist(process.argv.slice(2), { - boolean: ["debug", "inspect", "light", "colors", "lint", "soft", "fix", "failed", "keepFailed"], + boolean: ["debug", "dirty", "inspect", "light", "colors", "lint", "lkg", "soft", "fix", "failed", "keepFailed"], string: ["browser", "tests", "host", "reporter", "stackTraceLimit", "timeout"], alias: { "b": "browser", @@ -33,17 +33,21 @@ module.exports = minimist(process.argv.slice(2), { fix: process.env.fix || process.env.f, workers: process.env.workerCount || os.cpus().length, failed: false, - keepFailed: false + keepFailed: false, + lkg: false, + dirty: false } }); /** * @typedef TypedOptions * @property {boolean} debug + * @property {boolean} dirty * @property {boolean} inspect * @property {boolean} light * @property {boolean} colors * @property {boolean} lint + * @property {boolean} lkg * @property {boolean} soft * @property {boolean} fix * @property {string} browser @@ -56,7 +60,7 @@ module.exports = minimist(process.argv.slice(2), { * @property {string|number} timeout * @property {boolean} failed * @property {boolean} keepFailed - * + * * @typedef {import("minimist").ParsedArgs & TypedOptions} CommandLineOptions */ void 0; \ No newline at end of file diff --git a/scripts/build/prepend.js b/scripts/build/prepend.js new file mode 100644 index 0000000000000..6e7b794e79bea --- /dev/null +++ b/scripts/build/prepend.js @@ -0,0 +1,66 @@ +// @ts-check +const stream = require("stream"); +const Vinyl = require("./vinyl"); +const ts = require("../../lib/typescript"); +const fs = require("fs"); +const { base64VLQFormatEncode } = require("./sourcemaps"); + +module.exports = exports = prepend; + +/** + * @param {string | ((file: Vinyl) => string)} data + */ +function prepend(data) { + return new stream.Transform({ + objectMode: true, + /** + * @param {string | Buffer | Vinyl} input + * @param {(error: Error, data?: any) => void} cb + */ + transform(input, _, cb) { + if (typeof input === "string" || Buffer.isBuffer(input)) return cb(new Error("Only Vinyl files are supported.")); + if (!input.isBuffer()) return cb(new Error("Streams not supported.")); + try { + const output = input.clone(); + const prependContent = typeof data === "function" ? data(input) : data; + output.contents = Buffer.concat([Buffer.from(prependContent, "utf8"), input.contents]); + if (input.sourceMap) { + if (typeof input.sourceMap === "string") input.sourceMap = /**@type {import("./sourcemaps").RawSourceMap}*/(JSON.parse(input.sourceMap)); + const lineStarts = /**@type {*}*/(ts).computeLineStarts(prependContent); + let prependMappings = ""; + for (let i = 1; i < lineStarts.length; i++) { + prependMappings += ";"; + } + const offset = prependContent.length - lineStarts[lineStarts.length - 1]; + if (offset > 0) { + prependMappings += base64VLQFormatEncode(offset) + ","; + } + output.sourceMap = { + version: input.sourceMap.version, + file: input.sourceMap.file, + sources: input.sourceMap.sources, + sourceRoot: input.sourceMap.sourceRoot, + mappings: prependMappings + input.sourceMap.mappings, + names: input.names, + sourcesContent: input.sourcesContent + }; + } + return cb(null, output); + } + catch (e) { + return cb(e); + } + } + }) +} +exports.prepend = prepend; + +/** + * @param {string | ((file: Vinyl) => string)} file + */ +function prependFile(file) { + const data = typeof file === "string" ? fs.readFileSync(file, "utf8") : + vinyl => fs.readFileSync(file(vinyl), "utf8"); + return prepend(data) +} +exports.file = prependFile; \ No newline at end of file diff --git a/scripts/build/project.js b/scripts/build/project.js index 35b500d749a9c..933f7c44c65fc 100644 --- a/scripts/build/project.js +++ b/scripts/build/project.js @@ -209,6 +209,27 @@ function flatten(projectSpec, flattenedProjectSpec, options = {}) { } exports.flatten = flatten; +/** + * Returns a Promise that resolves when all pending build tasks have completed + */ +function wait() { + return new Promise(resolve => { + if (compilationGulp.allDone()) { + resolve(); + } + else { + const onDone = () => { + compilationGulp.removeListener("onDone", onDone); + compilationGulp.removeListener("err", onDone); + resolve(); + }; + compilationGulp.on("stop", onDone); + compilationGulp.on("err", onDone); + } + }); +} +exports.wait = wait; + /** * Resolve a TypeScript specifier into a fully-qualified module specifier and any requisite dependencies. * @param {string} typescript An unresolved module specifier to a TypeScript version. diff --git a/scripts/build/sourcemaps.js b/scripts/build/sourcemaps.js new file mode 100644 index 0000000000000..62e9a6639ca04 --- /dev/null +++ b/scripts/build/sourcemaps.js @@ -0,0 +1,131 @@ +// @ts-check +const path = require("path"); +const Vinyl = require("./vinyl"); +const convertMap = require("convert-source-map"); +const applySourceMap = require("vinyl-sourcemaps-apply"); + +/** + * @param {Vinyl} input + * @param {string | Buffer} contents + * @param {string | RawSourceMap} [sourceMap] + */ +function replaceContents(input, contents, sourceMap) { + const output = input.clone(); + output.contents = typeof contents === "string" ? Buffer.from(contents, "utf8") : contents; + if (input.sourceMap) { + output.sourceMap = typeof input.sourceMap === "string" ? /**@type {RawSourceMap}*/(JSON.parse(input.sourceMap)) : input.sourceMap; + if (typeof sourceMap === "string") { + sourceMap = /**@type {RawSourceMap}*/(JSON.parse(sourceMap)); + } + else if (sourceMap === undefined) { + const stringContents = typeof contents === "string" ? contents : contents.toString("utf8"); + const newSourceMapConverter = convertMap.fromSource(stringContents); + if (newSourceMapConverter) { + sourceMap = /**@type {RawSourceMap}*/(newSourceMapConverter.toObject()); + output.contents = new Buffer(convertMap.removeComments(stringContents), "utf8"); + } + } + if (sourceMap) { + const cwd = input.cwd || process.cwd(); + const base = input.base || cwd; + const sourceRoot = output.sourceMap.sourceRoot; + makeAbsoluteSourceMap(cwd, base, output.sourceMap); + makeAbsoluteSourceMap(cwd, base, sourceMap); + applySourceMap(output, sourceMap); + makeRelativeSourceMap(cwd, base, sourceRoot, output.sourceMap); + } + else { + output.sourceMap = undefined; + } + } + return output; +} +exports.replaceContents = replaceContents; + +/** + * @param {string | undefined} cwd + * @param {string | undefined} base + * @param {RawSourceMap} sourceMap + * + * @typedef RawSourceMap + * @property {string} version + * @property {string} file + * @property {string} [sourceRoot] + * @property {string[]} sources + * @property {string[]} [sourcesContent] + * @property {string} mappings + * @property {string[]} [names] + */ +function makeAbsoluteSourceMap(cwd = process.cwd(), base = "", sourceMap) { + const sourceRoot = sourceMap.sourceRoot || ""; + const resolvedBase = path.resolve(cwd, base); + const resolvedSourceRoot = path.resolve(resolvedBase, sourceRoot); + sourceMap.file = path.resolve(resolvedBase, sourceMap.file).replace(/\\/g, "/"); + sourceMap.sources = sourceMap.sources.map(source => path.resolve(resolvedSourceRoot, source).replace(/\\/g, "/")); + sourceMap.sourceRoot = ""; +} +exports.makeAbsoluteSourceMap = makeAbsoluteSourceMap; + +/** + * @param {string | undefined} cwd + * @param {string | undefined} base + * @param {string} sourceRoot + * @param {RawSourceMap} sourceMap + */ +function makeRelativeSourceMap(cwd = process.cwd(), base = "", sourceRoot, sourceMap) { + makeAbsoluteSourceMap(cwd, base, sourceMap); + const resolvedBase = path.resolve(cwd, base); + const resolvedSourceRoot = path.resolve(resolvedBase, sourceRoot); + sourceMap.file = path.relative(resolvedBase, sourceMap.file).replace(/\\/g, "/"); + sourceMap.sources = sourceMap.sources.map(source => path.relative(resolvedSourceRoot, source).replace(/\\/g, "/")); + sourceMap.sourceRoot = sourceRoot; +} +exports.makeRelativeSourceMap = makeRelativeSourceMap; + +/** + * @param {string} message + * @returns {never} + */ +function fail(message) { + throw new Error(message); +} + +/** + * @param {number} value + */ +function base64FormatEncode(value) { + return value < 0 ? fail("Invalid value") : + value < 26 ? 0x41 /*A*/ + value : + value < 52 ? 0x61 /*a*/ + value - 26 : + value < 62 ? 0x30 /*0*/ + value - 52 : + value === 62 ? 0x2B /*+*/ : + value === 63 ? 0x2F /*/*/ : + fail("Invalid value"); +} + +/** + * @param {number} value + */ +function base64VLQFormatEncode(value) { + if (value < 0) { + value = ((-value) << 1) + 1; + } + else { + value = value << 1; + } + + // Encode 5 bits at a time starting from least significant bits + let result = ""; + do { + let currentDigit = value & 31; // 11111 + value = value >> 5; + if (value > 0) { + // There are still more digits to decode, set the msb (6th bit) + currentDigit = currentDigit | 32; + } + result += String.fromCharCode(base64FormatEncode(currentDigit)); + } while (value > 0); + + return result; +} +exports.base64VLQFormatEncode = base64VLQFormatEncode; \ No newline at end of file diff --git a/scripts/build/tests.js b/scripts/build/tests.js index 36615149d701c..d631f1e35acc5 100644 --- a/scripts/build/tests.js +++ b/scripts/build/tests.js @@ -1,4 +1,5 @@ // @ts-check +const gulp = require("./gulp"); const del = require("del"); const fs = require("fs"); const os = require("os"); @@ -6,13 +7,8 @@ const path = require("path"); const mkdirP = require("./mkdirp"); const cmdLineOptions = require("./options"); const exec = require("./exec"); -const runSequence = require("run-sequence"); -const finished = require("./finished"); const log = require("fancy-log"); // was `require("gulp-util").log (see https://github.com/gulpjs/gulp-util) - -const nodeModulesPathPrefix = path.resolve("./node_modules/.bin/"); -const isWin = /^win/.test(process.platform); -const mocha = path.join(nodeModulesPathPrefix, "mocha") + (isWin ? ".cmd" : ""); +const mochaJs = require.resolve("mocha/bin/_mocha"); exports.localBaseline = "tests/baselines/local/"; exports.refBaseline = "tests/baselines/reference/"; @@ -24,8 +20,10 @@ exports.localTest262Baseline = "internal/baselines/test262/local"; * @param {string} runJs * @param {string} defaultReporter * @param {boolean} runInParallel + * @param {boolean} watchMode + * @param {InstanceType} [cancelToken] */ -function runConsoleTests(runJs, defaultReporter, runInParallel) { +async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode, cancelToken) { let testTimeout = cmdLineOptions.timeout; let tests = cmdLineOptions.tests; const lintFlag = cmdLineOptions.lint; @@ -36,112 +34,116 @@ function runConsoleTests(runJs, defaultReporter, runInParallel) { const stackTraceLimit = cmdLineOptions.stackTraceLimit; const testConfigFile = "test.config"; const failed = cmdLineOptions.failed; - const keepFailed = cmdLineOptions.keepFailed || failed; - return cleanTestDirs() - .then(() => { - if (fs.existsSync(testConfigFile)) { - fs.unlinkSync(testConfigFile); - } - - let workerCount, taskConfigsFolder; - if (runInParallel) { - // generate name to store task configuration files - const prefix = os.tmpdir() + "/ts-tests"; - let i = 1; - do { - taskConfigsFolder = prefix + i; - i++; - } while (fs.existsSync(taskConfigsFolder)); - fs.mkdirSync(taskConfigsFolder); - - workerCount = cmdLineOptions.workers; - } - - if (tests && tests.toLocaleLowerCase() === "rwc") { - testTimeout = 400000; - } - - if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed) { - writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed); - } - - const colors = cmdLineOptions.colors; - const reporter = cmdLineOptions.reporter || defaultReporter; - - /** @type {string} */ - let host = "node"; - - /** @type {string[]} */ - let args = []; - - // timeout normally isn"t necessary but Travis-CI has been timing out on compiler baselines occasionally - // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer - if (!runInParallel) { - args.push("-R", "scripts/failed-tests"); - args.push("-O", '"reporter=' + reporter + (keepFailed ? ",keepFailed=true" : "") + '"'); - if (tests) { - args.push("-g", `"${tests}"`); - } - if (colors) { - args.push("--colors"); - } - else { - args.push("--no-colors"); - } - if (inspect) { - args.unshift("--inspect-brk"); - } - else if (debug) { - args.unshift("--debug-brk"); - } - else { - args.push("-t", "" + testTimeout); - } - args.push(runJs); - host = mocha; - } - else { - // run task to load all tests and partition them between workers - host = "node"; - args.push(runJs); - } - setNodeEnvToDevelopment(); - if (failed) { - return exec(host, ["scripts/run-failed-tests.js"].concat(args)); - } - else { - return exec(host, args); - } - }) - .then(({ exitCode }) => { - if (exitCode !== 0) return finish(undefined, exitCode); - if (lintFlag) return finished(runSequence("lint")).then(() => finish(), finish); - return finish(); - }, finish); - - /** - * @param {any=} error - * @param {number=} errorStatus - */ - function finish(error, errorStatus) { + const keepFailed = cmdLineOptions.keepFailed; + if (!cmdLineOptions.dirty) { + await cleanTestDirs(); + } + + if (fs.existsSync(testConfigFile)) { + fs.unlinkSync(testConfigFile); + } + + let workerCount, taskConfigsFolder; + if (runInParallel) { + // generate name to store task configuration files + const prefix = os.tmpdir() + "/ts-tests"; + let i = 1; + do { + taskConfigsFolder = prefix + i; + i++; + } while (fs.existsSync(taskConfigsFolder)); + fs.mkdirSync(taskConfigsFolder); + + workerCount = cmdLineOptions.workers; + } + + if (tests && tests.toLocaleLowerCase() === "rwc") { + testTimeout = 400000; + } + + if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed) { + writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed); + } + + const colors = cmdLineOptions.colors; + const reporter = cmdLineOptions.reporter || defaultReporter; + + /** @type {string[]} */ + let args = []; + + // timeout normally isn"t necessary but Travis-CI has been timing out on compiler baselines occasionally + // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer + if (!runInParallel) { + args.push(failed ? "scripts/run-failed-tests.js" : mochaJs); + args.push("-R", "scripts/failed-tests"); + args.push("-O", '"reporter=' + reporter + (keepFailed ? ",keepFailed=true" : "") + '"'); + if (tests) { + args.push("-g", `"${tests}"`); + } + if (colors) { + args.push("--colors"); + } + else { + args.push("--no-colors"); + } + if (inspect) { + args.unshift("--inspect-brk"); + } + else if (debug) { + args.unshift("--debug-brk"); + } + else { + args.push("-t", "" + testTimeout); + } + args.push(runJs); + } + else { + // run task to load all tests and partition them between workers + args.push(runJs); + } + + /** @type {number | undefined} */ + let errorStatus; + + /** @type {Error | undefined} */ + let error; + + try { + setNodeEnvToDevelopment(); + const { exitCode } = await exec("node", args, { cancelToken }); + if (exitCode !== 0) { + errorStatus = exitCode; + error = new Error(`Process exited with status code ${errorStatus}.`); + } + else if (lintFlag) { + await new Promise((resolve, reject) => gulp.start(["lint"], error => error ? reject(error) : resolve())); + } + } + catch (e) { + errorStatus = undefined; + error = e; + } + finally { restoreSavedNodeEnv(); - return deleteTestConfig() - .then(deleteTemporaryProjectOutput) - .then(() => { - if (error !== undefined || errorStatus !== undefined) { - process.exit(typeof errorStatus === "number" ? errorStatus : 2); - } - }); } - function deleteTestConfig() { - return del("test.config"); + await del("test.config"); + await deleteTemporaryProjectOutput(); + + if (error !== undefined) { + if (watchMode) { + throw error; + } + else { + log.error(error); + process.exit(typeof errorStatus === "number" ? errorStatus : 2); + } } } exports.runConsoleTests = runConsoleTests; function cleanTestDirs() { - return del([exports.localBaseline, exports.localRwcBaseline,]) + return del([exports.localBaseline, exports.localRwcBaseline]) .then(() => mkdirP(exports.localRwcBaseline)) .then(() => mkdirP(exports.localBaseline)); } diff --git a/scripts/build/utils.js b/scripts/build/utils.js new file mode 100644 index 0000000000000..06f55d7288ac3 --- /dev/null +++ b/scripts/build/utils.js @@ -0,0 +1,27 @@ +// @ts-check +const fs = require("fs"); +const File = require("./vinyl"); +const { Readable } = require("stream"); + +/** + * @param {File} file + */ +function streamFromFile(file) { + return file.isBuffer() ? streamFromBuffer(file.contents) : + file.isStream() ? file.contents : + fs.createReadStream(file.path, { autoClose: true }); +} +exports.streamFromFile = streamFromFile; + +/** + * @param {Buffer} buffer + */ +function streamFromBuffer(buffer) { + return new Readable({ + read() { + this.push(buffer); + this.push(null); + } + }); +} +exports.streamFromBuffer = streamFromBuffer; \ No newline at end of file diff --git a/scripts/build/vinyl.d.ts b/scripts/build/vinyl.d.ts new file mode 100644 index 0000000000000..1dfb631499194 --- /dev/null +++ b/scripts/build/vinyl.d.ts @@ -0,0 +1,60 @@ +// NOTE: This makes it possible to correctly type vinyl Files under @ts-check. +export = File; + +declare class File { + constructor(options?: File.VinylOptions); + + cwd: string; + base: string; + path: string; + readonly history: ReadonlyArray; + contents: T; + relative: string; + dirname: string; + basename: string; + stem: string; + extname: string; + symlink: string | null; + stat: import("fs").Stats | null; + sourceMap?: import("./sourcemaps").RawSourceMap | string; + + [custom: string]: any; + + isBuffer(): this is T extends Buffer ? File : never; + isStream(): this is T extends NodeJS.ReadableStream ? File : never; + isNull(): this is T extends null ? File : never; + isDirectory(): this is T extends null ? File.Directory : never; + isSymbolic(): this is T extends null ? File.Symbolic : never; + clone(opts?: { contents?: boolean, deep?: boolean }): this; +} + +namespace File { + export interface VinylOptions { + cwd?: string; + base?: string; + path?: string; + history?: ReadonlyArray; + stat?: import("fs").Stats; + contents?: T; + sourceMap?: import("./sourcemaps").RawSourceMap | string; + [custom: string]: any; + } + + export type Contents = Buffer | NodeJS.ReadableStream | null; + export type File = import("./vinyl"); + export type NullFile = File; + export type BufferFile = File; + export type StreamFile = File; + + export interface Directory extends NullFile { + isNull(): true; + isDirectory(): true; + isSymbolic(): this is never; + } + + export interface Symbolic extends NullFile { + isNull(): true; + isDirectory(): this is never; + isSymbolic(): true; + } +} \ No newline at end of file diff --git a/scripts/build/vinyl.js b/scripts/build/vinyl.js new file mode 100644 index 0000000000000..6cf68f3cd26ce --- /dev/null +++ b/scripts/build/vinyl.js @@ -0,0 +1 @@ +module.exports = require("vinyl"); \ No newline at end of file diff --git a/scripts/failed-tests.js b/scripts/failed-tests.js index ca26c43294842..d0e3e08672546 100644 --- a/scripts/failed-tests.js +++ b/scripts/failed-tests.js @@ -4,9 +4,11 @@ const path = require("path"); const fs = require("fs"); const os = require("os"); +const failingHookRegExp = /^(.*) "(before|after) (all|each)" hook$/; + /** * .failed-tests reporter - * + * * @typedef {Object} ReporterOptions * @property {string} [file] * @property {boolean} [keepFailed] @@ -15,7 +17,7 @@ const os = require("os"); */ class FailedTestsReporter extends Mocha.reporters.Base { /** - * @param {Mocha.Runner} runner + * @param {Mocha.Runner} runner * @param {{ reporterOptions?: ReporterOptions }} [options] */ constructor(runner, options) { @@ -49,35 +51,58 @@ class FailedTestsReporter extends Mocha.reporters.Base { /** @type {Mocha.Test[]} */ this.passes = []; - - /** @type {Mocha.Test[]} */ + + /** @type {(Mocha.Test)[]} */ this.failures = []; - + runner.on("pass", test => this.passes.push(test)); runner.on("fail", test => this.failures.push(test)); } /** - * @param {string} file - * @param {ReadonlyArray} passes - * @param {ReadonlyArray} failures - * @param {boolean} keepFailed - * @param {(err?: NodeJS.ErrnoException) => void} done + * @param {string} file + * @param {ReadonlyArray} passes + * @param {ReadonlyArray} failures + * @param {boolean} keepFailed + * @param {(err?: NodeJS.ErrnoException) => void} done */ static writeFailures(file, passes, failures, keepFailed, done) { const failingTests = new Set(fs.existsSync(file) ? readTests() : undefined); - if (failingTests.size > 0) { + const possiblyPassingSuites = /**@type {Set}*/(new Set()); + + // Remove tests that are now passing and track suites that are now + // possibly passing. + if (failingTests.size > 0 && !keepFailed) { for (const test of passes) { - const title = test.fullTitle().trim(); - if (title) failingTests.delete(title); + failingTests.delete(test.fullTitle().trim()); + possiblyPassingSuites.add(test.parent.fullTitle().trim()); } } + + // Add tests that are now failing. If a hook failed, track its + // containing suite as failing. If the suite for a test or hook was + // possibly passing then it is now definitely failing. for (const test of failures) { - const title = test.fullTitle().trim(); - if (title) failingTests.add(title); + const suiteTitle = test.parent.fullTitle().trim(); + if (test.type === "test") { + failingTests.add(test.fullTitle().trim()); + } + else { + failingTests.add(suiteTitle); + } + possiblyPassingSuites.delete(suiteTitle); } + + // Remove all definitely passing suites. + for (const suite of possiblyPassingSuites) { + failingTests.delete(suite); + } + if (failingTests.size > 0) { - const failed = Array.from(failingTests).join(os.EOL); + const failed = Array + .from(failingTests) + .sort() + .join(os.EOL); fs.writeFile(file, failed, "utf8", done); } else if (!keepFailed) { @@ -96,7 +121,7 @@ class FailedTestsReporter extends Mocha.reporters.Base { } /** - * @param {number} failures + * @param {number} failures * @param {(failures: number) => void} [fn] */ done(failures, fn) { diff --git a/scripts/run-failed-tests.js b/scripts/run-failed-tests.js index 876c4a34eec8d..bde06df11cb0e 100644 --- a/scripts/run-failed-tests.js +++ b/scripts/run-failed-tests.js @@ -69,7 +69,12 @@ const proc = spawn(process.execPath, args, { proc.on('exit', (code, signal) => { process.on('exit', () => { if (grepFile) { - fs.unlinkSync(grepFile); + try { + fs.unlinkSync(grepFile); + } + catch (e) { + if (e.code !== "ENOENT") throw e; + } } if (signal) { diff --git a/src/jsTyping/types.ts b/src/jsTyping/types.ts index dfa47ccd7def8..4e00c2eb6f5e4 100644 --- a/src/jsTyping/types.ts +++ b/src/jsTyping/types.ts @@ -1,4 +1,3 @@ -/* @internal */ declare namespace ts.server { export type ActionSet = "action::set"; export type ActionInvalidate = "action::invalidate"; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 89214bdb96c2c..bf4d44c982af0 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1,3 +1,17 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ declare namespace ts { const versionMajorMinor = "3.0"; @@ -46,525 +60,6 @@ declare namespace ts { interface Push { push(...values: T[]): void; } - type EqualityComparer = (a: T, b: T) => boolean; - type Comparer = (a: T, b: T) => Comparison; - enum Comparison { - LessThan = -1, - EqualTo = 0, - GreaterThan = 1 - } -} -declare namespace ts { - /** Create a new map. If a template object is provided, the map will copy entries from it. */ - function createMap(): Map; - function createMapFromEntries(entries: [string, T][]): Map; - function createMapFromTemplate(template: MapLike): Map; - const MapCtr: new () => Map; - function length(array: ReadonlyArray | undefined): number; - /** - * Iterates through 'array' by index and performs the callback on each element of array until the callback - * returns a truthy value, then returns that value. - * If no such value is found, the callback is applied to each element of array and undefined is returned. - */ - function forEach(array: ReadonlyArray | undefined, callback: (element: T, index: number) => U | undefined): U | undefined; - /** Like `forEach`, but suitable for use with numbers and strings (which may be falsy). */ - function firstDefined(array: ReadonlyArray | undefined, callback: (element: T, index: number) => U | undefined): U | undefined; - function firstDefinedIterator(iter: Iterator, callback: (element: T) => U | undefined): U | undefined; - function zipWith(arrayA: ReadonlyArray, arrayB: ReadonlyArray, callback: (a: T, b: U, index: number) => V): V[]; - function zipToIterator(arrayA: ReadonlyArray, arrayB: ReadonlyArray): Iterator<[T, U]>; - function zipToMap(keys: ReadonlyArray, values: ReadonlyArray): Map; - /** - * Iterates through `array` by index and performs the callback on each element of array until the callback - * returns a falsey value, then returns false. - * If no such value is found, the callback is applied to each element of array and `true` is returned. - */ - function every(array: ReadonlyArray, callback: (element: T, index: number) => boolean): boolean; - /** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */ - function find(array: ReadonlyArray, predicate: (element: T, index: number) => element is U): U | undefined; - function find(array: ReadonlyArray, predicate: (element: T, index: number) => boolean): T | undefined; - function findLast(array: ReadonlyArray, predicate: (element: T, index: number) => element is U): U | undefined; - function findLast(array: ReadonlyArray, predicate: (element: T, index: number) => boolean): T | undefined; - /** Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found. */ - function findIndex(array: ReadonlyArray, predicate: (element: T, index: number) => boolean, startIndex?: number): number; - function findLastIndex(array: ReadonlyArray, predicate: (element: T, index: number) => boolean, startIndex?: number): number; - /** - * Returns the first truthy result of `callback`, or else fails. - * This is like `forEach`, but never returns undefined. - */ - function findMap(array: ReadonlyArray, callback: (element: T, index: number) => U | undefined): U; - function contains(array: ReadonlyArray | undefined, value: T, equalityComparer?: EqualityComparer): boolean; - function arraysEqual(a: ReadonlyArray, b: ReadonlyArray, equalityComparer?: EqualityComparer): boolean; - function indexOfAnyCharCode(text: string, charCodes: ReadonlyArray, start?: number): number; - function countWhere(array: ReadonlyArray, predicate: (x: T, i: number) => boolean): number; - /** - * Filters an array by a predicate function. Returns the same array instance if the predicate is - * true for all elements, otherwise returns a new array instance containing the filtered subset. - */ - function filter(array: T[], f: (x: T) => x is U): U[]; - function filter(array: T[], f: (x: T) => boolean): T[]; - function filter(array: ReadonlyArray, f: (x: T) => x is U): ReadonlyArray; - function filter(array: ReadonlyArray, f: (x: T) => boolean): ReadonlyArray; - function filter(array: T[] | undefined, f: (x: T) => x is U): U[] | undefined; - function filter(array: T[] | undefined, f: (x: T) => boolean): T[] | undefined; - function filter(array: ReadonlyArray | undefined, f: (x: T) => x is U): ReadonlyArray | undefined; - function filter(array: ReadonlyArray | undefined, f: (x: T) => boolean): ReadonlyArray | undefined; - function filterMutate(array: T[], f: (x: T, i: number, array: T[]) => boolean): void; - function clear(array: {}[]): void; - function map(array: ReadonlyArray, f: (x: T, i: number) => U): U[]; - function map(array: ReadonlyArray | undefined, f: (x: T, i: number) => U): U[] | undefined; - function mapIterator(iter: Iterator, mapFn: (x: T) => U): Iterator; - function sameMap(array: T[], f: (x: T, i: number) => T): T[]; - function sameMap(array: ReadonlyArray, f: (x: T, i: number) => T): ReadonlyArray; - function sameMap(array: T[] | undefined, f: (x: T, i: number) => T): T[] | undefined; - function sameMap(array: ReadonlyArray | undefined, f: (x: T, i: number) => T): ReadonlyArray | undefined; - /** - * Flattens an array containing a mix of array or non-array elements. - * - * @param array The array to flatten. - */ - function flatten(array: ReadonlyArray | undefined>): T[]; - function flatten(array: ReadonlyArray | undefined> | undefined): T[] | undefined; - /** - * Maps an array. If the mapped value is an array, it is spread into the result. - * - * @param array The array to map. - * @param mapfn The callback used to map the result into one or more values. - */ - function flatMap(array: ReadonlyArray, mapfn: (x: T, i: number) => U | ReadonlyArray | undefined): U[]; - function flatMap(array: ReadonlyArray | undefined, mapfn: (x: T, i: number) => U | ReadonlyArray | undefined): U[] | undefined; - function flatMapIterator(iter: Iterator, mapfn: (x: T) => U[] | Iterator | undefined): Iterator; - /** - * Maps an array. If the mapped value is an array, it is spread into the result. - * Avoids allocation if all elements map to themselves. - * - * @param array The array to map. - * @param mapfn The callback used to map the result into one or more values. - */ - function sameFlatMap(array: T[], mapfn: (x: T, i: number) => T | ReadonlyArray): T[]; - function sameFlatMap(array: ReadonlyArray, mapfn: (x: T, i: number) => T | ReadonlyArray): ReadonlyArray; - function mapAllOrFail(array: ReadonlyArray, mapFn: (x: T, i: number) => U | undefined): U[] | undefined; - function mapDefined(array: ReadonlyArray | undefined, mapFn: (x: T, i: number) => U | undefined): U[]; - function mapDefinedIterator(iter: Iterator, mapFn: (x: T) => U | undefined): Iterator; - const emptyIterator: Iterator; - function singleIterator(value: T): Iterator; - /** - * Maps contiguous spans of values with the same key. - * - * @param array The array to map. - * @param keyfn A callback used to select the key for an element. - * @param mapfn A callback used to map a contiguous chunk of values to a single value. - */ - function spanMap(array: ReadonlyArray, keyfn: (x: T, i: number) => K, mapfn: (chunk: T[], key: K, start: number, end: number) => U): U[]; - function spanMap(array: ReadonlyArray | undefined, keyfn: (x: T, i: number) => K, mapfn: (chunk: T[], key: K, start: number, end: number) => U): U[] | undefined; - function mapEntries(map: ReadonlyMap, f: (key: string, value: T) => [string, U]): Map; - function mapEntries(map: ReadonlyMap | undefined, f: (key: string, value: T) => [string, U]): Map | undefined; - function some(array: ReadonlyArray | undefined): array is ReadonlyArray; - function some(array: ReadonlyArray | undefined, predicate: (value: T) => boolean): boolean; - /** Calls the callback with (start, afterEnd) index pairs for each range where 'pred' is true. */ - function getRangesWhere(arr: ReadonlyArray, pred: (t: T) => boolean, cb: (start: number, afterEnd: number) => void): void; - function concatenate(array1: T[], array2: T[]): T[]; - function concatenate(array1: ReadonlyArray, array2: ReadonlyArray): ReadonlyArray; - function concatenate(array1: T[] | undefined, array2: T[] | undefined): T[]; - function concatenate(array1: ReadonlyArray | undefined, array2: ReadonlyArray | undefined): ReadonlyArray; - /** - * Deduplicates an unsorted array. - * @param equalityComparer An optional `EqualityComparer` used to determine if two values are duplicates. - * @param comparer An optional `Comparer` used to sort entries before comparison, though the - * result will remain in the original order in `array`. - */ - function deduplicate(array: ReadonlyArray, equalityComparer?: EqualityComparer, comparer?: Comparer): T[]; - function deduplicate(array: ReadonlyArray | undefined, equalityComparer?: EqualityComparer, comparer?: Comparer): T[] | undefined; - function insertSorted(array: SortedArray, insert: T, compare: Comparer): void; - function sortAndDeduplicate(array: ReadonlyArray, comparer: Comparer, equalityComparer?: EqualityComparer): T[]; - function arrayIsEqualTo(array1: ReadonlyArray | undefined, array2: ReadonlyArray | undefined, equalityComparer?: (a: T, b: T) => boolean): boolean; - /** - * Compacts an array, removing any falsey elements. - */ - function compact(array: T[]): T[]; - function compact(array: ReadonlyArray): ReadonlyArray; - /** - * Gets the relative complement of `arrayA` with respect to `arrayB`, returning the elements that - * are not present in `arrayA` but are present in `arrayB`. Assumes both arrays are sorted - * based on the provided comparer. - */ - function relativeComplement(arrayA: T[] | undefined, arrayB: T[] | undefined, comparer: Comparer): T[] | undefined; - function sum, K extends string>(array: ReadonlyArray, prop: K): number; - /** - * Appends a value to an array, returning the array. - * - * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array - * is created if `value` was appended. - * @param value The value to append to the array. If `value` is `undefined`, nothing is - * appended. - */ - function append(to: T[], value: T | undefined): T[]; - function append(to: T[] | undefined, value: T): T[]; - function append(to: T[] | undefined, value: T | undefined): T[] | undefined; - function append(to: Push, value: T | undefined): void; - /** - * Appends a range of value to an array, returning the array. - * - * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array - * is created if `value` was appended. - * @param from The values to append to the array. If `from` is `undefined`, nothing is - * appended. If an element of `from` is `undefined`, that element is not appended. - * @param start The offset in `from` at which to start copying values. - * @param end The offset in `from` at which to stop copying values (non-inclusive). - */ - function addRange(to: T[], from: ReadonlyArray | undefined, start?: number, end?: number): T[]; - function addRange(to: T[] | undefined, from: ReadonlyArray | undefined, start?: number, end?: number): T[] | undefined; - /** - * @return Whether the value was added. - */ - function pushIfUnique(array: T[], toAdd: T, equalityComparer?: EqualityComparer): boolean; - /** - * Unlike `pushIfUnique`, this can take `undefined` as an input, and returns a new array. - */ - function appendIfUnique(array: T[] | undefined, toAdd: T, equalityComparer?: EqualityComparer): T[]; - /** - * Returns a new sorted array. - */ - function sort(array: ReadonlyArray, comparer: Comparer): T[]; - function arrayIterator(array: ReadonlyArray): Iterator; - /** - * Stable sort of an array. Elements equal to each other maintain their relative position in the array. - */ - function stableSort(array: ReadonlyArray, comparer: Comparer): T[]; - function rangeEquals(array1: ReadonlyArray, array2: ReadonlyArray, pos: number, end: number): boolean; - /** - * Returns the element at a specific offset in an array if non-empty, `undefined` otherwise. - * A negative offset indicates the element should be retrieved from the end of the array. - */ - function elementAt(array: ReadonlyArray | undefined, offset: number): T | undefined; - /** - * Returns the first element of an array if non-empty, `undefined` otherwise. - */ - function firstOrUndefined(array: ReadonlyArray): T | undefined; - function first(array: ReadonlyArray): T; - /** - * Returns the last element of an array if non-empty, `undefined` otherwise. - */ - function lastOrUndefined(array: ReadonlyArray): T | undefined; - function last(array: ReadonlyArray): T; - /** - * Returns the only element of an array if it contains only one element, `undefined` otherwise. - */ - function singleOrUndefined(array: ReadonlyArray | undefined): T | undefined; - /** - * Returns the only element of an array if it contains only one element; otheriwse, returns the - * array. - */ - function singleOrMany(array: T[]): T | T[]; - function singleOrMany(array: ReadonlyArray): T | ReadonlyArray; - function singleOrMany(array: T[] | undefined): T | T[] | undefined; - function singleOrMany(array: ReadonlyArray | undefined): T | ReadonlyArray | undefined; - function replaceElement(array: ReadonlyArray, index: number, value: T): T[]; - /** - * Performs a binary search, finding the index at which `value` occurs in `array`. - * If no such index is found, returns the 2's-complement of first index at which - * `array[index]` exceeds `value`. - * @param array A sorted array whose first element must be no larger than number - * @param value The value to be searched for in the array. - * @param keySelector A callback used to select the search key from `value` and each element of - * `array`. - * @param keyComparer A callback used to compare two keys in a sorted array. - * @param offset An offset into `array` at which to start the search. - */ - function binarySearch(array: ReadonlyArray, value: T, keySelector: (v: T) => U, keyComparer: Comparer, offset?: number): number; - function reduceLeft(array: ReadonlyArray | undefined, f: (memo: U, value: T, i: number) => U, initial: U, start?: number, count?: number): U; - function reduceLeft(array: ReadonlyArray, f: (memo: T, value: T, i: number) => T): T | undefined; - /** - * Indicates whether a map-like contains an own property with the specified key. - * - * @param map A map-like. - * @param key A property key. - */ - function hasProperty(map: MapLike, key: string): boolean; - /** - * Gets the value of an owned property in a map-like. - * - * @param map A map-like. - * @param key A property key. - */ - function getProperty(map: MapLike, key: string): T | undefined; - /** - * Gets the owned, enumerable property keys of a map-like. - */ - function getOwnKeys(map: MapLike): string[]; - function getOwnValues(sparseArray: T[]): T[]; - /** Shims `Array.from`. */ - function arrayFrom(iterator: Iterator, map: (t: T) => U): U[]; - function arrayFrom(iterator: Iterator): T[]; - function assign(t: T, ...args: (T | undefined)[]): T; - /** - * Performs a shallow equality comparison of the contents of two map-likes. - * - * @param left A map-like whose properties should be compared. - * @param right A map-like whose properties should be compared. - */ - function equalOwnProperties(left: MapLike | undefined, right: MapLike | undefined, equalityComparer?: EqualityComparer): boolean; - /** - * Creates a map from the elements of an array. - * - * @param array the array of input elements. - * @param makeKey a function that produces a key for a given element. - * - * This function makes no effort to avoid collisions; if any two elements produce - * the same key with the given 'makeKey' function, then the element with the higher - * index in the array will be the one associated with the produced key. - */ - function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string | undefined): Map; - function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string | undefined, makeValue: (value: T) => U): Map; - function arrayToNumericMap(array: ReadonlyArray, makeKey: (value: T) => number): T[]; - function arrayToNumericMap(array: ReadonlyArray, makeKey: (value: T) => number, makeValue: (value: T) => U): U[]; - function arrayToMultiMap(values: ReadonlyArray, makeKey: (value: T) => string): MultiMap; - function arrayToMultiMap(values: ReadonlyArray, makeKey: (value: T) => string, makeValue: (value: T) => U): MultiMap; - function group(values: ReadonlyArray, getGroupId: (value: T) => string): ReadonlyArray>; - function clone(object: T): T; - function extend(first: T1, second: T2): T1 & T2; - interface MultiMap extends Map { - /** - * Adds the value to an array of values associated with the key, and returns the array. - * Creates the array if it does not already exist. - */ - add(key: string, value: T): T[]; - /** - * Removes a value from an array of values associated with the key. - * Does not preserve the order of those values. - * Does nothing if `key` is not in `map`, or `value` is not in `map[key]`. - */ - remove(key: string, value: T): void; - } - function createMultiMap(): MultiMap; - /** - * Tests whether a value is an array. - */ - function isArray(value: any): value is ReadonlyArray<{}>; - function toArray(value: T | T[]): T[]; - function toArray(value: T | ReadonlyArray): ReadonlyArray; - /** - * Tests whether a value is string - */ - function isString(text: any): text is string; - function tryCast(value: TIn | undefined, test: (value: TIn) => value is TOut): TOut | undefined; - function cast(value: TIn | undefined, test: (value: TIn) => value is TOut): TOut; - /** Does nothing. */ - function noop(_?: {} | null | undefined): void; - /** Do nothing and return false */ - function returnFalse(): false; - /** Do nothing and return true */ - function returnTrue(): true; - /** Returns its argument. */ - function identity(x: T): T; - /** Returns lower case string */ - function toLowerCase(x: string): string; - /** Throws an error because a function is not implemented. */ - function notImplemented(): never; - function memoize(callback: () => T): () => T; - /** - * High-order function, creates a function that executes a function composition. - * For example, `chain(a, b)` is the equivalent of `x => ((a', b') => y => b'(a'(y)))(a(x), b(x))` - * - * @param args The functions to chain. - */ - function chain(...args: ((t: T) => (u: U) => U)[]): (t: T) => (u: U) => U; - /** - * High-order function, composes functions. Note that functions are composed inside-out; - * for example, `compose(a, b)` is the equivalent of `x => b(a(x))`. - * - * @param args The functions to compose. - */ - function compose(...args: ((t: T) => T)[]): (t: T) => T; - enum AssertionLevel { - None = 0, - Normal = 1, - Aggressive = 2, - VeryAggressive = 3 - } - /** - * Safer version of `Function` which should not be called. - * Every function should be assignable to this, but this should not be assignable to every function. - */ - type AnyFunction = (...args: never[]) => void; - namespace Debug { - let currentAssertionLevel: AssertionLevel; - let isDebugging: boolean; - function shouldAssert(level: AssertionLevel): boolean; - function assert(expression: boolean, message?: string, verboseDebugInfo?: string | (() => string), stackCrawlMark?: AnyFunction): void; - function assertEqual(a: T, b: T, msg?: string, msg2?: string): void; - function assertLessThan(a: number, b: number, msg?: string): void; - function assertLessThanOrEqual(a: number, b: number): void; - function assertGreaterThanOrEqual(a: number, b: number): void; - function fail(message?: string, stackCrawlMark?: AnyFunction): never; - function assertDefined(value: T | null | undefined, message?: string): T; - function assertEachDefined>(value: A, message?: string): A; - function assertNever(member: never, message?: string, stackCrawlMark?: AnyFunction): never; - function getFunctionName(func: AnyFunction): any; - } - function equateValues(a: T, b: T): boolean; - /** - * Compare the equality of two strings using a case-sensitive ordinal comparison. - * - * Case-sensitive comparisons compare both strings one code-point at a time using the integer - * value of each code-point after applying `toUpperCase` to each string. We always map both - * strings to their upper-case form as some unicode characters do not properly round-trip to - * lowercase (such as `ẞ` (German sharp capital s)). - */ - function equateStringsCaseInsensitive(a: string, b: string): boolean; - /** - * Compare the equality of two strings using a case-sensitive ordinal comparison. - * - * Case-sensitive comparisons compare both strings one code-point at a time using the - * integer value of each code-point. - */ - function equateStringsCaseSensitive(a: string, b: string): boolean; - /** - * Compare two numeric values for their order relative to each other. - * To compare strings, use any of the `compareStrings` functions. - */ - function compareValues(a: number | undefined, b: number | undefined): Comparison; - function min(a: T, b: T, compare: Comparer): T; - /** - * Compare two strings using a case-insensitive ordinal comparison. - * - * Ordinal comparisons are based on the difference between the unicode code points of both - * strings. Characters with multiple unicode representations are considered unequal. Ordinal - * comparisons provide predictable ordering, but place "a" after "B". - * - * Case-insensitive comparisons compare both strings one code-point at a time using the integer - * value of each code-point after applying `toUpperCase` to each string. We always map both - * strings to their upper-case form as some unicode characters do not properly round-trip to - * lowercase (such as `ẞ` (German sharp capital s)). - */ - function compareStringsCaseInsensitive(a: string, b: string): Comparison; - /** - * Compare two strings using a case-sensitive ordinal comparison. - * - * Ordinal comparisons are based on the difference between the unicode code points of both - * strings. Characters with multiple unicode representations are considered unequal. Ordinal - * comparisons provide predictable ordering, but place "a" after "B". - * - * Case-sensitive comparisons compare both strings one code-point at a time using the integer - * value of each code-point. - */ - function compareStringsCaseSensitive(a: string | undefined, b: string | undefined): Comparison; - function getStringComparer(ignoreCase?: boolean): typeof compareStringsCaseInsensitive; - function getUILocale(): string | undefined; - function setUILocale(value: string | undefined): void; - /** - * Compare two strings in a using the case-sensitive sort behavior of the UI locale. - * - * Ordering is not predictable between different host locales, but is best for displaying - * ordered data for UI presentation. Characters with multiple unicode representations may - * be considered equal. - * - * Case-sensitive comparisons compare strings that differ in base characters, or - * accents/diacritic marks, or case as unequal. - */ - function compareStringsCaseSensitiveUI(a: string, b: string): Comparison; - function compareProperties(a: T | undefined, b: T | undefined, key: K, comparer: Comparer): Comparison; - /** True is greater than false. */ - function compareBooleans(a: boolean, b: boolean): Comparison; - /** - * Given a name and a list of names that are *not* equal to the name, return a spelling suggestion if there is one that is close enough. - * Names less than length 3 only check for case-insensitive equality, not Levenshtein distance. - * - * If there is a candidate that's the same except for case, return that. - * If there is a candidate that's within one edit of the name, return that. - * Otherwise, return the candidate with the smallest Levenshtein distance, - * except for candidates: - * * With no name - * * Whose length differs from the target name by more than 0.34 of the length of the name. - * * Whose levenshtein distance is more than 0.4 of the length of the name - * (0.4 allows 1 substitution/transposition for every 5 characters, - * and 1 insertion/deletion at 3 characters) - */ - function getSpellingSuggestion(name: string, candidates: T[], getName: (candidate: T) => string | undefined): T | undefined; - function endsWith(str: string, suffix: string): boolean; - function removeSuffix(str: string, suffix: string): string; - function tryRemoveSuffix(str: string, suffix: string): string | undefined; - function stringContains(str: string, substring: string): boolean; - function fileExtensionIs(path: string, extension: string): boolean; - function fileExtensionIsOneOf(path: string, extensions: ReadonlyArray): boolean; - /** - * Takes a string like "jquery-min.4.2.3" and returns "jquery" - */ - function removeMinAndVersionNumbers(fileName: string): string; - /** Remove an item from an array, moving everything to its right one space left. */ - function orderedRemoveItem(array: T[], item: T): boolean; - /** Remove an item by index from an array, moving everything to its right one space left. */ - function orderedRemoveItemAt(array: T[], index: number): void; - function unorderedRemoveItemAt(array: T[], index: number): void; - /** Remove the *first* occurrence of `item` from the array. */ - function unorderedRemoveItem(array: T[], item: T): boolean; - type GetCanonicalFileName = (fileName: string) => string; - function createGetCanonicalFileName(useCaseSensitiveFileNames: boolean): GetCanonicalFileName; - /** Represents a "prefix*suffix" pattern. */ - interface Pattern { - prefix: string; - suffix: string; - } - function patternText({ prefix, suffix }: Pattern): string; - /** - * Given that candidate matches pattern, returns the text matching the '*'. - * E.g.: matchedText(tryParsePattern("foo*baz"), "foobarbaz") === "bar" - */ - function matchedText(pattern: Pattern, candidate: string): string; - /** Return the object corresponding to the best pattern to match `candidate`. */ - function findBestPatternMatch(values: ReadonlyArray, getPattern: (value: T) => Pattern, candidate: string): T | undefined; - function startsWith(str: string, prefix: string): boolean; - function removePrefix(str: string, prefix: string): string; - function tryRemovePrefix(str: string, prefix: string, getCanonicalFileName?: GetCanonicalFileName): string | undefined; - function and(f: (arg: T) => boolean, g: (arg: T) => boolean): (arg: T) => boolean; - function or(f: (arg: T) => boolean, g: (arg: T) => boolean): (arg: T) => boolean; - function assertTypeIsNever(_: never): void; - function singleElementArray(t: T | undefined): T[] | undefined; - function enumerateInsertsAndDeletes(newItems: ReadonlyArray, oldItems: ReadonlyArray, comparer: (a: T, b: U) => Comparison, inserted: (newItem: T) => void, deleted: (oldItem: U) => void, unchanged?: (oldItem: U, newItem: T) => void): void; -} -declare namespace ts { - /** Gets a timestamp with (at least) ms resolution */ - const timestamp: () => number; -} -/** Performance measurements for the compiler. */ -declare namespace ts.performance { - /** - * Marks a performance event. - * - * @param markName The name of the mark. - */ - function mark(markName: string): void; - /** - * Adds a performance measurement with the specified name. - * - * @param measureName The name of the performance measurement. - * @param startMarkName The name of the starting mark. If not supplied, the point at which the - * profiler was enabled is used. - * @param endMarkName The name of the ending mark. If not supplied, the current timestamp is - * used. - */ - function measure(measureName: string, startMarkName?: string, endMarkName?: string): void; - /** - * Gets the number of times a marker was encountered. - * - * @param markName The name of the mark. - */ - function getCount(markName: string): number; - /** - * Gets the total duration of all measurements with the supplied name. - * - * @param measureName The name of the measure whose durations should be accumulated. - */ - function getDuration(measureName: string): number; - /** - * Iterate over each measure, performing some action - * - * @param cb The action to perform for each measure - */ - function forEachMeasure(cb: (measureName: string, duration: number) => void): void; - /** Enables (and resets) performance measurements for the compiler. */ - function enable(): void; - /** Disables performance measurements for the compiler. */ - function disable(): void; } declare namespace ts { type Path = string & { @@ -915,9 +410,7 @@ declare namespace ts { FirstJSDocNode = 281, LastJSDocNode = 302, FirstJSDocTagNode = 292, - LastJSDocTagNode = 302, - FirstContextualKeyword = 117, - LastContextualKeyword = 145 + LastJSDocTagNode = 302 } enum NodeFlags { None = 0, @@ -940,18 +433,13 @@ declare namespace ts { JavaScriptFile = 65536, ThisNodeOrAnySubNodesHasError = 131072, HasAggregatedChildData = 262144, - PossiblyContainsDynamicImport = 524288, - PossiblyContainsImportMeta = 1048576, JSDoc = 2097152, - Ambient = 4194304, - InWithStatement = 8388608, JsonFile = 16777216, BlockScoped = 3, ReachabilityCheckFlags = 384, ReachabilityAndEmitFlags = 1408, ContextFlags = 12679168, - TypeExcludesFlags = 20480, - PermanentlySetIncrementalFlags = 1572864 + TypeExcludesFlags = 20480 } enum ModifierFlags { None = 0, @@ -982,42 +470,21 @@ declare namespace ts { IntrinsicIndexedElement = 2, IntrinsicElement = 3 } - enum RelationComparisonResult { - Succeeded = 1, - Failed = 2, - FailedAndReported = 3 - } interface Node extends TextRange { kind: SyntaxKind; flags: NodeFlags; - modifierFlagsCache?: ModifierFlags; - transformFlags: TransformFlags; decorators?: NodeArray; modifiers?: ModifiersArray; - id?: number; parent: Node; - original?: Node; - symbol: Symbol; - locals?: SymbolTable; - nextContainer?: Node; - localSymbol?: Symbol; - flowNode?: FlowNode; - emitNode?: EmitNode; - contextualType?: Type; - contextualMapper?: TypeMapper; } interface JSDocContainer { - jsDoc?: JSDoc[]; - jsDocCache?: ReadonlyArray; } type HasJSDoc = ParameterDeclaration | CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | PropertySignature | ArrowFunction | ParenthesizedExpression | SpreadAssignment | ShorthandPropertyAssignment | PropertyAssignment | FunctionExpression | LabeledStatement | ExpressionStatement | VariableStatement | FunctionDeclaration | ConstructorDeclaration | MethodDeclaration | PropertyDeclaration | AccessorDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | EnumMember | EnumDeclaration | ModuleDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | EndOfFileToken; type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType; type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute; type HasExpressionInitializer = VariableDeclaration | ParameterDeclaration | BindingElement | PropertySignature | PropertyDeclaration | PropertyAssignment | EnumMember; - type MutableNodeArray = NodeArray & T[]; interface NodeArray extends ReadonlyArray, TextRange { hasTrailingComma?: boolean; - transformFlags: TransformFlags; } interface Token extends Node { kind: TKind; @@ -1037,17 +504,6 @@ declare namespace ts { type MinusToken = Token; type Modifier = Token | Token | Token | Token | Token | Token | Token | Token | Token | Token | Token; type ModifiersArray = NodeArray; - enum GeneratedIdentifierFlags { - None = 0, - Auto = 1, - Loop = 2, - Unique = 3, - Node = 4, - KindMask = 7, - ReservedInNestedScopes = 8, - Optimistic = 16, - FileLevel = 32 - } interface Identifier extends PrimaryExpression, Declaration { kind: SyntaxKind.Identifier; /** @@ -1056,23 +512,15 @@ declare namespace ts { */ escapedText: __String; originalKeywordKind?: SyntaxKind; - autoGenerateFlags?: GeneratedIdentifierFlags; - autoGenerateId?: number; isInJSDocNamespace?: boolean; - typeArguments?: NodeArray; - jsdocDotPos?: number; } interface TransientIdentifier extends Identifier { resolvedSymbol: Symbol; } - interface GeneratedIdentifier extends Identifier { - autoGenerateFlags: GeneratedIdentifierFlags; - } interface QualifiedName extends Node { kind: SyntaxKind.QualifiedName; left: EntityName; right: Identifier; - jsdocDotPos?: number; } type EntityName = Identifier | QualifiedName; type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName; @@ -1083,12 +531,6 @@ declare namespace ts { interface NamedDeclaration extends Declaration { name?: DeclarationName; } - interface DynamicNamedDeclaration extends NamedDeclaration { - name: ComputedPropertyName; - } - interface LateBoundDeclaration extends DynamicNamedDeclaration { - name: LateBoundName; - } interface DeclarationStatement extends NamedDeclaration, Statement { name?: Identifier | StringLiteral | NumericLiteral; } @@ -1096,9 +538,6 @@ declare namespace ts { kind: SyntaxKind.ComputedPropertyName; expression: Expression; } - interface LateBoundName extends ComputedPropertyName { - expression: EntityNameExpression; - } interface Decorator extends Node { kind: SyntaxKind.Decorator; parent: NamedDeclaration; @@ -1118,7 +557,6 @@ declare namespace ts { typeParameters?: NodeArray; parameters: NodeArray; type?: TypeNode; - typeArguments?: NodeArray; } type SignatureDeclaration = CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | AccessorDeclaration | FunctionExpression | ArrowFunction; interface CallSignatureDeclaration extends SignatureDeclarationBase, TypeElement { @@ -1158,7 +596,6 @@ declare namespace ts { name: BindingName; initializer?: Expression; } - type BindingElementGrandparent = BindingElement["parent"]["parent"]; interface PropertySignature extends TypeElement, JSDocContainer { kind: SyntaxKind.PropertySignature; name: PropertyName; @@ -1253,7 +690,6 @@ declare namespace ts { kind: SyntaxKind.Constructor; parent: ClassLikeDeclaration; body?: FunctionBody; - returnFlowNode?: FlowNode; } /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */ interface SemicolonClassElement extends ClassElement { @@ -1289,11 +725,6 @@ declare namespace ts { argument: TypeNode; qualifier?: EntityName; } - type LiteralImportTypeNode = ImportTypeNode & { - argument: LiteralTypeNode & { - literal: StringLiteral; - }; - }; interface ThisTypeNode extends TypeNode { kind: SyntaxKind.ThisType; } @@ -1375,9 +806,6 @@ declare namespace ts { operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword; type: TypeNode; } - interface UniqueTypeOperatorNode extends TypeOperatorNode { - operator: SyntaxKind.UniqueKeyword; - } interface IndexedAccessTypeNode extends TypeNode { kind: SyntaxKind.IndexedAccessType; objectType: TypeNode; @@ -1396,9 +824,6 @@ declare namespace ts { } interface StringLiteral extends LiteralExpression { kind: SyntaxKind.StringLiteral; - textSourceNode?: Identifier | StringLiteralLike | NumericLiteral; - /** Note: this is only set when synthesizing a node, not during parsing. */ - singleQuote?: boolean; } type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral; interface Expression extends Node { @@ -1561,24 +986,8 @@ declare namespace ts { interface NoSubstitutionTemplateLiteral extends LiteralExpression { kind: SyntaxKind.NoSubstitutionTemplateLiteral; } - enum TokenFlags { - None = 0, - PrecedingLineBreak = 1, - PrecedingJSDocComment = 2, - Unterminated = 4, - ExtendedUnicodeEscape = 8, - Scientific = 16, - Octal = 32, - HexSpecifier = 64, - BinarySpecifier = 128, - OctalSpecifier = 256, - ContainsSeparator = 512, - BinaryOrOctalSpecifier = 384, - NumericLiteralFlags = 1008 - } interface NumericLiteral extends LiteralExpression { kind: SyntaxKind.NumericLiteral; - numericLiteralFlags: TokenFlags; } interface TemplateHead extends LiteralLikeNode { kind: SyntaxKind.TemplateHead; @@ -1611,7 +1020,6 @@ declare namespace ts { interface ArrayLiteralExpression extends PrimaryExpression { kind: SyntaxKind.ArrayLiteralExpression; elements: NodeArray; - multiLine?: boolean; } interface SpreadElement extends Expression { kind: SyntaxKind.SpreadElement; @@ -1629,7 +1037,6 @@ declare namespace ts { } interface ObjectLiteralExpression extends ObjectLiteralExpressionBase { kind: SyntaxKind.ObjectLiteralExpression; - multiLine?: boolean; } type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression; type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression; @@ -1778,12 +1185,6 @@ declare namespace ts { interface NotEmittedStatement extends Statement { kind: SyntaxKind.NotEmittedStatement; } - /** - * Marks the end of transformed declaration to properly emit exports. - */ - interface EndOfDeclarationMarker extends Statement { - kind: SyntaxKind.EndOfDeclarationMarker; - } /** * A list of comma-separated expressions. This node is only created by transformations. */ @@ -1791,12 +1192,6 @@ declare namespace ts { kind: SyntaxKind.CommaListExpression; elements: NodeArray; } - /** - * Marks the beginning of a merged transformed declaration. - */ - interface MergeDeclarationMarker extends Statement { - kind: SyntaxKind.MergeDeclarationMarker; - } interface EmptyStatement extends Statement { kind: SyntaxKind.EmptyStatement; } @@ -1811,7 +1206,6 @@ declare namespace ts { interface Block extends Statement { kind: SyntaxKind.Block; statements: NodeArray; - multiLine?: boolean; } interface VariableStatement extends Statement, JSDocContainer { kind: SyntaxKind.VariableStatement; @@ -1821,9 +1215,6 @@ declare namespace ts { kind: SyntaxKind.ExpressionStatement; expression: Expression; } - interface PrologueDirective extends ExpressionStatement { - expression: StringLiteral; - } interface IfStatement extends Statement { kind: SyntaxKind.IfStatement; expression: Expression; @@ -1981,9 +1372,6 @@ declare namespace ts { } type ModuleName = Identifier | StringLiteral; type ModuleBody = NamespaceBody | JSDocNamespaceBody; - interface AmbientModuleDeclaration extends ModuleDeclaration { - body?: ModuleBlock; - } interface ModuleDeclaration extends DeclarationStatement, JSDocContainer { kind: SyntaxKind.ModuleDeclaration; parent: ModuleBody | SourceFile; @@ -2285,36 +1673,12 @@ declare namespace ts { path: string; name?: string; } - /** - * Subset of properties from SourceFile that are used in multiple utility functions - */ - interface SourceFileLike { - readonly text: string; - lineMap?: ReadonlyArray; - } - interface RedirectInfo { - /** Source file this redirects to. */ - readonly redirectTarget: SourceFile; - /** - * Source file for the duplicate package. This will not be used by the Program, - * but we need to keep this around so we can watch for changes in underlying. - */ - readonly unredirected: SourceFile; - } interface SourceFile extends Declaration { kind: SyntaxKind.SourceFile; statements: NodeArray; endOfFileToken: Token; fileName: string; - path: Path; text: string; - resolvedPath: Path; - /** - * If two source files are for the same version of the same package, one will redirect to the other. - * (See `createRedirectSourceFile` in program.ts.) - * The redirect will have this set. The redirected-to source file will be in `redirectTargetsSet`. - */ - redirectInfo?: RedirectInfo; amdDependencies: ReadonlyArray; moduleName?: string; referencedFiles: ReadonlyArray; @@ -2322,7 +1686,6 @@ declare namespace ts { libReferenceDirectives: ReadonlyArray; languageVariant: LanguageVariant; isDeclarationFile: boolean; - renamedDependencies?: ReadonlyMap; /** * lib.d.ts should have a reference comment like * @@ -2333,49 +1696,11 @@ declare namespace ts { */ hasNoDefaultLib: boolean; languageVersion: ScriptTarget; - scriptKind: ScriptKind; - /** - * The first "most obvious" node that makes a file an external module. - * This is intended to be the first top-level import/export, - * but could be arbitrarily nested (e.g. `import.meta`). - */ - externalModuleIndicator?: Node; - commonJsModuleIndicator?: Node; - identifiers: Map; - nodeCount: number; - identifierCount: number; - symbolCount: number; - parseDiagnostics: DiagnosticWithLocation[]; - bindDiagnostics: DiagnosticWithLocation[]; - bindSuggestionDiagnostics?: DiagnosticWithLocation[]; - jsDocDiagnostics?: DiagnosticWithLocation[]; - additionalSyntacticDiagnostics?: ReadonlyArray; - lineMap: ReadonlyArray; - classifiableNames?: ReadonlyUnderscoreEscapedMap; - resolvedModules?: Map; - resolvedTypeReferenceDirectiveNames: Map; - imports: ReadonlyArray; - /** - * When a file's references are redirected due to project reference directives, - * the original names of the references are stored in this array - */ - redirectedReferences?: ReadonlyArray; - moduleAugmentations: ReadonlyArray; - patternAmbientModules?: PatternAmbientModule[]; - ambientModuleNames: ReadonlyArray; - checkJsDirective?: CheckJsDirective; - version: string; - pragmas: PragmaMap; - localJsxNamespace?: __String; - localJsxFactory?: EntityName; } interface Bundle extends Node { kind: SyntaxKind.Bundle; prepends: ReadonlyArray; sourceFiles: ReadonlyArray; - syntheticFileReferences?: ReadonlyArray; - syntheticTypeReferences?: ReadonlyArray; - hasNoDefaultLib?: boolean; } interface InputFiles extends Node { kind: SyntaxKind.InputFiles; @@ -2447,11 +1772,6 @@ declare namespace ts { * Get a list of files in the program */ getSourceFiles(): ReadonlyArray; - /** - * Get a list of file names that were passed to 'createProgram' or referenced in a - * program source file but could not be located. - */ - getMissingFilePaths(): ReadonlyArray; /** * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then * the JavaScript and declaration files will be produced for all the files in this program. @@ -2470,44 +1790,17 @@ declare namespace ts { getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; getConfigFileParsingDiagnostics(): ReadonlyArray; - getSuggestionDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; /** * Gets a type checker that can be used to semantically analyze source files in the program. */ getTypeChecker(): TypeChecker; - getCommonSourceDirectory(): string; - getDiagnosticsProducingTypeChecker(): TypeChecker; - dropDiagnosticsProducingTypeChecker(): void; - getClassifiableNames(): UnderscoreEscapedMap; - getNodeCount(): number; - getIdentifierCount(): number; - getSymbolCount(): number; - getTypeCount(): number; - getFileProcessingDiagnostics(): DiagnosticCollection; - getResolvedTypeReferenceDirectives(): Map; isSourceFileFromExternalLibrary(file: SourceFile): boolean; - isSourceFileDefaultLibrary(file: SourceFile): boolean; - structureIsReused?: StructureIsReused; - getSourceFileFromReference(referencingFile: SourceFile, ref: FileReference): SourceFile | undefined; - getLibFileFromReference(ref: FileReference): SourceFile | undefined; - /** Given a source file, get the name of the package it was imported from. */ - sourceFileToPackageName: Map; - /** Set of all source files that some other source file redirects to. */ - redirectTargetsSet: Map; - /** Is the file emitted file */ - isEmittedFile(file: string): boolean; - getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined; getProjectReferences(): (ResolvedProjectReference | undefined)[] | undefined; } interface ResolvedProjectReference { commandLine: ParsedCommandLine; sourceFile: SourceFile; } - enum StructureIsReused { - Not = 0, - SafeModules = 1, - Completely = 2 - } interface CustomTransformers { /** Custom transformers to evaluate before built-in .js transformations. */ before?: TransformerFactory[]; @@ -2553,13 +1846,6 @@ declare namespace ts { /** Contains declaration emit diagnostics */ diagnostics: ReadonlyArray; emittedFiles?: string[]; - sourceMaps?: SourceMapData[]; - } - interface TypeCheckerHost { - getCompilerOptions(): CompilerOptions; - getSourceFiles(): ReadonlyArray; - getSourceFile(fileName: string): SourceFile | undefined; - getResolvedTypeReferenceDirectives(): ReadonlyMap; } interface TypeChecker { getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; @@ -2573,16 +1859,10 @@ declare namespace ts { getBaseTypeOfLiteralType(type: Type): Type; getWidenedType(type: Type): Type; getReturnTypeOfSignature(signature: Signature): Type; - /** - * Gets the type of a parameter at a given position in a signature. - * Returns `any` if the index is not valid. - */ - getParameterType(signature: Signature, parameterIndex: number): Type; getNullableType(type: Type, flags: TypeFlags): Type; getNonNullableType(type: Type): Type; /** Note that the resulting nodes cannot be checked. */ typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode | undefined; - typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker): TypeNode | undefined; /** Note that the resulting nodes cannot be checked. */ signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): (SignatureDeclaration & { typeArguments?: NodeArray; @@ -2624,10 +1904,6 @@ declare namespace ts { typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): string; typePredicateToString(predicate: TypePredicate, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; - writeSignature(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind, writer?: EmitTextWriter): string; - writeType(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags, writer?: EmitTextWriter): string; - writeSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags, writer?: EmitTextWriter): string; - writeTypePredicate(predicate: TypePredicate, enclosingDeclaration?: Node, flags?: TypeFormatFlags, writer?: EmitTextWriter): string; /** * @deprecated Use the createX factory functions or XToY typechecker methods and `createPrinter` or the `xToString` methods instead * This will be removed in a future version. @@ -2637,9 +1913,6 @@ declare namespace ts { getAugmentedPropertiesOfType(type: Type): Symbol[]; getRootSymbols(symbol: Symbol): Symbol[]; getContextualType(node: Expression): Type | undefined; - getContextualTypeForArgumentAtIndex(call: CallLikeExpression, argIndex: number): Type | undefined; - getContextualTypeForJsxAttribute(attribute: JsxAttribute | JsxSpreadAttribute): Type | undefined; - isContextSensitive(node: Expression | MethodDeclaration | ObjectLiteralElementLike | JsxAttributeLike): boolean; /** * returns unknownSignature in the case of an error. * returns undefined if the node is not valid. @@ -2651,91 +1924,22 @@ declare namespace ts { isUndefinedSymbol(symbol: Symbol): boolean; isArgumentsSymbol(symbol: Symbol): boolean; isUnknownSymbol(symbol: Symbol): boolean; - getMergedSymbol(symbol: Symbol): Symbol; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean; - /** Exclude accesses to private properties or methods with a `this` parameter that `type` doesn't satisfy. */ - isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode, type: Type, property: Symbol): boolean; /** Follow all aliases to get the original symbol. */ getAliasedSymbol(symbol: Symbol): Symbol; - /** Follow a *single* alias to get the immediately aliased symbol. */ - getImmediateAliasedSymbol(symbol: Symbol): Symbol | undefined; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; - /** Unlike `getExportsOfModule`, this includes properties of an `export =` value. */ - getExportsAndPropertiesOfModule(moduleSymbol: Symbol): Symbol[]; getAllAttributesTypeFromJsxOpeningLikeElement(elementNode: JsxOpeningLikeElement): Type | undefined; getJsxIntrinsicTagNamesAt(location: Node): Symbol[]; isOptionalParameter(node: ParameterDeclaration): boolean; getAmbientModules(): Symbol[]; tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; - /** - * Unlike `tryGetMemberInModuleExports`, this includes properties of an `export =` value. - * Does *not* return properties of primitive types. - */ - tryGetMemberInModuleExportsAndProperties(memberName: string, moduleSymbol: Symbol): Symbol | undefined; getApparentType(type: Type): Type; getSuggestionForNonexistentProperty(name: Identifier | string, containingType: Type): string | undefined; getSuggestionForNonexistentSymbol(location: Node, name: string, meaning: SymbolFlags): string | undefined; getSuggestionForNonexistentModule(node: Identifier, target: Symbol): string | undefined; getBaseConstraintOfType(type: Type): Type | undefined; getDefaultFromTypeParameter(type: Type): Type | undefined; - getAnyType(): Type; - getStringType(): Type; - getNumberType(): Type; - getBooleanType(): Type; - getFalseType(): Type; - getTrueType(): Type; - getVoidType(): Type; - getUndefinedType(): Type; - getNullType(): Type; - getESSymbolType(): Type; - getNeverType(): Type; - getUnionType(types: Type[], subtypeReduction?: UnionReduction): Type; - createArrayType(elementType: Type): Type; - createPromiseType(type: Type): Type; - createAnonymousType(symbol: Symbol, members: SymbolTable, callSignatures: Signature[], constructSignatures: Signature[], stringIndexInfo: IndexInfo | undefined, numberIndexInfo: IndexInfo | undefined): Type; - createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[] | undefined, thisParameter: Symbol | undefined, parameters: Symbol[], resolvedReturnType: Type, typePredicate: TypePredicate | undefined, minArgumentCount: number, hasRestParameter: boolean, hasLiteralTypes: boolean): Signature; - createSymbol(flags: SymbolFlags, name: __String): TransientSymbol; - createIndexInfo(type: Type, isReadonly: boolean, declaration?: SignatureDeclaration): IndexInfo; - isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags, shouldComputeAliasToMarkVisible: boolean): SymbolAccessibilityResult; - tryFindAmbientModuleWithoutAugmentations(moduleName: string): Symbol | undefined; - getSymbolWalker(accept?: (symbol: Symbol) => boolean): SymbolWalker; - getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; - getGlobalDiagnostics(): Diagnostic[]; - getEmitResolver(sourceFile?: SourceFile, cancellationToken?: CancellationToken): EmitResolver; - getNodeCount(): number; - getIdentifierCount(): number; - getSymbolCount(): number; - getTypeCount(): number; - isArrayLikeType(type: Type): boolean; - /** - * For a union, will include a property if it's defined in *any* of the member types. - * So for `{ a } | { b }`, this will include both `a` and `b`. - * Does not include properties of primitive types. - */ - getAllPossiblePropertiesOfTypes(type: ReadonlyArray): Symbol[]; - resolveName(name: string, location: Node, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined; - getJsxNamespace(location?: Node): string; - /** - * Note that this will return undefined in the following case: - * // a.ts - * export namespace N { export class C { } } - * // b.ts - * <> - * Where `C` is the symbol we're looking for. - * This should be called in a loop climbing parents of the symbol, so we'll get `N`. - */ - getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags, useOnlyExternalAliasing: boolean): Symbol[] | undefined; - getTypePredicateOfSignature(signature: Signature): TypePredicate; - resolveExternalModuleSymbol(symbol: Symbol): Symbol; - /** @param node A location where we might consider accessing `this`. Not necessarily a ThisExpression. */ - tryGetThisTypeAt(node: Node): Type | undefined; - getTypeArgumentConstraint(node: TypeNode): Type | undefined; - /** - * Does *not* get *all* suggestion diagnostics, just the ones that were convenient to report in the checker. - * Others are added in computeSuggestionDiagnostics. - */ - getSuggestionDiagnostics(file: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; /** * Depending on the operation performed, it may be appropriate to throw away the checker * if the cancellation token is triggered. Typically, if it is used for error checking @@ -2743,11 +1947,6 @@ declare namespace ts { */ runWithCancellationToken(token: CancellationToken, cb: (checker: TypeChecker) => T): T; } - enum UnionReduction { - None = 0, - Literal = 1, - Subtype = 2 - } enum NodeBuilderFlags { None = 0, NoTruncation = 1, @@ -2808,18 +2007,6 @@ declare namespace ts { AllowAnyNodeKind = 4, UseAliasDefinedOutsideCurrentScope = 8 } - interface SymbolWalker { - /** Note: Return values are not ordered. */ - walkType(root: Type): { - visitedTypes: ReadonlyArray; - visitedSymbols: ReadonlyArray; - }; - /** Note: Return values are not ordered. */ - walkSymbol(root: Symbol): { - visitedTypes: ReadonlyArray; - visitedSymbols: ReadonlyArray; - }; - } /** * @deprecated */ @@ -2853,15 +2040,6 @@ declare namespace ts { decreaseIndent(): void; clear(): void; } - enum SymbolAccessibility { - Accessible = 0, - NotAccessible = 1, - CannotBeNamed = 2 - } - enum SyntheticSymbolKind { - UnionOrIntersection = 0, - Spread = 1 - } enum TypePredicateKind { This = 0, Identifier = 1 @@ -2879,88 +2057,6 @@ declare namespace ts { parameterIndex: number; } type TypePredicate = IdentifierTypePredicate | ThisTypePredicate; - type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration; - type AnyImportOrReExport = AnyImportSyntax | ExportDeclaration; - interface ValidImportTypeNode extends ImportTypeNode { - argument: LiteralTypeNode & { - literal: StringLiteral; - }; - } - type AnyValidImportOrReExport = (ImportDeclaration | ExportDeclaration) & { - moduleSpecifier: StringLiteral; - } | ImportEqualsDeclaration & { - moduleReference: ExternalModuleReference & { - expression: StringLiteral; - }; - } | RequireOrImportCall | ValidImportTypeNode; - type RequireOrImportCall = CallExpression & { - arguments: [StringLiteralLike]; - }; - type LateVisibilityPaintedStatement = AnyImportSyntax | VariableStatement | ClassDeclaration | FunctionDeclaration | ModuleDeclaration | TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration; - interface SymbolVisibilityResult { - accessibility: SymbolAccessibility; - aliasesToMakeVisible?: LateVisibilityPaintedStatement[]; - errorSymbolName?: string; - errorNode?: Node; - } - interface SymbolAccessibilityResult extends SymbolVisibilityResult { - errorModuleName?: string; - } - interface AllAccessorDeclarations { - firstAccessor: AccessorDeclaration; - secondAccessor: AccessorDeclaration | undefined; - getAccessor: AccessorDeclaration | undefined; - setAccessor: AccessorDeclaration | undefined; - } - /** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator metadata */ - enum TypeReferenceSerializationKind { - Unknown = 0, - TypeWithConstructSignatureAndValue = 1, - VoidNullableOrNeverType = 2, - NumberLikeType = 3, - StringLikeType = 4, - BooleanType = 5, - ArrayLikeType = 6, - ESSymbolType = 7, - Promise = 8, - TypeWithCallSignature = 9, - ObjectType = 10 - } - interface EmitResolver { - hasGlobalName(name: string): boolean; - getReferencedExportContainer(node: Identifier, prefixLocals?: boolean): SourceFile | ModuleDeclaration | EnumDeclaration | undefined; - getReferencedImportDeclaration(node: Identifier): Declaration | undefined; - getReferencedDeclarationWithCollidingName(node: Identifier): Declaration | undefined; - isDeclarationWithCollidingName(node: Declaration): boolean; - isValueAliasDeclaration(node: Node): boolean; - isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean; - isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; - getNodeCheckFlags(node: Node): NodeCheckFlags; - isDeclarationVisible(node: Declaration | AnyImportSyntax): boolean; - isLateBound(node: Declaration): node is LateBoundDeclaration; - collectLinkedAliases(node: Identifier, setVisibility?: boolean): Node[] | undefined; - isImplementationOfOverload(node: FunctionLike): boolean | undefined; - isRequiredInitializedParameter(node: ParameterDeclaration): boolean; - isOptionalUninitializedParameterProperty(node: ParameterDeclaration): boolean; - createTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean): TypeNode | undefined; - createReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined; - createTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined; - createLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): Expression; - isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags | undefined, shouldComputeAliasToMarkVisible: boolean): SymbolAccessibilityResult; - isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult; - getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined; - getReferencedValueDeclaration(reference: Identifier): Declaration | undefined; - getTypeReferenceSerializationKind(typeName: EntityName, location?: Node): TypeReferenceSerializationKind; - isOptionalParameter(node: ParameterDeclaration): boolean; - moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean; - isArgumentsLocalBinding(node: Identifier): boolean; - getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration | ImportTypeNode): SourceFile | undefined; - getTypeReferenceDirectivesForEntityName(name: EntityNameOrEntityNameExpression): string[] | undefined; - getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[] | undefined; - isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): boolean; - getJsxFactoryEntity(location?: Node): EntityName | undefined; - getAllAccessorDeclarations(declaration: AccessorDeclaration): AllAccessorDeclarations; - } enum SymbolFlags { None = 0, FunctionScopedVariable = 1, @@ -2990,7 +2086,6 @@ declare namespace ts { Optional = 16777216, Transient = 33554432, JSContainer = 67108864, - All = 67108863, Enum = 384, Variable = 3, Value = 67216319, @@ -3022,9 +2117,7 @@ declare namespace ts { HasMembers = 6240, BlockScoped = 418, PropertyOrAccessor = 98308, - ClassMember = 106500, - Classifiable = 2885600, - LateBindingContainer = 6240 + ClassMember = 106500 } interface Symbol { flags: SymbolFlags; @@ -3034,72 +2127,6 @@ declare namespace ts { members?: SymbolTable; exports?: SymbolTable; globalExports?: SymbolTable; - id?: number; - mergeId?: number; - parent?: Symbol; - exportSymbol?: Symbol; - nameType?: Type; - constEnumOnlyModule?: boolean; - isReferenced?: SymbolFlags; - isReplaceableByMethod?: boolean; - isAssigned?: boolean; - } - interface SymbolLinks { - immediateTarget?: Symbol; - target?: Symbol; - type?: Type; - uniqueESSymbolType?: Type; - declaredType?: Type; - typeParameters?: TypeParameter[]; - outerTypeParameters?: TypeParameter[]; - inferredClassType?: Type; - instantiations?: Map; - mapper?: TypeMapper; - referenced?: boolean; - containingType?: UnionOrIntersectionType; - leftSpread?: Symbol; - rightSpread?: Symbol; - syntheticOrigin?: Symbol; - isDiscriminantProperty?: boolean; - resolvedExports?: SymbolTable; - resolvedMembers?: SymbolTable; - exportsChecked?: boolean; - typeParametersChecked?: boolean; - isDeclarationWithCollidingName?: boolean; - bindingElement?: BindingElement; - exportsSomeValue?: boolean; - enumKind?: EnumKind; - originatingImport?: ImportDeclaration | ImportCall; - lateSymbol?: Symbol; - specifierCache?: Map; - } - enum EnumKind { - Numeric = 0, - Literal = 1 - } - enum CheckFlags { - Instantiated = 1, - SyntheticProperty = 2, - SyntheticMethod = 4, - Readonly = 8, - Partial = 16, - HasNonUniformType = 32, - ContainsPublic = 64, - ContainsProtected = 128, - ContainsPrivate = 256, - ContainsStatic = 512, - Late = 1024, - ReverseMapped = 2048, - OptionalParameter = 4096, - RestParameter = 8192, - Synthetic = 6 - } - interface TransientSymbol extends Symbol, SymbolLinks { - checkFlags: CheckFlags; - } - interface ReverseMappedSymbol extends TransientSymbol { - propertyType: Type; - mappedType: MappedType; } enum InternalSymbolName { Call = "__call", @@ -3150,53 +2177,6 @@ declare namespace ts { } /** SymbolTable based on ES6 Map interface. */ type SymbolTable = UnderscoreEscapedMap; - /** Used to track a `declare module "foo*"`-like declaration. */ - interface PatternAmbientModule { - pattern: Pattern; - symbol: Symbol; - } - enum NodeCheckFlags { - TypeChecked = 1, - LexicalThis = 2, - CaptureThis = 4, - CaptureNewTarget = 8, - SuperInstance = 256, - SuperStatic = 512, - ContextChecked = 1024, - AsyncMethodWithSuper = 2048, - AsyncMethodWithSuperBinding = 4096, - CaptureArguments = 8192, - EnumValuesComputed = 16384, - LexicalModuleMergesWithClass = 32768, - LoopWithCapturedBlockScopedBinding = 65536, - CapturedBlockScopedBinding = 131072, - BlockScopedBindingInLoop = 262144, - ClassWithBodyScopedClassBinding = 524288, - BodyScopedClassBinding = 1048576, - NeedsLoopOutParameter = 2097152, - AssignmentsMarked = 4194304, - ClassWithConstructorReference = 8388608, - ConstructorReferenceInClass = 16777216 - } - interface NodeLinks { - flags: NodeCheckFlags; - resolvedType?: Type; - resolvedSignature?: Signature; - resolvedSignatures?: Map; - resolvedSymbol?: Symbol; - resolvedIndexInfo?: IndexInfo; - maybeTypePredicate?: boolean; - enumMemberValue?: string | number; - isVisible?: boolean; - containsArgumentsReference?: boolean; - hasReportedStatementInAmbientContext?: boolean; - jsxFlags: JsxFlags; - resolvedJsxElementAttributesType?: Type; - resolvedJsxElementAllAttributesType?: Type; - hasSuperCall?: boolean; - superCall?: SuperCall; - switchTypes?: Type[]; - } enum TypeFlags { Any = 1, Unknown = 2, @@ -3223,28 +2203,16 @@ declare namespace ts { Conditional = 4194304, Substitution = 8388608, NonPrimitive = 16777216, - FreshLiteral = 33554432, - UnionOfUnitTypes = 67108864, - ContainsWideningType = 134217728, - ContainsObjectLiteral = 268435456, - ContainsAnyFunctionType = 536870912, - AnyOrUnknown = 3, - Nullable = 24576, Literal = 448, Unit = 27072, StringOrNumberLiteral = 192, - StringOrNumberLiteralOrUnique = 2240, - DefinitelyFalsy = 29120, PossiblyFalsy = 29148, - Intrinsic = 16839967, - Primitive = 32764, StringLike = 68, NumberLike = 168, BooleanLike = 272, EnumLike = 544, ESSymbolLike = 3072, VoidLike = 12288, - DisjointDomains = 16809468, UnionOrIntersection = 786432, StructuredType = 917504, TypeVariable = 2162688, @@ -3253,29 +2221,15 @@ declare namespace ts { Instantiable = 15794176, StructuredOrInstantiable = 16711680, Narrowable = 33492479, - NotUnionOrUnit = 16909315, - NotUnit = 16749629, - RequiresWidening = 402653184, - PropagatingFlags = 939524096, - NonWideningType = 134217728, - Wildcard = 268435456, - EmptyObject = 536870912, - ConstructionFlags = 939524096, - GenericMappedType = 134217728 + NotUnionOrUnit = 16909315 } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { flags: TypeFlags; - id: number; - checker: TypeChecker; symbol: Symbol; pattern?: DestructuringPattern; aliasSymbol?: Symbol; aliasTypeArguments?: ReadonlyArray; - wildcardInstantiation?: Type; - } - interface IntrinsicType extends Type { - intrinsicName: string; } interface LiteralType extends Type { value: string | number; @@ -3319,8 +2273,6 @@ declare namespace ts { outerTypeParameters: TypeParameter[] | undefined; localTypeParameters: TypeParameter[] | undefined; thisType: TypeParameter | undefined; - resolvedBaseConstructorType?: Type; - resolvedBaseTypes: BaseType[]; } type BaseType = ObjectType | IntersectionType; interface InterfaceTypeWithDeclaredMembers extends InterfaceType { @@ -3344,16 +2296,7 @@ declare namespace ts { target: GenericType; typeArguments?: ReadonlyArray; } - enum Variance { - Invariant = 0, - Covariant = 1, - Contravariant = 2, - Bivariant = 3, - Independent = 4 - } interface GenericType extends InterfaceType, TypeReference { - instantiations: Map; - variances?: Variance[]; } interface TupleType extends GenericType { minLength: number; @@ -3365,76 +2308,19 @@ declare namespace ts { } interface UnionOrIntersectionType extends Type { types: Type[]; - propertyCache: SymbolTable; - resolvedProperties: Symbol[]; - resolvedIndexType: IndexType; - resolvedStringIndexType: IndexType; - resolvedBaseConstraint: Type; - couldContainTypeVariables: boolean; } interface UnionType extends UnionOrIntersectionType { } interface IntersectionType extends UnionOrIntersectionType { - resolvedApparentType: Type; } type StructuredType = ObjectType | UnionType | IntersectionType; - interface AnonymousType extends ObjectType { - target?: AnonymousType; - mapper?: TypeMapper; - } - interface MappedType extends AnonymousType { - declaration: MappedTypeNode; - typeParameter?: TypeParameter; - constraintType?: Type; - templateType?: Type; - modifiersType?: Type; - } interface EvolvingArrayType extends ObjectType { elementType: Type; finalArrayType?: Type; } - interface ReverseMappedType extends ObjectType { - source: Type; - mappedType: MappedType; - } - interface ResolvedType extends ObjectType, UnionOrIntersectionType { - members: SymbolTable; - properties: Symbol[]; - callSignatures: ReadonlyArray; - constructSignatures: ReadonlyArray; - stringIndexInfo?: IndexInfo; - numberIndexInfo?: IndexInfo; - } - interface FreshObjectLiteralType extends ResolvedType { - regularType: ResolvedType; - } - interface IterableOrIteratorType extends ObjectType, UnionType { - iteratedTypeOfIterable?: Type; - iteratedTypeOfIterator?: Type; - iteratedTypeOfAsyncIterable?: Type; - iteratedTypeOfAsyncIterator?: Type; - } - interface PromiseOrAwaitableType extends ObjectType, UnionType { - promiseTypeOfPromiseConstructor?: Type; - promisedTypeOfPromise?: Type; - awaitedTypeOfType?: Type; - } - interface SyntheticDefaultModuleType extends Type { - syntheticType?: Type; - } interface InstantiableType extends Type { - resolvedBaseConstraint?: Type; - resolvedIndexType?: IndexType; - resolvedStringIndexType?: IndexType; } interface TypeParameter extends InstantiableType { - /** Retrieve using getConstraintFromTypeParameter */ - constraint?: Type; - default?: Type; - target?: TypeParameter; - mapper?: TypeMapper; - isThisType?: boolean; - resolvedDefaultType?: Type; } interface IndexedAccessType extends InstantiableType { objectType: Type; @@ -3445,7 +2331,6 @@ declare namespace ts { type TypeVariable = TypeParameter | IndexedAccessType; interface IndexType extends InstantiableType { type: InstantiableType | UnionOrIntersectionType; - stringsOnly: boolean; } interface ConditionalRoot { node: ConditionalTypeNode; @@ -3466,9 +2351,6 @@ declare namespace ts { extendsType: Type; resolvedTrueType?: Type; resolvedFalseType?: Type; - resolvedDefaultConstraint?: Type; - mapper?: TypeMapper; - combinedMapper?: TypeMapper; } interface SubstitutionType extends InstantiableType { typeVariable: TypeVariable; @@ -3482,19 +2364,6 @@ declare namespace ts { declaration?: SignatureDeclaration | JSDocSignature; typeParameters?: ReadonlyArray; parameters: ReadonlyArray; - thisParameter?: Symbol; - resolvedReturnType?: Type; - resolvedTypePredicate?: TypePredicate; - minArgumentCount: number; - hasRestParameter: boolean; - hasLiteralTypes: boolean; - target?: Signature; - mapper?: TypeMapper; - unionSignatures?: Signature[]; - erasedSignatureCache?: Signature; - canonicalSignatureCache?: Signature; - isolatedSignatureType?: ObjectType; - instantiations?: Map; } enum IndexKind { String = 0, @@ -3505,7 +2374,6 @@ declare namespace ts { isReadonly: boolean; declaration?: IndexSignatureDeclaration; } - type TypeMapper = (t: TypeParameter) => Type; enum InferencePriority { NakedTypeVariable = 1, HomomorphicMappedType = 2, @@ -3516,58 +2384,6 @@ declare namespace ts { AlwaysStrict = 64, PriorityImpliesCombination = 28 } - interface InferenceInfo { - typeParameter: TypeParameter; - candidates: Type[] | undefined; - contraCandidates: Type[] | undefined; - inferredType?: Type; - priority?: InferencePriority; - topLevel: boolean; - isFixed: boolean; - } - enum InferenceFlags { - None = 0, - InferUnionTypes = 1, - NoDefault = 2, - AnyDefault = 4 - } - /** - * Ternary values are defined such that - * x & y is False if either x or y is False. - * x & y is Maybe if either x or y is Maybe, but neither x or y is False. - * x & y is True if both x and y are True. - * x | y is False if both x and y are False. - * x | y is Maybe if either x or y is Maybe, but neither x or y is True. - * x | y is True if either x or y is True. - */ - enum Ternary { - False = 0, - Maybe = 1, - True = -1 - } - type TypeComparer = (s: Type, t: Type, reportErrors?: boolean) => Ternary; - interface InferenceContext extends TypeMapper { - typeParameters: ReadonlyArray; - signature?: Signature; - inferences: InferenceInfo[]; - flags: InferenceFlags; - compareTypes: TypeComparer; - } - interface WideningContext { - parent?: WideningContext; - propertyName?: __String; - siblings?: Type[]; - resolvedProperties?: Symbol[]; - } - enum SpecialPropertyAssignmentKind { - None = 0, - ExportsProperty = 1, - ModuleExports = 2, - PrototypeProperty = 3, - ThisProperty = 4, - Property = 5, - Prototype = 6 - } /** @deprecated Use FileExtensionInfo instead. */ type JsFileExtensionInfo = FileExtensionInfo; interface FileExtensionInfo { @@ -3619,9 +2435,6 @@ declare namespace ts { Suggestion = 2, Message = 3 } - function diagnosticCategoryName(d: { - category: DiagnosticCategory; - }, lowerCase?: boolean): string; enum ModuleResolutionKind { Classic = 1, NodeJs = 2 @@ -3641,44 +2454,31 @@ declare namespace ts { } type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport[] | ProjectReference[] | null | undefined; interface CompilerOptions { - all?: boolean; allowJs?: boolean; - allowNonTsExtensions?: boolean; allowSyntheticDefaultImports?: boolean; allowUnreachableCode?: boolean; allowUnusedLabels?: boolean; alwaysStrict?: boolean; baseUrl?: string; - /** An error if set - this should only go through the -b pipeline and not actually be observed */ - build?: boolean; charset?: string; checkJs?: boolean; - configFilePath?: string; - /** configFile is set as non enumerable property so as to avoid checking of json source files */ - readonly configFile?: TsConfigSourceFile; declaration?: boolean; declarationMap?: boolean; emitDeclarationOnly?: boolean; declarationDir?: string; - diagnostics?: boolean; - extendedDiagnostics?: boolean; disableSizeLimit?: boolean; downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; experimentalDecorators?: boolean; forceConsistentCasingInFileNames?: boolean; - help?: boolean; importHelpers?: boolean; - init?: boolean; inlineSourceMap?: boolean; inlineSources?: boolean; isolatedModules?: boolean; jsx?: JsxEmit; keyofStringsOnly?: boolean; lib?: string[]; - listEmittedFiles?: boolean; - listFiles?: boolean; locale?: string; mapRoot?: string; maxNodeModuleJsDepth?: number; @@ -3686,7 +2486,6 @@ declare namespace ts { moduleResolution?: ModuleResolutionKind; newLine?: NewLineKind; noEmit?: boolean; - noEmitForJsFiles?: boolean; noEmitHelpers?: boolean; noEmitOnError?: boolean; noErrorTruncation?: boolean; @@ -3704,12 +2503,9 @@ declare namespace ts { outDir?: string; outFile?: string; paths?: MapLike; - plugins?: PluginImport[]; preserveConstEnums?: boolean; preserveSymlinks?: boolean; - preserveWatchOutput?: boolean; project?: string; - pretty?: boolean; reactNamespace?: string; jsxFactory?: string; composite?: boolean; @@ -3724,18 +2520,14 @@ declare namespace ts { strictFunctionTypes?: boolean; strictNullChecks?: boolean; strictPropertyInitialization?: boolean; - stripInternal?: boolean; suppressExcessPropertyErrors?: boolean; suppressImplicitAnyIndexErrors?: boolean; - suppressOutputPathCheck?: boolean; target?: ScriptTarget; traceResolution?: boolean; resolveJsonModule?: boolean; types?: string[]; /** Paths used to compute primary types search locations */ typeRoots?: string[]; - version?: boolean; - watch?: boolean; esModuleInterop?: boolean; [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } @@ -3809,32 +2601,15 @@ declare namespace ts { errors: Diagnostic[]; wildcardDirectories?: MapLike; compileOnSave?: boolean; - configFileSpecs?: ConfigFileSpecs; } enum WatchDirectoryFlags { None = 0, Recursive = 1 } - interface ConfigFileSpecs { - filesSpecs: ReadonlyArray | undefined; - referencesSpecs: ReadonlyArray | undefined; - /** - * Present to report errors (user specified specs), validatedIncludeSpecs are used for file name matching - */ - includeSpecs?: ReadonlyArray; - /** - * Present to report errors (user specified specs), validatedExcludeSpecs are used for file name matching - */ - excludeSpecs?: ReadonlyArray; - validatedIncludeSpecs?: ReadonlyArray; - validatedExcludeSpecs?: ReadonlyArray; - wildcardDirectories: MapLike; - } interface ExpandResult { fileNames: string[]; projectReferences: ReadonlyArray | undefined; wildcardDirectories: MapLike; - spec: ConfigFileSpecs; } interface CreateProgramOptions { rootNames: ReadonlyArray; @@ -3844,160 +2619,6 @@ declare namespace ts { oldProgram?: Program; configFileParsingDiagnostics?: ReadonlyArray; } - interface CommandLineOptionBase { - name: string; - type: "string" | "number" | "boolean" | "object" | "list" | Map; - isFilePath?: boolean; - shortName?: string; - description?: DiagnosticMessage; - paramType?: DiagnosticMessage; - isTSConfigOnly?: boolean; - isCommandLineOnly?: boolean; - showInSimplifiedHelpView?: boolean; - category?: DiagnosticMessage; - } - interface CommandLineOptionOfPrimitiveType extends CommandLineOptionBase { - type: "string" | "number" | "boolean"; - } - interface CommandLineOptionOfCustomType extends CommandLineOptionBase { - type: Map; - } - interface TsConfigOnlyOption extends CommandLineOptionBase { - type: "object"; - elementOptions?: Map; - extraKeyDiagnosticMessage?: DiagnosticMessage; - } - interface CommandLineOptionOfListType extends CommandLineOptionBase { - type: "list"; - element: CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType | TsConfigOnlyOption; - } - type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType | TsConfigOnlyOption | CommandLineOptionOfListType; - enum CharacterCodes { - nullCharacter = 0, - maxAsciiCharacter = 127, - lineFeed = 10, - carriageReturn = 13, - lineSeparator = 8232, - paragraphSeparator = 8233, - nextLine = 133, - space = 32, - nonBreakingSpace = 160, - enQuad = 8192, - emQuad = 8193, - enSpace = 8194, - emSpace = 8195, - threePerEmSpace = 8196, - fourPerEmSpace = 8197, - sixPerEmSpace = 8198, - figureSpace = 8199, - punctuationSpace = 8200, - thinSpace = 8201, - hairSpace = 8202, - zeroWidthSpace = 8203, - narrowNoBreakSpace = 8239, - ideographicSpace = 12288, - mathematicalSpace = 8287, - ogham = 5760, - _ = 95, - $ = 36, - _0 = 48, - _1 = 49, - _2 = 50, - _3 = 51, - _4 = 52, - _5 = 53, - _6 = 54, - _7 = 55, - _8 = 56, - _9 = 57, - a = 97, - b = 98, - c = 99, - d = 100, - e = 101, - f = 102, - g = 103, - h = 104, - i = 105, - j = 106, - k = 107, - l = 108, - m = 109, - n = 110, - o = 111, - p = 112, - q = 113, - r = 114, - s = 115, - t = 116, - u = 117, - v = 118, - w = 119, - x = 120, - y = 121, - z = 122, - A = 65, - B = 66, - C = 67, - D = 68, - E = 69, - F = 70, - G = 71, - H = 72, - I = 73, - J = 74, - K = 75, - L = 76, - M = 77, - N = 78, - O = 79, - P = 80, - Q = 81, - R = 82, - S = 83, - T = 84, - U = 85, - V = 86, - W = 87, - X = 88, - Y = 89, - Z = 90, - ampersand = 38, - asterisk = 42, - at = 64, - backslash = 92, - backtick = 96, - bar = 124, - caret = 94, - closeBrace = 125, - closeBracket = 93, - closeParen = 41, - colon = 58, - comma = 44, - dot = 46, - doubleQuote = 34, - equals = 61, - exclamation = 33, - greaterThan = 62, - hash = 35, - lessThan = 60, - minus = 45, - openBrace = 123, - openBracket = 91, - openParen = 40, - percent = 37, - plus = 43, - question = 63, - semicolon = 59, - singleQuote = 39, - slash = 47, - tilde = 126, - backspace = 8, - formFeed = 12, - byteOrderMark = 65279, - tab = 9, - verticalTab = 11 - } interface UpToDateHost { fileExists(fileName: string): boolean; getModifiedTime(fileName: string): Date; @@ -4038,7 +2659,6 @@ declare namespace ts { * If changing this, remember to change `moduleResolutionIsEqualTo`. */ interface ResolvedModuleFull extends ResolvedModule { - readonly originalPath?: string; /** * Extension of resolvedFileName. This must match what's at the end of resolvedFileName. * This is optional for backwards-compatibility, but will be added if not provided. @@ -4075,7 +2695,6 @@ declare namespace ts { } interface ResolvedModuleWithFailedLookupLocations { readonly resolvedModule: ResolvedModuleFull | undefined; - readonly failedLookupLocations: ReadonlyArray; } interface ResolvedTypeReferenceDirective { primary: boolean; @@ -4086,7 +2705,6 @@ declare namespace ts { readonly resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective | undefined; readonly failedLookupLocations: ReadonlyArray; } - type HasInvalidatedResolution = (sourceFile: Path) => boolean; interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined; getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined; @@ -4106,97 +2724,19 @@ declare namespace ts { */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; getEnvironmentVariable?(name: string): string | undefined; - onReleaseOldSourceFile?(oldSourceFile: SourceFile, oldOptions: CompilerOptions): void; - hasInvalidatedResolution?: HasInvalidatedResolution; - hasChangedAutomaticTypeDirectiveNames?: boolean; createHash?(data: string): string; getModifiedTime?(fileName: string): Date; setModifiedTime?(fileName: string, date: Date): void; deleteFile?(fileName: string): void; } - enum TransformFlags { - None = 0, - TypeScript = 1, - ContainsTypeScript = 2, - ContainsJsx = 4, - ContainsESNext = 8, - ContainsES2017 = 16, - ContainsES2016 = 32, - ES2015 = 64, - ContainsES2015 = 128, - Generator = 256, - ContainsGenerator = 512, - DestructuringAssignment = 1024, - ContainsDestructuringAssignment = 2048, - ContainsDecorators = 4096, - ContainsPropertyInitializer = 8192, - ContainsLexicalThis = 16384, - ContainsCapturedLexicalThis = 32768, - ContainsLexicalThisInComputedPropertyName = 65536, - ContainsDefaultValueAssignments = 131072, - ContainsParameterPropertyAssignments = 262144, - ContainsSpread = 524288, - ContainsObjectSpread = 1048576, - ContainsRest = 524288, - ContainsObjectRest = 1048576, - ContainsComputedPropertyName = 2097152, - ContainsBlockScopedBinding = 4194304, - ContainsBindingPattern = 8388608, - ContainsYield = 16777216, - ContainsHoistedDeclarationOrCompletion = 33554432, - ContainsDynamicImport = 67108864, - Super = 134217728, - ContainsSuper = 268435456, - HasComputedFlags = 536870912, - AssertTypeScript = 3, - AssertJsx = 4, - AssertESNext = 8, - AssertES2017 = 16, - AssertES2016 = 32, - AssertES2015 = 192, - AssertGenerator = 768, - AssertDestructuringAssignment = 3072, - OuterExpressionExcludes = 536872257, - PropertyAccessExcludes = 671089985, - NodeExcludes = 939525441, - ArrowFunctionExcludes = 1003902273, - FunctionExcludes = 1003935041, - ConstructorExcludes = 1003668801, - MethodOrAccessorExcludes = 1003668801, - ClassExcludes = 942011713, - ModuleExcludes = 977327425, - TypeExcludes = -3, - ObjectLiteralExcludes = 942740801, - ArrayLiteralOrCallOrNewExcludes = 940049729, - VariableDeclarationListExcludes = 948962625, - ParameterExcludes = 939525441, - CatchClauseExcludes = 940574017, - BindingPatternExcludes = 940049729, - TypeScriptClassSyntaxMask = 274432, - ES2015FunctionSyntaxMask = 163840 - } interface SourceMapRange extends TextRange { source?: SourceMapSource; } interface SourceMapSource { fileName: string; text: string; - lineMap: ReadonlyArray; skipTrivia?: (pos: number) => number; } - interface EmitNode { - annotatedNodes?: Node[]; - flags: EmitFlags; - leadingComments?: SynthesizedComment[]; - trailingComments?: SynthesizedComment[]; - commentRange?: TextRange; - sourceMapRange?: SourceMapRange; - tokenSourceMapRanges?: (SourceMapRange | undefined)[]; - constantValue?: string | number; - externalHelpersModuleName?: Identifier; - helpers?: EmitHelper[]; - startsOnNewLine?: boolean; - } enum EmitFlags { None = 0, SingleLine = 1, @@ -4226,9 +2766,7 @@ declare namespace ts { NoHoisting = 2097152, HasEndOfDeclarationMarker = 4194304, Iterator = 8388608, - NoAsciiEscaping = 16777216, - TypeScriptClassWrapper = 33554432, - NeverApplyImportHelper = 67108864 + NoAsciiEscaping = 16777216 } interface EmitHelper { readonly name: string; @@ -4236,38 +2774,7 @@ declare namespace ts { readonly text: string | ((node: EmitHelperUniqueNameCallback) => string); readonly priority?: number; } - type UniqueNameHandler = (baseName: string, checkFn?: (name: string) => boolean, optimistic?: boolean) => string; type EmitHelperUniqueNameCallback = (name: string) => string; - /** - * Used by the checker, this enum keeps track of external emit helpers that should be type - * checked. - */ - enum ExternalEmitHelpers { - Extends = 1, - Assign = 2, - Rest = 4, - Decorate = 8, - Metadata = 16, - Param = 32, - Awaiter = 64, - Generator = 128, - Values = 256, - Read = 512, - Spread = 1024, - Await = 2048, - AsyncGenerator = 4096, - AsyncDelegator = 8192, - AsyncValues = 16384, - ExportStar = 32768, - MakeTemplateObject = 65536, - FirstEmitHelper = 1, - LastEmitHelper = 65536, - ForOfIncludes = 256, - ForAwaitOfIncludes = 16384, - AsyncGeneratorIncludes = 6144, - AsyncDelegatorIncludes = 26624, - SpreadIncludes = 1536 - } enum EmitHint { SourceFile = 0, Expression = 1, @@ -4275,20 +2782,7 @@ declare namespace ts { MappedTypeParameter = 3, Unspecified = 4 } - interface EmitHost extends ScriptReferenceHost, ModuleSpecifierResolutionHost { - getSourceFiles(): ReadonlyArray; - getCurrentDirectory(): string; - isSourceFileFromExternalLibrary(file: SourceFile): boolean; - getCommonSourceDirectory(): string; - getCanonicalFileName(fileName: string): string; - getNewLine(): string; - isEmitBlocked(emitFileName: string): boolean; - getPrependNodes(): ReadonlyArray; - writeFile: WriteFileCallback; - } interface TransformationContext { - getEmitResolver(): EmitResolver; - getEmitHost(): EmitHost; /** Gets the compiler options supplied to the transformer. */ getCompilerOptions(): CompilerOptions; /** Starts a new lexical environment. */ @@ -4337,7 +2831,6 @@ declare namespace ts { * before returning the `NodeTransformer` callback. */ onEmitNode: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void; - addDiagnostic(diag: DiagnosticWithLocation): void; } interface TransformationResult { /** Gets the transformed source files. */ @@ -4405,20 +2898,6 @@ declare namespace ts { * Prints a bundle of source files as-is, without any emit transformations. */ printBundle(bundle: Bundle): string; - writeNode(hint: EmitHint, node: Node, sourceFile: SourceFile | undefined, writer: EmitTextWriter): void; - writeList(format: ListFormat, list: NodeArray | undefined, sourceFile: SourceFile | undefined, writer: EmitTextWriter): void; - writeFile(sourceFile: SourceFile, writer: EmitTextWriter): void; - writeBundle(bundle: Bundle, writer: EmitTextWriter, info?: BundleInfo): void; - } - /** - * When a bundle contains prepended content, we store a file on disk indicating where the non-prepended - * content of that file starts. On a subsequent build where there are no upstream .d.ts changes, we - * read the bundle info file and the original .js file to quickly re-use portion of the file - * that didn't originate in prepended content. - */ - interface BundleInfo { - originalOffset: number; - totalLength: number; } interface PrintHandlers { /** @@ -4462,58 +2941,23 @@ declare namespace ts { * ``` */ substituteNode?(hint: EmitHint, node: Node): Node; - onEmitSourceMapOfNode?: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void; - onEmitSourceMapOfToken?: (node: Node | undefined, token: SyntaxKind, writer: (s: string) => void, pos: number, emitCallback: (token: SyntaxKind, writer: (s: string) => void, pos: number) => number) => number; - onEmitSourceMapOfPosition?: (pos: number) => void; - onSetSourceFile?: (node: SourceFile) => void; - onBeforeEmitNodeArray?: (nodes: NodeArray | undefined) => void; - onAfterEmitNodeArray?: (nodes: NodeArray | undefined) => void; - onBeforeEmitToken?: (node: Node) => void; - onAfterEmitToken?: (node: Node) => void; } interface PrinterOptions { removeComments?: boolean; newLine?: NewLineKind; omitTrailingSemicolon?: boolean; noEmitHelpers?: boolean; - module?: CompilerOptions["module"]; - target?: CompilerOptions["target"]; - sourceMap?: boolean; - inlineSourceMap?: boolean; - extendedDiagnostics?: boolean; - onlyPrintJsDocStyle?: boolean; - } - interface EmitTextWriter extends SymbolWriter { - write(s: string): void; - writeTextOfNode(text: string, node: Node): void; - getText(): string; - rawWrite(s: string): void; - writeLiteral(s: string): void; - getTextPos(): number; - getLine(): number; - getColumn(): number; - getIndent(): number; - isAtStartOfLine(): boolean; } interface GetEffectiveTypeRootsHost { directoryExists?(directoryName: string): boolean; getCurrentDirectory?(): string; } - /** @internal */ - interface ModuleSpecifierResolutionHost extends GetEffectiveTypeRootsHost { - useCaseSensitiveFileNames?(): boolean; - fileExists?(path: string): boolean; - readFile?(path: string): string | undefined; - getSourceFiles?(): ReadonlyArray; - } /** @deprecated See comment on SymbolWriter */ interface SymbolTracker { trackSymbol?(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; reportInaccessibleThisError?(): void; reportPrivateInBaseOfClassExpression?(propertyName: string): void; reportInaccessibleUniqueSymbolError?(): void; - moduleResolverHost?: ModuleSpecifierResolutionHost; - trackReferencedAmbientModule?(decl: ModuleDeclaration): void; } interface TextSpan { start: number; @@ -4523,13 +2967,6 @@ declare namespace ts { span: TextSpan; newLength: number; } - interface DiagnosticCollection { - add(diagnostic: Diagnostic): void; - getGlobalDiagnostics(): Diagnostic[]; - getDiagnostics(fileName: string): DiagnosticWithLocation[]; - getDiagnostics(): Diagnostic[]; - reattachFileDiagnostics(newFile: SourceFile): void; - } interface SyntaxList extends Node { _children: Node[]; } @@ -4598,145 +3035,10 @@ declare namespace ts { Parameters = 1296, IndexSignatureParameters = 4432 } - enum PragmaKindFlags { - None = 0, - /** - * Triple slash comment of the form - * /// - */ - TripleSlashXML = 1, - /** - * Single line comment of the form - * // @pragma-name argval1 argval2 - * or - * /// @pragma-name argval1 argval2 - */ - SingleLine = 2, - /** - * Multiline non-jsdoc pragma of the form - * /* @pragma-name argval1 argval2 * / - */ - MultiLine = 4, - All = 7, - Default = 7 - } - interface PragmaArgumentSpecification { - name: TName; - optional?: boolean; - captureSpan?: boolean; - } - interface PragmaDefinition { - args?: [PragmaArgumentSpecification] | [PragmaArgumentSpecification, PragmaArgumentSpecification] | [PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification] | [PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification]; - kind?: PragmaKindFlags; - } - const commentPragmas: { - "reference": { - args: [{ - name: "types"; - optional: true; - captureSpan: true; - }, { - name: "lib"; - optional: true; - captureSpan: true; - }, { - name: "path"; - optional: true; - captureSpan: true; - }, { - name: "no-default-lib"; - optional: true; - }]; - kind: PragmaKindFlags; - }; - "amd-dependency": { - args: [{ - name: "path"; - }, { - name: "name"; - optional: true; - }]; - kind: PragmaKindFlags; - }; - "amd-module": { - args: [{ - name: "name"; - }]; - kind: PragmaKindFlags; - }; - "ts-check": { - kind: PragmaKindFlags; - }; - "ts-nocheck": { - kind: PragmaKindFlags; - }; - "jsx": { - args: [{ - name: "factory"; - }]; - kind: PragmaKindFlags; - }; - }; - type PragmaArgTypeMaybeCapture = TDesc extends { - captureSpan: true; - } ? { - value: string; - pos: number; - end: number; - } : string; - type PragmaArgTypeOptional = TDesc extends { - optional: true; - } ? { - [K in TName]?: PragmaArgTypeMaybeCapture; - } : { - [K in TName]: PragmaArgTypeMaybeCapture; - }; - /** - * Maps a pragma definition into the desired shape for its arguments object - * Maybe the below is a good argument for types being iterable on struture in some way. - */ - type PragmaArgumentType = T extends { - args: [PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification]; - } ? PragmaArgTypeOptional & PragmaArgTypeOptional & PragmaArgTypeOptional & PragmaArgTypeOptional : T extends { - args: [PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification]; - } ? PragmaArgTypeOptional & PragmaArgTypeOptional & PragmaArgTypeOptional : T extends { - args: [PragmaArgumentSpecification, PragmaArgumentSpecification]; - } ? PragmaArgTypeOptional & PragmaArgTypeOptional : T extends { - args: [PragmaArgumentSpecification]; - } ? PragmaArgTypeOptional : object; - type ConcretePragmaSpecs = typeof commentPragmas; - type PragmaPsuedoMap = { - [K in keyof ConcretePragmaSpecs]?: { - arguments: PragmaArgumentType; - range: CommentRange; - }; - }; - type PragmaPsuedoMapEntry = { - [K in keyof PragmaPsuedoMap]: { - name: K; - args: PragmaPsuedoMap[K]; - }; - }[keyof PragmaPsuedoMap]; - /** - * A strongly-typed es6 map of pragma entries, the values of which are either a single argument - * value (if only one was found), or an array of multiple argument values if the pragma is present - * in multiple places - */ - interface PragmaMap extends Map { - set(key: TKey, value: PragmaPsuedoMap[TKey] | PragmaPsuedoMap[TKey][]): this; - get(key: TKey): PragmaPsuedoMap[TKey] | PragmaPsuedoMap[TKey][]; - forEach(action: (value: PragmaPsuedoMap[TKey] | PragmaPsuedoMap[TKey][], key: TKey) => void): void; - } } declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; declare function clearTimeout(handle: any): void; declare namespace ts { - /** - * Set a high stack trace limit to provide more information in case of an error. - * Called for command-line and server use cases. - * Not called if TypeScript is used as a library. - */ - function setStackTraceLimit(): void; enum FileWatcherEventKind { Created = 0, Changed = 1, @@ -4744,47 +3046,6 @@ declare namespace ts { } type FileWatcherCallback = (fileName: string, eventKind: FileWatcherEventKind) => void; type DirectoryWatcherCallback = (fileName: string) => void; - interface WatchedFile { - readonly fileName: string; - readonly callback: FileWatcherCallback; - mtime: Date; - } - enum PollingInterval { - High = 2000, - Medium = 500, - Low = 250 - } - function watchFileUsingPriorityPollingInterval(host: System, fileName: string, callback: FileWatcherCallback, watchPriority: PollingInterval): FileWatcher; - type HostWatchFile = (fileName: string, callback: FileWatcherCallback, pollingInterval: PollingInterval | undefined) => FileWatcher; - type HostWatchDirectory = (fileName: string, callback: DirectoryWatcherCallback, recursive?: boolean) => FileWatcher; - const missingFileModifiedTime: Date; - let unchangedPollThresholds: { - [PollingInterval.Low]: number; - [PollingInterval.Medium]: number; - [PollingInterval.High]: number; - }; - function setCustomPollingValues(system: System): void; - function createDynamicPriorityPollingWatchFile(host: { - getModifiedTime: System["getModifiedTime"]; - setTimeout: System["setTimeout"]; - }): HostWatchFile; - /** - * Returns true if file status changed - */ - function onWatchedFileStat(watchedFile: WatchedFile, modifiedTime: Date): boolean; - interface RecursiveDirectoryWatcherHost { - watchDirectory: HostWatchDirectory; - getAccessibleSortedChildDirectories(path: string): ReadonlyArray; - directoryExists(dir: string): boolean; - filePathComparer: Comparer; - realpath(s: string): string; - } - /** - * Watch the directory recursively using host provided method to watch child directories - * that means if this is recursive watcher, watch the children directories as well - * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile) - */ - function createRecursiveDirectoryWatcher(host: RecursiveDirectoryWatcherHost): (directoryName: string, callback: DirectoryWatcherCallback) => FileWatcher; interface System { args: string[]; newLine: string; @@ -4820,13 +3081,9 @@ declare namespace ts { getMemoryUsage?(): number; exit(exitCode?: number): void; realpath?(path: string): string; - getEnvironmentVariable(name: string): string; - tryEnableSourceMapsForHost?(): void; - debugMode?: boolean; setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; clearTimeout?(timeoutId: any): void; clearScreen?(): void; - setBlocking?(): void; base64decode?(input: string): string; base64encode?(input: string): string; } @@ -4836,1120 +3093,8 @@ declare namespace ts { function getNodeMajorVersion(): number | undefined; let sys: System; } -declare namespace ts { - const Diagnostics: { - Unterminated_string_literal: DiagnosticMessage; - Identifier_expected: DiagnosticMessage; - _0_expected: DiagnosticMessage; - A_file_cannot_have_a_reference_to_itself: DiagnosticMessage; - Trailing_comma_not_allowed: DiagnosticMessage; - Asterisk_Slash_expected: DiagnosticMessage; - An_element_access_expression_should_take_an_argument: DiagnosticMessage; - Unexpected_token: DiagnosticMessage; - A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma: DiagnosticMessage; - A_rest_parameter_must_be_last_in_a_parameter_list: DiagnosticMessage; - Parameter_cannot_have_question_mark_and_initializer: DiagnosticMessage; - A_required_parameter_cannot_follow_an_optional_parameter: DiagnosticMessage; - An_index_signature_cannot_have_a_rest_parameter: DiagnosticMessage; - An_index_signature_parameter_cannot_have_an_accessibility_modifier: DiagnosticMessage; - An_index_signature_parameter_cannot_have_a_question_mark: DiagnosticMessage; - An_index_signature_parameter_cannot_have_an_initializer: DiagnosticMessage; - An_index_signature_must_have_a_type_annotation: DiagnosticMessage; - An_index_signature_parameter_must_have_a_type_annotation: DiagnosticMessage; - An_index_signature_parameter_type_must_be_string_or_number: DiagnosticMessage; - readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: DiagnosticMessage; - Accessibility_modifier_already_seen: DiagnosticMessage; - _0_modifier_must_precede_1_modifier: DiagnosticMessage; - _0_modifier_already_seen: DiagnosticMessage; - _0_modifier_cannot_appear_on_a_class_element: DiagnosticMessage; - super_must_be_followed_by_an_argument_list_or_member_access: DiagnosticMessage; - Only_ambient_modules_can_use_quoted_names: DiagnosticMessage; - Statements_are_not_allowed_in_ambient_contexts: DiagnosticMessage; - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: DiagnosticMessage; - Initializers_are_not_allowed_in_ambient_contexts: DiagnosticMessage; - _0_modifier_cannot_be_used_in_an_ambient_context: DiagnosticMessage; - _0_modifier_cannot_be_used_with_a_class_declaration: DiagnosticMessage; - _0_modifier_cannot_be_used_here: DiagnosticMessage; - _0_modifier_cannot_appear_on_a_data_property: DiagnosticMessage; - _0_modifier_cannot_appear_on_a_module_or_namespace_element: DiagnosticMessage; - A_0_modifier_cannot_be_used_with_an_interface_declaration: DiagnosticMessage; - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: DiagnosticMessage; - A_rest_parameter_cannot_be_optional: DiagnosticMessage; - A_rest_parameter_cannot_have_an_initializer: DiagnosticMessage; - A_set_accessor_must_have_exactly_one_parameter: DiagnosticMessage; - A_set_accessor_cannot_have_an_optional_parameter: DiagnosticMessage; - A_set_accessor_parameter_cannot_have_an_initializer: DiagnosticMessage; - A_set_accessor_cannot_have_rest_parameter: DiagnosticMessage; - A_get_accessor_cannot_have_parameters: DiagnosticMessage; - Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: DiagnosticMessage; - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: DiagnosticMessage; - An_async_function_or_method_must_have_a_valid_awaitable_return_type: DiagnosticMessage; - The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: DiagnosticMessage; - A_promise_must_have_a_then_method: DiagnosticMessage; - The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback: DiagnosticMessage; - Enum_member_must_have_initializer: DiagnosticMessage; - Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: DiagnosticMessage; - An_export_assignment_cannot_be_used_in_a_namespace: DiagnosticMessage; - The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: DiagnosticMessage; - In_ambient_enum_declarations_member_initializer_must_be_constant_expression: DiagnosticMessage; - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: DiagnosticMessage; - Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces: DiagnosticMessage; - _0_modifier_cannot_appear_on_a_type_member: DiagnosticMessage; - _0_modifier_cannot_appear_on_an_index_signature: DiagnosticMessage; - A_0_modifier_cannot_be_used_with_an_import_declaration: DiagnosticMessage; - Invalid_reference_directive_syntax: DiagnosticMessage; - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: DiagnosticMessage; - An_accessor_cannot_be_declared_in_an_ambient_context: DiagnosticMessage; - _0_modifier_cannot_appear_on_a_constructor_declaration: DiagnosticMessage; - _0_modifier_cannot_appear_on_a_parameter: DiagnosticMessage; - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: DiagnosticMessage; - Type_parameters_cannot_appear_on_a_constructor_declaration: DiagnosticMessage; - Type_annotation_cannot_appear_on_a_constructor_declaration: DiagnosticMessage; - An_accessor_cannot_have_type_parameters: DiagnosticMessage; - A_set_accessor_cannot_have_a_return_type_annotation: DiagnosticMessage; - An_index_signature_must_have_exactly_one_parameter: DiagnosticMessage; - _0_list_cannot_be_empty: DiagnosticMessage; - Type_parameter_list_cannot_be_empty: DiagnosticMessage; - Type_argument_list_cannot_be_empty: DiagnosticMessage; - Invalid_use_of_0_in_strict_mode: DiagnosticMessage; - with_statements_are_not_allowed_in_strict_mode: DiagnosticMessage; - delete_cannot_be_called_on_an_identifier_in_strict_mode: DiagnosticMessage; - A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator: DiagnosticMessage; - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: DiagnosticMessage; - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: DiagnosticMessage; - Jump_target_cannot_cross_function_boundary: DiagnosticMessage; - A_return_statement_can_only_be_used_within_a_function_body: DiagnosticMessage; - Expression_expected: DiagnosticMessage; - Type_expected: DiagnosticMessage; - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: DiagnosticMessage; - Duplicate_label_0: DiagnosticMessage; - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: DiagnosticMessage; - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: DiagnosticMessage; - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: DiagnosticMessage; - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: DiagnosticMessage; - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: DiagnosticMessage; - An_export_assignment_cannot_have_modifiers: DiagnosticMessage; - Octal_literals_are_not_allowed_in_strict_mode: DiagnosticMessage; - Variable_declaration_list_cannot_be_empty: DiagnosticMessage; - Digit_expected: DiagnosticMessage; - Hexadecimal_digit_expected: DiagnosticMessage; - Unexpected_end_of_text: DiagnosticMessage; - Invalid_character: DiagnosticMessage; - Declaration_or_statement_expected: DiagnosticMessage; - Statement_expected: DiagnosticMessage; - case_or_default_expected: DiagnosticMessage; - Property_or_signature_expected: DiagnosticMessage; - Enum_member_expected: DiagnosticMessage; - Variable_declaration_expected: DiagnosticMessage; - Argument_expression_expected: DiagnosticMessage; - Property_assignment_expected: DiagnosticMessage; - Expression_or_comma_expected: DiagnosticMessage; - Parameter_declaration_expected: DiagnosticMessage; - Type_parameter_declaration_expected: DiagnosticMessage; - Type_argument_expected: DiagnosticMessage; - String_literal_expected: DiagnosticMessage; - Line_break_not_permitted_here: DiagnosticMessage; - or_expected: DiagnosticMessage; - Declaration_expected: DiagnosticMessage; - Import_declarations_in_a_namespace_cannot_reference_a_module: DiagnosticMessage; - Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: DiagnosticMessage; - File_name_0_differs_from_already_included_file_name_1_only_in_casing: DiagnosticMessage; - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: DiagnosticMessage; - const_declarations_must_be_initialized: DiagnosticMessage; - const_declarations_can_only_be_declared_inside_a_block: DiagnosticMessage; - let_declarations_can_only_be_declared_inside_a_block: DiagnosticMessage; - Unterminated_template_literal: DiagnosticMessage; - Unterminated_regular_expression_literal: DiagnosticMessage; - An_object_member_cannot_be_declared_optional: DiagnosticMessage; - A_yield_expression_is_only_allowed_in_a_generator_body: DiagnosticMessage; - Computed_property_names_are_not_allowed_in_enums: DiagnosticMessage; - A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: DiagnosticMessage; - A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: DiagnosticMessage; - A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: DiagnosticMessage; - A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: DiagnosticMessage; - A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: DiagnosticMessage; - A_comma_expression_is_not_allowed_in_a_computed_property_name: DiagnosticMessage; - extends_clause_already_seen: DiagnosticMessage; - extends_clause_must_precede_implements_clause: DiagnosticMessage; - Classes_can_only_extend_a_single_class: DiagnosticMessage; - implements_clause_already_seen: DiagnosticMessage; - Interface_declaration_cannot_have_implements_clause: DiagnosticMessage; - Binary_digit_expected: DiagnosticMessage; - Octal_digit_expected: DiagnosticMessage; - Unexpected_token_expected: DiagnosticMessage; - Property_destructuring_pattern_expected: DiagnosticMessage; - Array_element_destructuring_pattern_expected: DiagnosticMessage; - A_destructuring_declaration_must_have_an_initializer: DiagnosticMessage; - An_implementation_cannot_be_declared_in_ambient_contexts: DiagnosticMessage; - Modifiers_cannot_appear_here: DiagnosticMessage; - Merge_conflict_marker_encountered: DiagnosticMessage; - A_rest_element_cannot_have_an_initializer: DiagnosticMessage; - A_parameter_property_may_not_be_declared_using_a_binding_pattern: DiagnosticMessage; - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: DiagnosticMessage; - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: DiagnosticMessage; - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: DiagnosticMessage; - An_import_declaration_cannot_have_modifiers: DiagnosticMessage; - Module_0_has_no_default_export: DiagnosticMessage; - An_export_declaration_cannot_have_modifiers: DiagnosticMessage; - Export_declarations_are_not_permitted_in_a_namespace: DiagnosticMessage; - Catch_clause_variable_cannot_have_a_type_annotation: DiagnosticMessage; - Catch_clause_variable_cannot_have_an_initializer: DiagnosticMessage; - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: DiagnosticMessage; - Unterminated_Unicode_escape_sequence: DiagnosticMessage; - Line_terminator_not_permitted_before_arrow: DiagnosticMessage; - Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: DiagnosticMessage; - Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead: DiagnosticMessage; - Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided: DiagnosticMessage; - Decorators_are_not_valid_here: DiagnosticMessage; - Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: DiagnosticMessage; - Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: DiagnosticMessage; - Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: DiagnosticMessage; - Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: DiagnosticMessage; - A_class_declaration_without_the_default_modifier_must_have_a_name: DiagnosticMessage; - Identifier_expected_0_is_a_reserved_word_in_strict_mode: DiagnosticMessage; - Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: DiagnosticMessage; - Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: DiagnosticMessage; - Invalid_use_of_0_Modules_are_automatically_in_strict_mode: DiagnosticMessage; - Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: DiagnosticMessage; - Export_assignment_is_not_supported_when_module_flag_is_system: DiagnosticMessage; - Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: DiagnosticMessage; - Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: DiagnosticMessage; - Generators_are_not_allowed_in_an_ambient_context: DiagnosticMessage; - An_overload_signature_cannot_be_declared_as_a_generator: DiagnosticMessage; - _0_tag_already_specified: DiagnosticMessage; - Signature_0_must_be_a_type_predicate: DiagnosticMessage; - Cannot_find_parameter_0: DiagnosticMessage; - Type_predicate_0_is_not_assignable_to_1: DiagnosticMessage; - Parameter_0_is_not_in_the_same_position_as_parameter_1: DiagnosticMessage; - A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: DiagnosticMessage; - A_type_predicate_cannot_reference_a_rest_parameter: DiagnosticMessage; - A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: DiagnosticMessage; - An_export_assignment_can_only_be_used_in_a_module: DiagnosticMessage; - An_import_declaration_can_only_be_used_in_a_namespace_or_module: DiagnosticMessage; - An_export_declaration_can_only_be_used_in_a_module: DiagnosticMessage; - An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: DiagnosticMessage; - A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: DiagnosticMessage; - The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: DiagnosticMessage; - The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: DiagnosticMessage; - Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: DiagnosticMessage; - Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: DiagnosticMessage; - Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: DiagnosticMessage; - Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: DiagnosticMessage; - abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: DiagnosticMessage; - _0_modifier_cannot_be_used_with_1_modifier: DiagnosticMessage; - Abstract_methods_can_only_appear_within_an_abstract_class: DiagnosticMessage; - Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: DiagnosticMessage; - An_interface_property_cannot_have_an_initializer: DiagnosticMessage; - A_type_literal_property_cannot_have_an_initializer: DiagnosticMessage; - A_class_member_cannot_have_the_0_keyword: DiagnosticMessage; - A_decorator_can_only_decorate_a_method_implementation_not_an_overload: DiagnosticMessage; - Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: DiagnosticMessage; - Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: DiagnosticMessage; - Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: DiagnosticMessage; - _0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag: DiagnosticMessage; - A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal: DiagnosticMessage; - A_definite_assignment_assertion_is_not_permitted_in_this_context: DiagnosticMessage; - A_rest_element_must_be_last_in_a_tuple_type: DiagnosticMessage; - A_required_element_cannot_follow_an_optional_element: DiagnosticMessage; - with_statements_are_not_allowed_in_an_async_function_block: DiagnosticMessage; - await_expression_is_only_allowed_within_an_async_function: DiagnosticMessage; - can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: DiagnosticMessage; - The_body_of_an_if_statement_cannot_be_the_empty_statement: DiagnosticMessage; - Global_module_exports_may_only_appear_in_module_files: DiagnosticMessage; - Global_module_exports_may_only_appear_in_declaration_files: DiagnosticMessage; - Global_module_exports_may_only_appear_at_top_level: DiagnosticMessage; - A_parameter_property_cannot_be_declared_using_a_rest_parameter: DiagnosticMessage; - An_abstract_accessor_cannot_have_an_implementation: DiagnosticMessage; - A_default_export_can_only_be_used_in_an_ECMAScript_style_module: DiagnosticMessage; - Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: DiagnosticMessage; - Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: DiagnosticMessage; - Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: DiagnosticMessage; - Dynamic_import_is_only_supported_when_module_flag_is_commonjs_or_esNext: DiagnosticMessage; - Dynamic_import_must_have_one_specifier_as_an_argument: DiagnosticMessage; - Specifier_of_dynamic_import_cannot_be_spread_element: DiagnosticMessage; - Dynamic_import_cannot_have_type_arguments: DiagnosticMessage; - String_literal_with_double_quotes_expected: DiagnosticMessage; - Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal: DiagnosticMessage; - _0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0: DiagnosticMessage; - A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly: DiagnosticMessage; - A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly: DiagnosticMessage; - A_variable_whose_type_is_a_unique_symbol_type_must_be_const: DiagnosticMessage; - unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name: DiagnosticMessage; - unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement: DiagnosticMessage; - unique_symbol_types_are_not_allowed_here: DiagnosticMessage; - An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead: DiagnosticMessage; - An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead: DiagnosticMessage; - infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type: DiagnosticMessage; - Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: DiagnosticMessage; - Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here: DiagnosticMessage; - Type_arguments_cannot_be_used_here: DiagnosticMessage; - The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options: DiagnosticMessage; - Duplicate_identifier_0: DiagnosticMessage; - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: DiagnosticMessage; - Static_members_cannot_reference_class_type_parameters: DiagnosticMessage; - Circular_definition_of_import_alias_0: DiagnosticMessage; - Cannot_find_name_0: DiagnosticMessage; - Module_0_has_no_exported_member_1: DiagnosticMessage; - File_0_is_not_a_module: DiagnosticMessage; - Cannot_find_module_0: DiagnosticMessage; - Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: DiagnosticMessage; - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: DiagnosticMessage; - Type_0_recursively_references_itself_as_a_base_type: DiagnosticMessage; - A_class_may_only_extend_another_class: DiagnosticMessage; - An_interface_may_only_extend_a_class_or_another_interface: DiagnosticMessage; - Type_parameter_0_has_a_circular_constraint: DiagnosticMessage; - Generic_type_0_requires_1_type_argument_s: DiagnosticMessage; - Type_0_is_not_generic: DiagnosticMessage; - Global_type_0_must_be_a_class_or_interface_type: DiagnosticMessage; - Global_type_0_must_have_1_type_parameter_s: DiagnosticMessage; - Cannot_find_global_type_0: DiagnosticMessage; - Named_property_0_of_types_1_and_2_are_not_identical: DiagnosticMessage; - Interface_0_cannot_simultaneously_extend_types_1_and_2: DiagnosticMessage; - Excessive_stack_depth_comparing_types_0_and_1: DiagnosticMessage; - Type_0_is_not_assignable_to_type_1: DiagnosticMessage; - Cannot_redeclare_exported_variable_0: DiagnosticMessage; - Property_0_is_missing_in_type_1: DiagnosticMessage; - Property_0_is_private_in_type_1_but_not_in_type_2: DiagnosticMessage; - Types_of_property_0_are_incompatible: DiagnosticMessage; - Property_0_is_optional_in_type_1_but_required_in_type_2: DiagnosticMessage; - Types_of_parameters_0_and_1_are_incompatible: DiagnosticMessage; - Index_signature_is_missing_in_type_0: DiagnosticMessage; - Index_signatures_are_incompatible: DiagnosticMessage; - this_cannot_be_referenced_in_a_module_or_namespace_body: DiagnosticMessage; - this_cannot_be_referenced_in_current_location: DiagnosticMessage; - this_cannot_be_referenced_in_constructor_arguments: DiagnosticMessage; - this_cannot_be_referenced_in_a_static_property_initializer: DiagnosticMessage; - super_can_only_be_referenced_in_a_derived_class: DiagnosticMessage; - super_cannot_be_referenced_in_constructor_arguments: DiagnosticMessage; - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: DiagnosticMessage; - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: DiagnosticMessage; - Property_0_does_not_exist_on_type_1: DiagnosticMessage; - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: DiagnosticMessage; - Property_0_is_private_and_only_accessible_within_class_1: DiagnosticMessage; - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: DiagnosticMessage; - This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: DiagnosticMessage; - Type_0_does_not_satisfy_the_constraint_1: DiagnosticMessage; - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: DiagnosticMessage; - Call_target_does_not_contain_any_signatures: DiagnosticMessage; - Untyped_function_calls_may_not_accept_type_arguments: DiagnosticMessage; - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: DiagnosticMessage; - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures: DiagnosticMessage; - Only_a_void_function_can_be_called_with_the_new_keyword: DiagnosticMessage; - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: DiagnosticMessage; - Type_0_cannot_be_converted_to_type_1: DiagnosticMessage; - Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: DiagnosticMessage; - This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: DiagnosticMessage; - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: DiagnosticMessage; - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: DiagnosticMessage; - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: DiagnosticMessage; - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: DiagnosticMessage; - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: DiagnosticMessage; - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: DiagnosticMessage; - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: DiagnosticMessage; - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: DiagnosticMessage; - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: DiagnosticMessage; - The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: DiagnosticMessage; - Operator_0_cannot_be_applied_to_types_1_and_2: DiagnosticMessage; - Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: DiagnosticMessage; - Type_parameter_name_cannot_be_0: DiagnosticMessage; - A_parameter_property_is_only_allowed_in_a_constructor_implementation: DiagnosticMessage; - A_rest_parameter_must_be_of_an_array_type: DiagnosticMessage; - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: DiagnosticMessage; - Parameter_0_cannot_be_referenced_in_its_initializer: DiagnosticMessage; - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: DiagnosticMessage; - Duplicate_string_index_signature: DiagnosticMessage; - Duplicate_number_index_signature: DiagnosticMessage; - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: DiagnosticMessage; - Constructors_for_derived_classes_must_contain_a_super_call: DiagnosticMessage; - A_get_accessor_must_return_a_value: DiagnosticMessage; - Getter_and_setter_accessors_do_not_agree_in_visibility: DiagnosticMessage; - get_and_set_accessor_must_have_the_same_type: DiagnosticMessage; - A_signature_with_an_implementation_cannot_use_a_string_literal_type: DiagnosticMessage; - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: DiagnosticMessage; - Overload_signatures_must_all_be_exported_or_non_exported: DiagnosticMessage; - Overload_signatures_must_all_be_ambient_or_non_ambient: DiagnosticMessage; - Overload_signatures_must_all_be_public_private_or_protected: DiagnosticMessage; - Overload_signatures_must_all_be_optional_or_required: DiagnosticMessage; - Function_overload_must_be_static: DiagnosticMessage; - Function_overload_must_not_be_static: DiagnosticMessage; - Function_implementation_name_must_be_0: DiagnosticMessage; - Constructor_implementation_is_missing: DiagnosticMessage; - Function_implementation_is_missing_or_not_immediately_following_the_declaration: DiagnosticMessage; - Multiple_constructor_implementations_are_not_allowed: DiagnosticMessage; - Duplicate_function_implementation: DiagnosticMessage; - Overload_signature_is_not_compatible_with_function_implementation: DiagnosticMessage; - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: DiagnosticMessage; - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: DiagnosticMessage; - Declaration_name_conflicts_with_built_in_global_identifier_0: DiagnosticMessage; - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: DiagnosticMessage; - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: DiagnosticMessage; - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: DiagnosticMessage; - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: DiagnosticMessage; - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: DiagnosticMessage; - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: DiagnosticMessage; - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: DiagnosticMessage; - The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: DiagnosticMessage; - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0: DiagnosticMessage; - Setters_cannot_return_a_value: DiagnosticMessage; - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: DiagnosticMessage; - The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: DiagnosticMessage; - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: DiagnosticMessage; - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: DiagnosticMessage; - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: DiagnosticMessage; - Class_name_cannot_be_0: DiagnosticMessage; - Class_0_incorrectly_extends_base_class_1: DiagnosticMessage; - Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2: DiagnosticMessage; - Class_static_side_0_incorrectly_extends_base_class_static_side_1: DiagnosticMessage; - Class_0_incorrectly_implements_interface_1: DiagnosticMessage; - A_class_may_only_implement_another_class_or_interface: DiagnosticMessage; - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: DiagnosticMessage; - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: DiagnosticMessage; - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: DiagnosticMessage; - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: DiagnosticMessage; - Interface_name_cannot_be_0: DiagnosticMessage; - All_declarations_of_0_must_have_identical_type_parameters: DiagnosticMessage; - Interface_0_incorrectly_extends_interface_1: DiagnosticMessage; - Enum_name_cannot_be_0: DiagnosticMessage; - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: DiagnosticMessage; - A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: DiagnosticMessage; - A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: DiagnosticMessage; - Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: DiagnosticMessage; - Ambient_module_declaration_cannot_specify_relative_module_name: DiagnosticMessage; - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: DiagnosticMessage; - Import_name_cannot_be_0: DiagnosticMessage; - Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: DiagnosticMessage; - Import_declaration_conflicts_with_local_declaration_of_0: DiagnosticMessage; - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: DiagnosticMessage; - Types_have_separate_declarations_of_a_private_property_0: DiagnosticMessage; - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: DiagnosticMessage; - Property_0_is_protected_in_type_1_but_public_in_type_2: DiagnosticMessage; - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: DiagnosticMessage; - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: DiagnosticMessage; - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: DiagnosticMessage; - Block_scoped_variable_0_used_before_its_declaration: DiagnosticMessage; - Class_0_used_before_its_declaration: DiagnosticMessage; - Enum_0_used_before_its_declaration: DiagnosticMessage; - Cannot_redeclare_block_scoped_variable_0: DiagnosticMessage; - An_enum_member_cannot_have_a_numeric_name: DiagnosticMessage; - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: DiagnosticMessage; - Variable_0_is_used_before_being_assigned: DiagnosticMessage; - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: DiagnosticMessage; - Type_alias_0_circularly_references_itself: DiagnosticMessage; - Type_alias_name_cannot_be_0: DiagnosticMessage; - An_AMD_module_cannot_have_multiple_name_assignments: DiagnosticMessage; - Type_0_has_no_property_1_and_no_string_index_signature: DiagnosticMessage; - Type_0_has_no_property_1: DiagnosticMessage; - Type_0_is_not_an_array_type: DiagnosticMessage; - A_rest_element_must_be_last_in_a_destructuring_pattern: DiagnosticMessage; - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: DiagnosticMessage; - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: DiagnosticMessage; - this_cannot_be_referenced_in_a_computed_property_name: DiagnosticMessage; - super_cannot_be_referenced_in_a_computed_property_name: DiagnosticMessage; - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: DiagnosticMessage; - Cannot_find_global_value_0: DiagnosticMessage; - The_0_operator_cannot_be_applied_to_type_symbol: DiagnosticMessage; - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: DiagnosticMessage; - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: DiagnosticMessage; - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: DiagnosticMessage; - Enum_declarations_must_all_be_const_or_non_const: DiagnosticMessage; - In_const_enum_declarations_member_initializer_must_be_constant_expression: DiagnosticMessage; - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query: DiagnosticMessage; - A_const_enum_member_can_only_be_accessed_using_a_string_literal: DiagnosticMessage; - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: DiagnosticMessage; - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: DiagnosticMessage; - Property_0_does_not_exist_on_const_enum_1: DiagnosticMessage; - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: DiagnosticMessage; - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: DiagnosticMessage; - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: DiagnosticMessage; - Export_declaration_conflicts_with_exported_declaration_of_0: DiagnosticMessage; - The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: DiagnosticMessage; - Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator: DiagnosticMessage; - An_iterator_must_have_a_next_method: DiagnosticMessage; - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: DiagnosticMessage; - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: DiagnosticMessage; - Cannot_redeclare_identifier_0_in_catch_clause: DiagnosticMessage; - Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: DiagnosticMessage; - Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: DiagnosticMessage; - Type_0_is_not_an_array_type_or_a_string_type: DiagnosticMessage; - The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: DiagnosticMessage; - Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: DiagnosticMessage; - Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: DiagnosticMessage; - An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: DiagnosticMessage; - A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: DiagnosticMessage; - A_rest_element_cannot_contain_a_binding_pattern: DiagnosticMessage; - _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: DiagnosticMessage; - Cannot_find_namespace_0: DiagnosticMessage; - Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: DiagnosticMessage; - A_generator_cannot_have_a_void_type_annotation: DiagnosticMessage; - _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: DiagnosticMessage; - Type_0_is_not_a_constructor_function_type: DiagnosticMessage; - No_base_constructor_has_the_specified_number_of_type_arguments: DiagnosticMessage; - Base_constructor_return_type_0_is_not_a_class_or_interface_type: DiagnosticMessage; - Base_constructors_must_all_have_the_same_return_type: DiagnosticMessage; - Cannot_create_an_instance_of_an_abstract_class: DiagnosticMessage; - Overload_signatures_must_all_be_abstract_or_non_abstract: DiagnosticMessage; - Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: DiagnosticMessage; - Classes_containing_abstract_methods_must_be_marked_abstract: DiagnosticMessage; - Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: DiagnosticMessage; - All_declarations_of_an_abstract_method_must_be_consecutive: DiagnosticMessage; - Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: DiagnosticMessage; - A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: DiagnosticMessage; - An_async_iterator_must_have_a_next_method: DiagnosticMessage; - Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: DiagnosticMessage; - Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: DiagnosticMessage; - The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: DiagnosticMessage; - yield_expressions_cannot_be_used_in_a_parameter_initializer: DiagnosticMessage; - await_expressions_cannot_be_used_in_a_parameter_initializer: DiagnosticMessage; - Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: DiagnosticMessage; - A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: DiagnosticMessage; - The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary: DiagnosticMessage; - A_module_cannot_have_multiple_default_exports: DiagnosticMessage; - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: DiagnosticMessage; - Property_0_is_incompatible_with_index_signature: DiagnosticMessage; - Object_is_possibly_null: DiagnosticMessage; - Object_is_possibly_undefined: DiagnosticMessage; - Object_is_possibly_null_or_undefined: DiagnosticMessage; - A_function_returning_never_cannot_have_a_reachable_end_point: DiagnosticMessage; - Enum_type_0_has_members_with_initializers_that_are_not_literals: DiagnosticMessage; - Type_0_cannot_be_used_to_index_type_1: DiagnosticMessage; - Type_0_has_no_matching_index_signature_for_type_1: DiagnosticMessage; - Type_0_cannot_be_used_as_an_index_type: DiagnosticMessage; - Cannot_assign_to_0_because_it_is_not_a_variable: DiagnosticMessage; - Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: DiagnosticMessage; - The_target_of_an_assignment_must_be_a_variable_or_a_property_access: DiagnosticMessage; - Index_signature_in_type_0_only_permits_reading: DiagnosticMessage; - Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: DiagnosticMessage; - Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: DiagnosticMessage; - A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: DiagnosticMessage; - Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1: DiagnosticMessage; - The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property: DiagnosticMessage; - Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: DiagnosticMessage; - Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: DiagnosticMessage; - Generic_type_instantiation_is_excessively_deep_and_possibly_infinite: DiagnosticMessage; - Property_0_does_not_exist_on_type_1_Did_you_mean_2: DiagnosticMessage; - Cannot_find_name_0_Did_you_mean_1: DiagnosticMessage; - Computed_values_are_not_permitted_in_an_enum_with_string_valued_members: DiagnosticMessage; - Expected_0_arguments_but_got_1: DiagnosticMessage; - Expected_at_least_0_arguments_but_got_1: DiagnosticMessage; - Expected_0_arguments_but_got_1_or_more: DiagnosticMessage; - Expected_at_least_0_arguments_but_got_1_or_more: DiagnosticMessage; - Expected_0_type_arguments_but_got_1: DiagnosticMessage; - Type_0_has_no_properties_in_common_with_type_1: DiagnosticMessage; - Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it: DiagnosticMessage; - Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2: DiagnosticMessage; - Base_class_expressions_cannot_reference_class_type_parameters: DiagnosticMessage; - The_containing_function_or_module_body_is_too_large_for_control_flow_analysis: DiagnosticMessage; - Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor: DiagnosticMessage; - Property_0_is_used_before_being_assigned: DiagnosticMessage; - A_rest_element_cannot_have_a_property_name: DiagnosticMessage; - Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: DiagnosticMessage; - Type_0_is_not_an_array_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: DiagnosticMessage; - Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: DiagnosticMessage; - Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await: DiagnosticMessage; - Object_is_of_type_unknown: DiagnosticMessage; - Rest_signatures_are_incompatible: DiagnosticMessage; - Property_0_is_incompatible_with_rest_element_type: DiagnosticMessage; - A_rest_element_type_must_be_an_array_type: DiagnosticMessage; - JSX_element_attributes_type_0_may_not_be_a_union_type: DiagnosticMessage; - The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: DiagnosticMessage; - JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: DiagnosticMessage; - Property_0_in_type_1_is_not_assignable_to_type_2: DiagnosticMessage; - JSX_element_type_0_does_not_have_any_construct_or_call_signatures: DiagnosticMessage; - JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: DiagnosticMessage; - Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: DiagnosticMessage; - JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: DiagnosticMessage; - The_global_type_JSX_0_may_not_have_more_than_one_property: DiagnosticMessage; - JSX_spread_child_must_be_an_array_type: DiagnosticMessage; - Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: DiagnosticMessage; - A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: DiagnosticMessage; - Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: DiagnosticMessage; - Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: DiagnosticMessage; - Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: DiagnosticMessage; - Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: DiagnosticMessage; - JSX_expressions_must_have_one_parent_element: DiagnosticMessage; - Type_0_provides_no_match_for_the_signature_1: DiagnosticMessage; - super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: DiagnosticMessage; - super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: DiagnosticMessage; - Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: DiagnosticMessage; - Cannot_find_name_0_Did_you_mean_the_static_member_1_0: DiagnosticMessage; - Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: DiagnosticMessage; - Invalid_module_name_in_augmentation_module_0_cannot_be_found: DiagnosticMessage; - Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: DiagnosticMessage; - Exports_and_export_assignments_are_not_permitted_in_module_augmentations: DiagnosticMessage; - Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: DiagnosticMessage; - export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: DiagnosticMessage; - Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: DiagnosticMessage; - Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: DiagnosticMessage; - Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: DiagnosticMessage; - Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: DiagnosticMessage; - Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: DiagnosticMessage; - Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: DiagnosticMessage; - Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: DiagnosticMessage; - Accessors_must_both_be_abstract_or_non_abstract: DiagnosticMessage; - A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: DiagnosticMessage; - Type_0_is_not_comparable_to_type_1: DiagnosticMessage; - A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: DiagnosticMessage; - A_0_parameter_must_be_the_first_parameter: DiagnosticMessage; - A_constructor_cannot_have_a_this_parameter: DiagnosticMessage; - get_and_set_accessor_must_have_the_same_this_type: DiagnosticMessage; - this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: DiagnosticMessage; - The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: DiagnosticMessage; - The_this_types_of_each_signature_are_incompatible: DiagnosticMessage; - _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: DiagnosticMessage; - All_declarations_of_0_must_have_identical_modifiers: DiagnosticMessage; - Cannot_find_type_definition_file_for_0: DiagnosticMessage; - Cannot_extend_an_interface_0_Did_you_mean_implements: DiagnosticMessage; - An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: DiagnosticMessage; - _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: DiagnosticMessage; - _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: DiagnosticMessage; - Namespace_0_has_no_exported_member_1: DiagnosticMessage; - Left_side_of_comma_operator_is_unused_and_has_no_side_effects: DiagnosticMessage; - The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: DiagnosticMessage; - An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: DiagnosticMessage; - Spread_types_may_only_be_created_from_object_types: DiagnosticMessage; - Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: DiagnosticMessage; - Rest_types_may_only_be_created_from_object_types: DiagnosticMessage; - The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: DiagnosticMessage; - _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: DiagnosticMessage; - The_operand_of_a_delete_operator_must_be_a_property_reference: DiagnosticMessage; - The_operand_of_a_delete_operator_cannot_be_a_read_only_property: DiagnosticMessage; - An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: DiagnosticMessage; - Required_type_parameters_may_not_follow_optional_type_parameters: DiagnosticMessage; - Generic_type_0_requires_between_1_and_2_type_arguments: DiagnosticMessage; - Cannot_use_namespace_0_as_a_value: DiagnosticMessage; - Cannot_use_namespace_0_as_a_type: DiagnosticMessage; - _0_are_specified_twice_The_attribute_named_0_will_be_overwritten: DiagnosticMessage; - A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: DiagnosticMessage; - A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: DiagnosticMessage; - Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1: DiagnosticMessage; - The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context: DiagnosticMessage; - Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor: DiagnosticMessage; - Type_parameter_0_has_a_circular_default: DiagnosticMessage; - Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2: DiagnosticMessage; - Duplicate_declaration_0: DiagnosticMessage; - Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: DiagnosticMessage; - Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass: DiagnosticMessage; - Cannot_invoke_an_object_which_is_possibly_null: DiagnosticMessage; - Cannot_invoke_an_object_which_is_possibly_undefined: DiagnosticMessage; - Cannot_invoke_an_object_which_is_possibly_null_or_undefined: DiagnosticMessage; - Module_0_has_no_exported_member_1_Did_you_mean_2: DiagnosticMessage; - Class_name_cannot_be_Object_when_targeting_ES5_with_module_0: DiagnosticMessage; - Cannot_find_lib_definition_for_0: DiagnosticMessage; - Cannot_find_lib_definition_for_0_Did_you_mean_1: DiagnosticMessage; - Import_declaration_0_is_using_private_name_1: DiagnosticMessage; - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: DiagnosticMessage; - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: DiagnosticMessage; - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: DiagnosticMessage; - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: DiagnosticMessage; - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: DiagnosticMessage; - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: DiagnosticMessage; - extends_clause_of_exported_class_0_has_or_is_using_private_name_1: DiagnosticMessage; - extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: DiagnosticMessage; - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: DiagnosticMessage; - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Exported_variable_0_has_or_is_using_private_name_1: DiagnosticMessage; - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: DiagnosticMessage; - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: DiagnosticMessage; - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Public_property_0_of_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Property_0_of_exported_interface_has_or_is_using_private_name_1: DiagnosticMessage; - Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: DiagnosticMessage; - Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: DiagnosticMessage; - Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: DiagnosticMessage; - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: DiagnosticMessage; - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: DiagnosticMessage; - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: DiagnosticMessage; - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: DiagnosticMessage; - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: DiagnosticMessage; - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: DiagnosticMessage; - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: DiagnosticMessage; - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: DiagnosticMessage; - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: DiagnosticMessage; - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: DiagnosticMessage; - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: DiagnosticMessage; - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: DiagnosticMessage; - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: DiagnosticMessage; - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: DiagnosticMessage; - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: DiagnosticMessage; - Return_type_of_exported_function_has_or_is_using_private_name_0: DiagnosticMessage; - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: DiagnosticMessage; - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: DiagnosticMessage; - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: DiagnosticMessage; - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: DiagnosticMessage; - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: DiagnosticMessage; - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: DiagnosticMessage; - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: DiagnosticMessage; - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Parameter_0_of_exported_function_has_or_is_using_private_name_1: DiagnosticMessage; - Exported_type_alias_0_has_or_is_using_private_name_1: DiagnosticMessage; - Default_export_of_the_module_has_or_is_using_private_name_0: DiagnosticMessage; - Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: DiagnosticMessage; - Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: DiagnosticMessage; - Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: DiagnosticMessage; - Property_0_of_exported_class_expression_may_not_be_private_or_protected: DiagnosticMessage; - Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: DiagnosticMessage; - Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Public_static_method_0_of_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: DiagnosticMessage; - Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Public_method_0_of_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; - Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: DiagnosticMessage; - Method_0_of_exported_interface_has_or_is_using_private_name_1: DiagnosticMessage; - The_current_host_does_not_support_the_0_option: DiagnosticMessage; - Cannot_find_the_common_subdirectory_path_for_the_input_files: DiagnosticMessage; - File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: DiagnosticMessage; - Cannot_read_file_0_Colon_1: DiagnosticMessage; - Failed_to_parse_file_0_Colon_1: DiagnosticMessage; - Unknown_compiler_option_0: DiagnosticMessage; - Compiler_option_0_requires_a_value_of_type_1: DiagnosticMessage; - Could_not_write_file_0_Colon_1: DiagnosticMessage; - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: DiagnosticMessage; - Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: DiagnosticMessage; - Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: DiagnosticMessage; - Option_0_cannot_be_specified_without_specifying_option_1: DiagnosticMessage; - Option_0_cannot_be_specified_with_option_1: DiagnosticMessage; - A_tsconfig_json_file_is_already_defined_at_Colon_0: DiagnosticMessage; - Cannot_write_file_0_because_it_would_overwrite_input_file: DiagnosticMessage; - Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: DiagnosticMessage; - Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: DiagnosticMessage; - The_specified_path_does_not_exist_Colon_0: DiagnosticMessage; - Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: DiagnosticMessage; - Option_paths_cannot_be_used_without_specifying_baseUrl_option: DiagnosticMessage; - Pattern_0_can_have_at_most_one_Asterisk_character: DiagnosticMessage; - Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: DiagnosticMessage; - Substitutions_for_pattern_0_should_be_an_array: DiagnosticMessage; - Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: DiagnosticMessage; - File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: DiagnosticMessage; - Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: DiagnosticMessage; - Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: DiagnosticMessage; - Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: DiagnosticMessage; - Option_0_cannot_be_specified_without_specifying_option_1_or_option_2: DiagnosticMessage; - Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy: DiagnosticMessage; - Generates_a_sourcemap_for_each_corresponding_d_ts_file: DiagnosticMessage; - Concatenate_and_emit_output_to_single_file: DiagnosticMessage; - Generates_corresponding_d_ts_file: DiagnosticMessage; - Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: DiagnosticMessage; - Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: DiagnosticMessage; - Watch_input_files: DiagnosticMessage; - Redirect_output_structure_to_the_directory: DiagnosticMessage; - Do_not_erase_const_enum_declarations_in_generated_code: DiagnosticMessage; - Do_not_emit_outputs_if_any_errors_were_reported: DiagnosticMessage; - Do_not_emit_comments_to_output: DiagnosticMessage; - Do_not_emit_outputs: DiagnosticMessage; - Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: DiagnosticMessage; - Skip_type_checking_of_declaration_files: DiagnosticMessage; - Do_not_resolve_the_real_path_of_symlinks: DiagnosticMessage; - Only_emit_d_ts_declaration_files: DiagnosticMessage; - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_ES2018_or_ESNEXT: DiagnosticMessage; - Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext: DiagnosticMessage; - Print_this_message: DiagnosticMessage; - Print_the_compiler_s_version: DiagnosticMessage; - Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: DiagnosticMessage; - Syntax_Colon_0: DiagnosticMessage; - options: DiagnosticMessage; - file: DiagnosticMessage; - Examples_Colon_0: DiagnosticMessage; - Options_Colon: DiagnosticMessage; - Version_0: DiagnosticMessage; - Insert_command_line_options_and_files_from_a_file: DiagnosticMessage; - Starting_compilation_in_watch_mode: DiagnosticMessage; - File_change_detected_Starting_incremental_compilation: DiagnosticMessage; - KIND: DiagnosticMessage; - FILE: DiagnosticMessage; - VERSION: DiagnosticMessage; - LOCATION: DiagnosticMessage; - DIRECTORY: DiagnosticMessage; - STRATEGY: DiagnosticMessage; - FILE_OR_DIRECTORY: DiagnosticMessage; - Generates_corresponding_map_file: DiagnosticMessage; - Compiler_option_0_expects_an_argument: DiagnosticMessage; - Unterminated_quoted_string_in_response_file_0: DiagnosticMessage; - Argument_for_0_option_must_be_Colon_1: DiagnosticMessage; - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: DiagnosticMessage; - Unsupported_locale_0: DiagnosticMessage; - Unable_to_open_file_0: DiagnosticMessage; - Corrupted_locale_file_0: DiagnosticMessage; - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: DiagnosticMessage; - File_0_not_found: DiagnosticMessage; - File_0_has_unsupported_extension_The_only_supported_extensions_are_1: DiagnosticMessage; - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: DiagnosticMessage; - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: DiagnosticMessage; - Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: DiagnosticMessage; - File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: DiagnosticMessage; - Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: DiagnosticMessage; - NEWLINE: DiagnosticMessage; - Option_0_can_only_be_specified_in_tsconfig_json_file: DiagnosticMessage; - Enables_experimental_support_for_ES7_decorators: DiagnosticMessage; - Enables_experimental_support_for_emitting_type_metadata_for_decorators: DiagnosticMessage; - Enables_experimental_support_for_ES7_async_functions: DiagnosticMessage; - Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: DiagnosticMessage; - Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: DiagnosticMessage; - Successfully_created_a_tsconfig_json_file: DiagnosticMessage; - Suppress_excess_property_checks_for_object_literals: DiagnosticMessage; - Stylize_errors_and_messages_using_color_and_context_experimental: DiagnosticMessage; - Do_not_report_errors_on_unused_labels: DiagnosticMessage; - Report_error_when_not_all_code_paths_in_function_return_a_value: DiagnosticMessage; - Report_errors_for_fallthrough_cases_in_switch_statement: DiagnosticMessage; - Do_not_report_errors_on_unreachable_code: DiagnosticMessage; - Disallow_inconsistently_cased_references_to_the_same_file: DiagnosticMessage; - Specify_library_files_to_be_included_in_the_compilation: DiagnosticMessage; - Specify_JSX_code_generation_Colon_preserve_react_native_or_react: DiagnosticMessage; - File_0_has_an_unsupported_extension_so_skipping_it: DiagnosticMessage; - Only_amd_and_system_modules_are_supported_alongside_0: DiagnosticMessage; - Base_directory_to_resolve_non_absolute_module_names: DiagnosticMessage; - Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit: DiagnosticMessage; - Enable_tracing_of_the_name_resolution_process: DiagnosticMessage; - Resolving_module_0_from_1: DiagnosticMessage; - Explicitly_specified_module_resolution_kind_Colon_0: DiagnosticMessage; - Module_resolution_kind_is_not_specified_using_0: DiagnosticMessage; - Module_name_0_was_successfully_resolved_to_1: DiagnosticMessage; - Module_name_0_was_not_resolved: DiagnosticMessage; - paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: DiagnosticMessage; - Module_name_0_matched_pattern_1: DiagnosticMessage; - Trying_substitution_0_candidate_module_location_Colon_1: DiagnosticMessage; - Resolving_module_name_0_relative_to_base_url_1_2: DiagnosticMessage; - Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: DiagnosticMessage; - File_0_does_not_exist: DiagnosticMessage; - File_0_exist_use_it_as_a_name_resolution_result: DiagnosticMessage; - Loading_module_0_from_node_modules_folder_target_file_type_1: DiagnosticMessage; - Found_package_json_at_0: DiagnosticMessage; - package_json_does_not_have_a_0_field: DiagnosticMessage; - package_json_has_0_field_1_that_references_2: DiagnosticMessage; - Allow_javascript_files_to_be_compiled: DiagnosticMessage; - Option_0_should_have_array_of_strings_as_a_value: DiagnosticMessage; - Checking_if_0_is_the_longest_matching_prefix_for_1_2: DiagnosticMessage; - Expected_type_of_0_field_in_package_json_to_be_string_got_1: DiagnosticMessage; - baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: DiagnosticMessage; - rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: DiagnosticMessage; - Longest_matching_prefix_for_0_is_1: DiagnosticMessage; - Loading_0_from_the_root_dir_1_candidate_location_2: DiagnosticMessage; - Trying_other_entries_in_rootDirs: DiagnosticMessage; - Module_resolution_using_rootDirs_has_failed: DiagnosticMessage; - Do_not_emit_use_strict_directives_in_module_output: DiagnosticMessage; - Enable_strict_null_checks: DiagnosticMessage; - Unknown_option_excludes_Did_you_mean_exclude: DiagnosticMessage; - Raise_error_on_this_expressions_with_an_implied_any_type: DiagnosticMessage; - Resolving_type_reference_directive_0_containing_file_1_root_directory_2: DiagnosticMessage; - Resolving_using_primary_search_paths: DiagnosticMessage; - Resolving_from_node_modules_folder: DiagnosticMessage; - Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: DiagnosticMessage; - Type_reference_directive_0_was_not_resolved: DiagnosticMessage; - Resolving_with_primary_search_path_0: DiagnosticMessage; - Root_directory_cannot_be_determined_skipping_primary_search_paths: DiagnosticMessage; - Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: DiagnosticMessage; - Type_declaration_files_to_be_included_in_compilation: DiagnosticMessage; - Looking_up_in_node_modules_folder_initial_location_0: DiagnosticMessage; - Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: DiagnosticMessage; - Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: DiagnosticMessage; - Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: DiagnosticMessage; - Resolving_real_path_for_0_result_1: DiagnosticMessage; - Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: DiagnosticMessage; - File_name_0_has_a_1_extension_stripping_it: DiagnosticMessage; - _0_is_declared_but_its_value_is_never_read: DiagnosticMessage; - Report_errors_on_unused_locals: DiagnosticMessage; - Report_errors_on_unused_parameters: DiagnosticMessage; - The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: DiagnosticMessage; - Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1: DiagnosticMessage; - Property_0_is_declared_but_its_value_is_never_read: DiagnosticMessage; - Import_emit_helpers_from_tslib: DiagnosticMessage; - Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: DiagnosticMessage; - Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: DiagnosticMessage; - Module_0_was_resolved_to_1_but_jsx_is_not_set: DiagnosticMessage; - Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: DiagnosticMessage; - Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: DiagnosticMessage; - Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: DiagnosticMessage; - Resolution_for_module_0_was_found_in_cache_from_location_1: DiagnosticMessage; - Directory_0_does_not_exist_skipping_all_lookups_in_it: DiagnosticMessage; - Show_diagnostic_information: DiagnosticMessage; - Show_verbose_diagnostic_information: DiagnosticMessage; - Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file: DiagnosticMessage; - Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set: DiagnosticMessage; - Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule: DiagnosticMessage; - Print_names_of_generated_files_part_of_the_compilation: DiagnosticMessage; - Print_names_of_files_part_of_the_compilation: DiagnosticMessage; - The_locale_used_when_displaying_messages_to_the_user_e_g_en_us: DiagnosticMessage; - Do_not_generate_custom_helper_functions_like_extends_in_compiled_output: DiagnosticMessage; - Do_not_include_the_default_library_file_lib_d_ts: DiagnosticMessage; - Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files: DiagnosticMessage; - Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files: DiagnosticMessage; - List_of_folders_to_include_type_definitions_from: DiagnosticMessage; - Disable_size_limitations_on_JavaScript_projects: DiagnosticMessage; - The_character_set_of_the_input_files: DiagnosticMessage; - Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files: DiagnosticMessage; - Do_not_truncate_error_messages: DiagnosticMessage; - Output_directory_for_generated_declaration_files: DiagnosticMessage; - A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: DiagnosticMessage; - List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime: DiagnosticMessage; - Show_all_compiler_options: DiagnosticMessage; - Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file: DiagnosticMessage; - Command_line_Options: DiagnosticMessage; - Basic_Options: DiagnosticMessage; - Strict_Type_Checking_Options: DiagnosticMessage; - Module_Resolution_Options: DiagnosticMessage; - Source_Map_Options: DiagnosticMessage; - Additional_Checks: DiagnosticMessage; - Experimental_Options: DiagnosticMessage; - Advanced_Options: DiagnosticMessage; - Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3: DiagnosticMessage; - Enable_all_strict_type_checking_options: DiagnosticMessage; - List_of_language_service_plugins: DiagnosticMessage; - Scoped_package_detected_looking_in_0: DiagnosticMessage; - Reusing_resolution_of_module_0_to_file_1_from_old_program: DiagnosticMessage; - Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program: DiagnosticMessage; - Disable_strict_checking_of_generic_signatures_in_function_types: DiagnosticMessage; - Enable_strict_checking_of_function_types: DiagnosticMessage; - Enable_strict_checking_of_property_initialization_in_classes: DiagnosticMessage; - Numeric_separators_are_not_allowed_here: DiagnosticMessage; - Multiple_consecutive_numeric_separators_are_not_permitted: DiagnosticMessage; - Found_package_json_at_0_Package_ID_is_1: DiagnosticMessage; - Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen: DiagnosticMessage; - All_imports_in_import_declaration_are_unused: DiagnosticMessage; - Found_1_error_Watching_for_file_changes: DiagnosticMessage; - Found_0_errors_Watching_for_file_changes: DiagnosticMessage; - Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols: DiagnosticMessage; - _0_is_declared_but_never_used: DiagnosticMessage; - Include_modules_imported_with_json_extension: DiagnosticMessage; - All_destructured_elements_are_unused: DiagnosticMessage; - All_variables_are_unused: DiagnosticMessage; - Projects_to_reference: DiagnosticMessage; - Enable_project_compilation: DiagnosticMessage; - Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0: DiagnosticMessage; - Composite_projects_may_not_disable_declaration_emit: DiagnosticMessage; - Output_file_0_has_not_been_built_from_source_file_1: DiagnosticMessage; - Referenced_project_0_must_have_setting_composite_Colon_true: DiagnosticMessage; - File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern: DiagnosticMessage; - Cannot_prepend_project_0_because_it_does_not_have_outFile_set: DiagnosticMessage; - Output_file_0_from_project_1_does_not_exist: DiagnosticMessage; - Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2: DiagnosticMessage; - Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2: DiagnosticMessage; - Project_0_is_out_of_date_because_output_file_1_does_not_exist: DiagnosticMessage; - Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date: DiagnosticMessage; - Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies: DiagnosticMessage; - Projects_in_this_build_Colon_0: DiagnosticMessage; - A_non_dry_build_would_delete_the_following_files_Colon_0: DiagnosticMessage; - A_non_dry_build_would_build_project_0: DiagnosticMessage; - Building_project_0: DiagnosticMessage; - Updating_output_timestamps_of_project_0: DiagnosticMessage; - delete_this_Project_0_is_up_to_date_because_it_was_previously_built: DiagnosticMessage; - Project_0_is_up_to_date: DiagnosticMessage; - Skipping_build_of_project_0_because_its_dependency_1_has_errors: DiagnosticMessage; - Project_0_can_t_be_built_because_its_dependency_1_has_errors: DiagnosticMessage; - Build_one_or_more_projects_and_their_dependencies_if_out_of_date: DiagnosticMessage; - Delete_the_outputs_of_all_projects: DiagnosticMessage; - Enable_verbose_logging: DiagnosticMessage; - Show_what_would_be_built_or_deleted_if_specified_with_clean: DiagnosticMessage; - Build_all_projects_including_those_that_appear_to_be_up_to_date: DiagnosticMessage; - Option_build_must_be_the_first_command_line_argument: DiagnosticMessage; - Options_0_and_1_cannot_be_combined: DiagnosticMessage; - Skipping_clean_because_not_all_projects_could_be_located: DiagnosticMessage; - Variable_0_implicitly_has_an_1_type: DiagnosticMessage; - Parameter_0_implicitly_has_an_1_type: DiagnosticMessage; - Member_0_implicitly_has_an_1_type: DiagnosticMessage; - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: DiagnosticMessage; - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: DiagnosticMessage; - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: DiagnosticMessage; - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: DiagnosticMessage; - Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: DiagnosticMessage; - Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: DiagnosticMessage; - Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: DiagnosticMessage; - Object_literal_s_property_0_implicitly_has_an_1_type: DiagnosticMessage; - Rest_parameter_0_implicitly_has_an_any_type: DiagnosticMessage; - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: DiagnosticMessage; - _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: DiagnosticMessage; - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: DiagnosticMessage; - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: DiagnosticMessage; - Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: DiagnosticMessage; - JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: DiagnosticMessage; - Unreachable_code_detected: DiagnosticMessage; - Unused_label: DiagnosticMessage; - Fallthrough_case_in_switch: DiagnosticMessage; - Not_all_code_paths_return_a_value: DiagnosticMessage; - Binding_element_0_implicitly_has_an_1_type: DiagnosticMessage; - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: DiagnosticMessage; - Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: DiagnosticMessage; - Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: DiagnosticMessage; - Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0: DiagnosticMessage; - Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0: DiagnosticMessage; - Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports: DiagnosticMessage; - Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead: DiagnosticMessage; - Mapped_object_type_implicitly_has_an_any_template_type: DiagnosticMessage; - If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_0: DiagnosticMessage; - You_cannot_rename_this_element: DiagnosticMessage; - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: DiagnosticMessage; - import_can_only_be_used_in_a_ts_file: DiagnosticMessage; - export_can_only_be_used_in_a_ts_file: DiagnosticMessage; - type_parameter_declarations_can_only_be_used_in_a_ts_file: DiagnosticMessage; - implements_clauses_can_only_be_used_in_a_ts_file: DiagnosticMessage; - interface_declarations_can_only_be_used_in_a_ts_file: DiagnosticMessage; - module_declarations_can_only_be_used_in_a_ts_file: DiagnosticMessage; - type_aliases_can_only_be_used_in_a_ts_file: DiagnosticMessage; - _0_can_only_be_used_in_a_ts_file: DiagnosticMessage; - types_can_only_be_used_in_a_ts_file: DiagnosticMessage; - type_arguments_can_only_be_used_in_a_ts_file: DiagnosticMessage; - parameter_modifiers_can_only_be_used_in_a_ts_file: DiagnosticMessage; - non_null_assertions_can_only_be_used_in_a_ts_file: DiagnosticMessage; - enum_declarations_can_only_be_used_in_a_ts_file: DiagnosticMessage; - type_assertion_expressions_can_only_be_used_in_a_ts_file: DiagnosticMessage; - Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: DiagnosticMessage; - Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: DiagnosticMessage; - Report_errors_in_js_files: DiagnosticMessage; - JSDoc_types_can_only_be_used_inside_documentation_comments: DiagnosticMessage; - JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags: DiagnosticMessage; - JSDoc_0_is_not_attached_to_a_class: DiagnosticMessage; - JSDoc_0_1_does_not_match_the_extends_2_clause: DiagnosticMessage; - JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name: DiagnosticMessage; - Class_declarations_cannot_have_more_than_one_augments_or_extends_tag: DiagnosticMessage; - Expected_0_type_arguments_provide_these_with_an_extends_tag: DiagnosticMessage; - Expected_0_1_type_arguments_provide_these_with_an_extends_tag: DiagnosticMessage; - JSDoc_may_only_appear_in_the_last_parameter_of_a_signature: DiagnosticMessage; - JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type: DiagnosticMessage; - Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clause: DiagnosticMessage; - class_expressions_are_not_currently_supported: DiagnosticMessage; - Language_service_is_disabled: DiagnosticMessage; - JSX_attributes_must_only_be_assigned_a_non_empty_expression: DiagnosticMessage; - JSX_elements_cannot_have_multiple_attributes_with_the_same_name: DiagnosticMessage; - Expected_corresponding_JSX_closing_tag_for_0: DiagnosticMessage; - JSX_attribute_expected: DiagnosticMessage; - Cannot_use_JSX_unless_the_jsx_flag_is_provided: DiagnosticMessage; - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: DiagnosticMessage; - An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: DiagnosticMessage; - A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: DiagnosticMessage; - JSX_element_0_has_no_corresponding_closing_tag: DiagnosticMessage; - super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: DiagnosticMessage; - Unknown_type_acquisition_option_0: DiagnosticMessage; - super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: DiagnosticMessage; - _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: DiagnosticMessage; - Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: DiagnosticMessage; - JSX_fragment_has_no_corresponding_closing_tag: DiagnosticMessage; - Expected_corresponding_closing_tag_for_JSX_fragment: DiagnosticMessage; - JSX_fragment_is_not_supported_when_using_jsxFactory: DiagnosticMessage; - JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma: DiagnosticMessage; - Circularity_detected_while_resolving_configuration_Colon_0: DiagnosticMessage; - A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: DiagnosticMessage; - The_files_list_in_config_file_0_is_empty: DiagnosticMessage; - No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: DiagnosticMessage; - File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module: DiagnosticMessage; - This_constructor_function_may_be_converted_to_a_class_declaration: DiagnosticMessage; - Import_may_be_converted_to_a_default_import: DiagnosticMessage; - JSDoc_types_may_be_moved_to_TypeScript_types: DiagnosticMessage; - require_call_may_be_converted_to_an_import: DiagnosticMessage; - Add_missing_super_call: DiagnosticMessage; - Make_super_call_the_first_statement_in_the_constructor: DiagnosticMessage; - Change_extends_to_implements: DiagnosticMessage; - Remove_declaration_for_Colon_0: DiagnosticMessage; - Remove_import_from_0: DiagnosticMessage; - Implement_interface_0: DiagnosticMessage; - Implement_inherited_abstract_class: DiagnosticMessage; - Add_0_to_unresolved_variable: DiagnosticMessage; - Remove_destructuring: DiagnosticMessage; - Remove_variable_statement: DiagnosticMessage; - Import_0_from_module_1: DiagnosticMessage; - Change_0_to_1: DiagnosticMessage; - Add_0_to_existing_import_declaration_from_1: DiagnosticMessage; - Declare_property_0: DiagnosticMessage; - Add_index_signature_for_property_0: DiagnosticMessage; - Disable_checking_for_this_file: DiagnosticMessage; - Ignore_this_error_message: DiagnosticMessage; - Initialize_property_0_in_the_constructor: DiagnosticMessage; - Initialize_static_property_0: DiagnosticMessage; - Change_spelling_to_0: DiagnosticMessage; - Declare_method_0: DiagnosticMessage; - Declare_static_method_0: DiagnosticMessage; - Prefix_0_with_an_underscore: DiagnosticMessage; - Rewrite_as_the_indexed_access_type_0: DiagnosticMessage; - Declare_static_property_0: DiagnosticMessage; - Call_decorator_expression: DiagnosticMessage; - Add_async_modifier_to_containing_function: DiagnosticMessage; - Convert_function_to_an_ES2015_class: DiagnosticMessage; - Convert_function_0_to_class: DiagnosticMessage; - Extract_to_0_in_1: DiagnosticMessage; - Extract_function: DiagnosticMessage; - Extract_constant: DiagnosticMessage; - Extract_to_0_in_enclosing_scope: DiagnosticMessage; - Extract_to_0_in_1_scope: DiagnosticMessage; - Annotate_with_type_from_JSDoc: DiagnosticMessage; - Annotate_with_types_from_JSDoc: DiagnosticMessage; - Infer_type_of_0_from_usage: DiagnosticMessage; - Infer_parameter_types_from_usage: DiagnosticMessage; - Convert_to_default_import: DiagnosticMessage; - Install_0: DiagnosticMessage; - Replace_import_with_0: DiagnosticMessage; - Use_synthetic_default_member: DiagnosticMessage; - Convert_to_ES6_module: DiagnosticMessage; - Add_undefined_type_to_property_0: DiagnosticMessage; - Add_initializer_to_property_0: DiagnosticMessage; - Add_definite_assignment_assertion_to_property_0: DiagnosticMessage; - Add_all_missing_members: DiagnosticMessage; - Infer_all_types_from_usage: DiagnosticMessage; - Delete_all_unused_declarations: DiagnosticMessage; - Prefix_all_unused_declarations_with_where_possible: DiagnosticMessage; - Fix_all_detected_spelling_errors: DiagnosticMessage; - Add_initializers_to_all_uninitialized_properties: DiagnosticMessage; - Add_definite_assignment_assertions_to_all_uninitialized_properties: DiagnosticMessage; - Add_undefined_type_to_all_uninitialized_properties: DiagnosticMessage; - Change_all_jsdoc_style_types_to_TypeScript: DiagnosticMessage; - Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types: DiagnosticMessage; - Implement_all_unimplemented_interfaces: DiagnosticMessage; - Install_all_missing_types_packages: DiagnosticMessage; - Rewrite_all_as_indexed_access_types: DiagnosticMessage; - Convert_all_to_default_imports: DiagnosticMessage; - Make_all_super_calls_the_first_statement_in_their_constructor: DiagnosticMessage; - Add_qualifier_to_all_unresolved_variables_matching_a_member_name: DiagnosticMessage; - Change_all_extended_interfaces_to_implements: DiagnosticMessage; - Add_all_missing_super_calls: DiagnosticMessage; - Implement_all_inherited_abstract_classes: DiagnosticMessage; - Add_all_missing_async_modifiers: DiagnosticMessage; - Add_ts_ignore_to_all_error_messages: DiagnosticMessage; - Annotate_everything_with_types_from_JSDoc: DiagnosticMessage; - Add_to_all_uncalled_decorators: DiagnosticMessage; - Convert_all_constructor_functions_to_classes: DiagnosticMessage; - Generate_get_and_set_accessors: DiagnosticMessage; - Convert_require_to_import: DiagnosticMessage; - Convert_all_require_to_import: DiagnosticMessage; - Move_to_a_new_file: DiagnosticMessage; - Remove_unreachable_code: DiagnosticMessage; - Remove_all_unreachable_code: DiagnosticMessage; - Add_missing_typeof: DiagnosticMessage; - Remove_unused_label: DiagnosticMessage; - Remove_all_unused_labels: DiagnosticMessage; - Convert_0_to_mapped_object_type: DiagnosticMessage; - Convert_namespace_import_to_named_imports: DiagnosticMessage; - Convert_named_imports_to_namespace_import: DiagnosticMessage; - Add_or_remove_braces_in_an_arrow_function: DiagnosticMessage; - Add_braces_to_arrow_function: DiagnosticMessage; - Remove_braces_from_arrow_function: DiagnosticMessage; - Convert_default_export_to_named_export: DiagnosticMessage; - Convert_named_export_to_default_export: DiagnosticMessage; - }; -} declare namespace ts { type ErrorCallback = (message: DiagnosticMessage, length: number) => void; - function tokenIsIdentifierOrKeyword(token: SyntaxKind): boolean; - function tokenIsIdentifierOrKeywordOrGreaterThan(token: SyntaxKind): boolean; interface Scanner { getStartPos(): number; getToken(): SyntaxKind; @@ -5962,7 +3107,6 @@ declare namespace ts { isIdentifier(): boolean; isReservedWord(): boolean; isUnterminated(): boolean; - getTokenFlags(): TokenFlags; reScanGreaterToken(): SyntaxKind; reScanSlashToken(): SyntaxKind; reScanTemplateToken(): SyntaxKind; @@ -5982,25 +3126,14 @@ declare namespace ts { scanRange(start: number, length: number, callback: () => T): T; tryScan(callback: () => T): T; } - function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget | undefined): boolean; function tokenToString(t: SyntaxKind): string | undefined; - function stringToToken(s: string): SyntaxKind | undefined; - function computeLineStarts(text: string): number[]; function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number; - function computePositionOfLineAndCharacter(lineStarts: ReadonlyArray, line: number, character: number, debugText?: string): number; - function getLineStarts(sourceFile: SourceFileLike): ReadonlyArray; - /** - * We assume the first line starts at position 0 and 'position' is non-negative. - */ - function computeLineAndCharacterOfPosition(lineStarts: ReadonlyArray, position: number): LineAndCharacter; function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter; function isWhiteSpaceLike(ch: number): boolean; /** Does not include line breaks. For that, see isWhiteSpaceLike. */ function isWhiteSpaceSingleLine(ch: number): boolean; function isLineBreak(ch: number): boolean; - function isOctalDigit(ch: number): boolean; function couldStartTrivia(text: string, pos: number): boolean; - function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean, stopAtComments?: boolean): number; function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined; function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined; function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined; @@ -6013,7 +3146,6 @@ declare namespace ts { function getShebang(text: string): string | undefined; function isIdentifierStart(ch: number, languageVersion: ScriptTarget | undefined): boolean; function isIdentifierPart(ch: number, languageVersion: ScriptTarget | undefined): boolean; - function isIdentifierText(name: string, languageVersion: ScriptTarget | undefined): boolean; function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, textInitial?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; } /** Non-internal stuff goes here */ @@ -6021,624 +3153,6 @@ declare namespace ts { function isExternalModuleNameRelative(moduleName: string): boolean; function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray): T[]; } -declare namespace ts { - const emptyArray: never[]; - const resolvingEmptyArray: never[]; - const emptyMap: ReadonlyMap; - const emptyUnderscoreEscapedMap: ReadonlyUnderscoreEscapedMap; - const externalHelpersModuleNameText = "tslib"; - function getDeclarationOfKind(symbol: Symbol, kind: T["kind"]): T | undefined; - /** Create a new escaped identifier map. */ - function createUnderscoreEscapedMap(): UnderscoreEscapedMap; - function hasEntries(map: ReadonlyUnderscoreEscapedMap | undefined): map is ReadonlyUnderscoreEscapedMap; - function createSymbolTable(symbols?: ReadonlyArray): SymbolTable; - function toPath(fileName: string, basePath: string | undefined, getCanonicalFileName: (path: string) => string): Path; - function changesAffectModuleResolution(oldOptions: CompilerOptions, newOptions: CompilerOptions): boolean; - /** - * Iterates through the parent chain of a node and performs the callback on each parent until the callback - * returns a truthy value, then returns that value. - * If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit" - * At that point findAncestor returns undefined. - */ - function findAncestor(node: Node | undefined, callback: (element: Node) => element is T): T | undefined; - function findAncestor(node: Node | undefined, callback: (element: Node) => boolean | "quit"): Node | undefined; - /** - * Calls `callback` for each entry in the map, returning the first truthy result. - * Use `map.forEach` instead for normal iteration. - */ - function forEachEntry(map: ReadonlyUnderscoreEscapedMap, callback: (value: T, key: __String) => U | undefined): U | undefined; - function forEachEntry(map: ReadonlyMap, callback: (value: T, key: string) => U | undefined): U | undefined; - /** `forEachEntry` for just keys. */ - function forEachKey(map: ReadonlyUnderscoreEscapedMap<{}>, callback: (key: __String) => T | undefined): T | undefined; - function forEachKey(map: ReadonlyMap<{}>, callback: (key: string) => T | undefined): T | undefined; - /** Copy entries from `source` to `target`. */ - function copyEntries(source: ReadonlyUnderscoreEscapedMap, target: UnderscoreEscapedMap): void; - function copyEntries(source: ReadonlyMap, target: Map): void; - /** - * Creates a set from the elements of an array. - * - * @param array the array of input elements. - */ - function arrayToSet(array: ReadonlyArray): Map; - function arrayToSet(array: ReadonlyArray, makeKey: (value: T) => string | undefined): Map; - function arrayToSet(array: ReadonlyArray, makeKey: (value: T) => __String | undefined): UnderscoreEscapedMap; - function cloneMap(map: SymbolTable): SymbolTable; - function cloneMap(map: ReadonlyMap): Map; - function cloneMap(map: ReadonlyUnderscoreEscapedMap): UnderscoreEscapedMap; - function usingSingleLineStringWriter(action: (writer: EmitTextWriter) => void): string; - function getFullWidth(node: Node): number; - function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModuleFull | undefined; - function setResolvedModule(sourceFile: SourceFile, moduleNameText: string, resolvedModule: ResolvedModuleFull): void; - function setResolvedTypeReferenceDirective(sourceFile: SourceFile, typeReferenceDirectiveName: string, resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective): void; - function moduleResolutionIsEqualTo(oldResolution: ResolvedModuleFull, newResolution: ResolvedModuleFull): boolean; - function packageIdToString({ name, subModuleName, version }: PackageId): string; - function typeDirectiveIsEqualTo(oldResolution: ResolvedTypeReferenceDirective, newResolution: ResolvedTypeReferenceDirective): boolean; - function hasChangesInResolutions(names: ReadonlyArray, newResolutions: ReadonlyArray, oldResolutions: ReadonlyMap | undefined, comparer: (oldResolution: T, newResolution: T) => boolean): boolean; - function containsParseError(node: Node): boolean; - function getSourceFileOfNode(node: Node): SourceFile; - function getSourceFileOfNode(node: Node | undefined): SourceFile | undefined; - function isStatementWithLocals(node: Node): boolean; - function getStartPositionOfLine(line: number, sourceFile: SourceFileLike): number; - function nodePosToString(node: Node): string; - function getEndLinePosition(line: number, sourceFile: SourceFileLike): number; - /** - * Returns a value indicating whether a name is unique globally or within the current file. - * Note: This does not consider whether a name appears as a free identifier or not, so at the expression `x.y` this includes both `x` and `y`. - */ - function isFileLevelUniqueName(sourceFile: SourceFile, name: string, hasGlobalName?: PrintHandlers["hasGlobalName"]): boolean; - function nodeIsMissing(node: Node | undefined): boolean; - function nodeIsPresent(node: Node | undefined): boolean; - /** - * Appends a range of value to begin of an array, returning the array. - * - * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array - * is created if `value` was appended. - * @param from The values to append to the array. If `from` is `undefined`, nothing is - * appended. If an element of `from` is `undefined`, that element is not appended. - */ - function prependStatements(to: T[], from: ReadonlyArray | undefined): T[] | undefined; - /** - * Determine if the given comment is a triple-slash - * - * @return true if the comment is a triple-slash comment else false - */ - function isRecognizedTripleSlashComment(text: string, commentPos: number, commentEnd: number): boolean; - function isPinnedComment(text: string, start: number): boolean; - function getTokenPosOfNode(node: Node, sourceFile?: SourceFileLike, includeJsDoc?: boolean): number; - function getNonDecoratorTokenPosOfNode(node: Node, sourceFile?: SourceFileLike): number; - function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node, includeTrivia?: boolean): string; - function getTextOfNodeFromSourceText(sourceText: string, node: Node, includeTrivia?: boolean): string; - function getTextOfNode(node: Node, includeTrivia?: boolean): string; - /** - * Note: it is expected that the `nodeArray` and the `node` are within the same file. - * For example, searching for a `SourceFile` in a `SourceFile[]` wouldn't work. - */ - function indexOfNode(nodeArray: ReadonlyArray, node: Node): number; - /** - * Gets flags that control emit behavior of a node. - */ - function getEmitFlags(node: Node): EmitFlags; - function getLiteralText(node: LiteralLikeNode, sourceFile: SourceFile): string; - function getTextOfConstantValue(value: string | number): string; - function escapeLeadingUnderscores(identifier: string): __String; - /** - * @deprecated Use `id.escapedText` to get the escaped text of an Identifier. - * @param identifier The identifier to escape - */ - function escapeIdentifier(identifier: string): string; - function makeIdentifierFromModuleName(moduleName: string): string; - function isBlockOrCatchScoped(declaration: Declaration): boolean; - function isCatchClauseVariableDeclarationOrBindingElement(declaration: Declaration): boolean; - function isAmbientModule(node: Node): node is AmbientModuleDeclaration; - function isModuleWithStringLiteralName(node: Node): node is ModuleDeclaration; - function isNonGlobalAmbientModule(node: Node): node is ModuleDeclaration & { - name: StringLiteral; - }; - /** - * An effective module (namespace) declaration is either - * 1. An actual declaration: namespace X { ... } - * 2. A Javascript declaration, which is: - * An identifier in a nested property access expression: Y in `X.Y.Z = { ... }` - */ - function isEffectiveModuleDeclaration(node: Node): boolean; - /** Given a symbol for a module, checks that it is a shorthand ambient module. */ - function isShorthandAmbientModuleSymbol(moduleSymbol: Symbol): boolean; - function isBlockScopedContainerTopLevel(node: Node): boolean; - function isGlobalScopeAugmentation(module: ModuleDeclaration): boolean; - function isExternalModuleAugmentation(node: Node): node is AmbientModuleDeclaration; - function isModuleAugmentationExternal(node: AmbientModuleDeclaration): boolean; - function isEffectiveExternalModule(node: SourceFile, compilerOptions: CompilerOptions): boolean; - function isBlockScope(node: Node, parentNode: Node): boolean; - function isDeclarationWithTypeParameters(node: Node): node is DeclarationWithTypeParameters; - function isAnyImportSyntax(node: Node): node is AnyImportSyntax; - function isLateVisibilityPaintedStatement(node: Node): node is LateVisibilityPaintedStatement; - function isAnyImportOrReExport(node: Node): node is AnyImportOrReExport; - function getEnclosingBlockScopeContainer(node: Node): Node; - function declarationNameToString(name: DeclarationName | QualifiedName | undefined): string; - function getNameFromIndexInfo(info: IndexInfo): string | undefined; - function getTextOfPropertyName(name: PropertyName): __String; - function entityNameToString(name: EntityNameOrEntityNameExpression): string; - function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): DiagnosticWithLocation; - function createDiagnosticForNodeArray(sourceFile: SourceFile, nodes: NodeArray, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): Diagnostic; - function createDiagnosticForNodeInSourceFile(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): DiagnosticWithLocation; - function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain, relatedInformation?: DiagnosticRelatedInformation[]): DiagnosticWithLocation; - function getSpanOfTokenAtPosition(sourceFile: SourceFile, pos: number): TextSpan; - function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan; - function isExternalOrCommonJsModule(file: SourceFile): boolean; - function isJsonSourceFile(file: SourceFile): file is JsonSourceFile; - function isConstEnumDeclaration(node: Node): boolean; - function isConst(node: Node): boolean; - function isLet(node: Node): boolean; - function isSuperCall(n: Node): n is SuperCall; - function isImportCall(n: Node): n is ImportCall; - function isLiteralImportTypeNode(n: Node): n is LiteralImportTypeNode; - function isPrologueDirective(node: Node): node is PrologueDirective; - function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile): CommentRange[] | undefined; - function getJSDocCommentRanges(node: Node, text: string): CommentRange[] | undefined; - const fullTripleSlashReferencePathRegEx: RegExp; - const fullTripleSlashAMDReferencePathRegEx: RegExp; - function isPartOfTypeNode(node: Node): boolean; - function isChildOfNodeWithKind(node: Node, kind: SyntaxKind): boolean; - function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T | undefined; - function forEachYieldExpression(body: Block, visitor: (expr: YieldExpression) => void): void; - /** - * Gets the most likely element type for a TypeNode. This is not an exhaustive test - * as it assumes a rest argument can only be an array type (either T[], or Array). - * - * @param node The type node. - */ - function getRestParameterElementType(node: TypeNode | undefined): TypeNode | undefined; - function getMembersOfDeclaration(node: Declaration): NodeArray | undefined; - function isVariableLike(node: Node): node is VariableLikeDeclaration; - function isVariableLikeOrAccessor(node: Node): node is AccessorDeclaration | VariableLikeDeclaration; - function isVariableDeclarationInVariableStatement(node: VariableDeclaration): boolean; - function isValidESSymbolDeclaration(node: Node): node is VariableDeclaration | PropertyDeclaration | SignatureDeclaration; - function introducesArgumentsExoticObject(node: Node): boolean; - function unwrapInnermostStatementOfLabel(node: LabeledStatement, beforeUnwrapLabelCallback?: (node: LabeledStatement) => void): Statement; - function isFunctionBlock(node: Node): boolean; - function isObjectLiteralMethod(node: Node): node is MethodDeclaration; - function isObjectLiteralOrClassExpressionMethod(node: Node): node is MethodDeclaration; - function isIdentifierTypePredicate(predicate: TypePredicate): predicate is IdentifierTypePredicate; - function isThisTypePredicate(predicate: TypePredicate): predicate is ThisTypePredicate; - function getPropertyAssignment(objectLiteral: ObjectLiteralExpression, key: string, key2?: string): ReadonlyArray; - function getTsConfigObjectLiteralExpression(tsConfigSourceFile: TsConfigSourceFile | undefined): ObjectLiteralExpression | undefined; - function getTsConfigPropArrayElementValue(tsConfigSourceFile: TsConfigSourceFile | undefined, propKey: string, elementValue: string): StringLiteral | undefined; - function getTsConfigPropArray(tsConfigSourceFile: TsConfigSourceFile | undefined, propKey: string): ReadonlyArray; - function getContainingFunction(node: Node): SignatureDeclaration | undefined; - function getContainingClass(node: Node): ClassLikeDeclaration | undefined; - function getThisContainer(node: Node, includeArrowFunctions: boolean): Node; - function getNewTargetContainer(node: Node): Node | undefined; - /** - * Given an super call/property node, returns the closest node where - * - a super call/property access is legal in the node and not legal in the parent node the node. - * i.e. super call is legal in constructor but not legal in the class body. - * - the container is an arrow function (so caller might need to call getSuperContainer again in case it needs to climb higher) - * - a super call/property is definitely illegal in the container (but might be legal in some subnode) - * i.e. super property access is illegal in function declaration but can be legal in the statement list - */ - function getSuperContainer(node: Node, stopOnFunctions: boolean): Node; - function getImmediatelyInvokedFunctionExpression(func: Node): CallExpression | undefined; - /** - * Determines whether a node is a property or element access expression for `super`. - */ - function isSuperProperty(node: Node): node is SuperProperty; - /** - * Determines whether a node is a property or element access expression for `this`. - */ - function isThisProperty(node: Node): boolean; - function getEntityNameFromTypeNode(node: TypeNode): EntityNameOrEntityNameExpression | undefined; - function getInvokedExpression(node: CallLikeExpression): Expression; - function nodeCanBeDecorated(node: ClassDeclaration): true; - function nodeCanBeDecorated(node: ClassElement, parent: Node): boolean; - function nodeCanBeDecorated(node: Node, parent: Node, grandparent: Node): boolean; - function nodeIsDecorated(node: ClassDeclaration): boolean; - function nodeIsDecorated(node: ClassElement, parent: Node): boolean; - function nodeIsDecorated(node: Node, parent: Node, grandparent: Node): boolean; - function nodeOrChildIsDecorated(node: ClassDeclaration): boolean; - function nodeOrChildIsDecorated(node: ClassElement, parent: Node): boolean; - function nodeOrChildIsDecorated(node: Node, parent: Node, grandparent: Node): boolean; - function childIsDecorated(node: ClassDeclaration): boolean; - function childIsDecorated(node: Node, parent: Node): boolean; - function isJSXTagName(node: Node): boolean; - function isExpressionNode(node: Node): boolean; - function isInExpressionContext(node: Node): boolean; - function isExternalModuleImportEqualsDeclaration(node: Node): boolean; - function getExternalModuleImportEqualsDeclarationExpression(node: Node): Expression; - function isInternalModuleImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration; - function isSourceFileJavaScript(file: SourceFile): boolean; - function isSourceFileNotJavaScript(file: SourceFile): boolean; - function isInJavaScriptFile(node: Node | undefined): boolean; - function isInJsonFile(node: Node | undefined): boolean; - function isInJSDoc(node: Node | undefined): boolean; - function isJSDocIndexSignature(node: TypeReferenceNode | ExpressionWithTypeArguments): boolean | undefined; - /** - * Returns true if the node is a CallExpression to the identifier 'require' with - * exactly one argument (of the form 'require("name")'). - * This function does not test if the node is in a JavaScript file or not. - */ - function isRequireCall(callExpression: Node, checkArgumentIsStringLiteralLike: true): callExpression is RequireOrImportCall & { - expression: Identifier; - arguments: [StringLiteralLike]; - }; - function isRequireCall(callExpression: Node, checkArgumentIsStringLiteralLike: boolean): callExpression is CallExpression; - function isSingleOrDoubleQuote(charCode: number): boolean; - function isStringDoubleQuoted(str: StringLiteralLike, sourceFile: SourceFile): boolean; - function getDeclarationOfJSInitializer(node: Node): Node | undefined; - /** Get the initializer, taking into account defaulted Javascript initializers */ - function getEffectiveInitializer(node: HasExpressionInitializer): Expression | undefined; - /** Get the declaration initializer when it is container-like (See getJavascriptInitializer). */ - function getDeclaredJavascriptInitializer(node: HasExpressionInitializer): Expression | undefined; - /** - * Get the assignment 'initializer' -- the righthand side-- when the initializer is container-like (See getJavascriptInitializer). - * We treat the right hand side of assignments with container-like initalizers as declarations. - */ - function getAssignedJavascriptInitializer(node: Node): Expression | undefined; - /** - * Recognized Javascript container-like initializers are: - * 1. (function() {})() -- IIFEs - * 2. function() { } -- Function expressions - * 3. class { } -- Class expressions - * 4. {} -- Empty object literals - * 5. { ... } -- Non-empty object literals, when used to initialize a prototype, like `C.prototype = { m() { } }` - * - * This function returns the provided initializer, or undefined if it is not valid. - */ - function getJavascriptInitializer(initializer: Node, isPrototypeAssignment: boolean): Expression | undefined; - function isDefaultedJavascriptInitializer(node: BinaryExpression): boolean | undefined; - /** Given a Javascript initializer, return the outer name. That is, the lhs of the assignment or the declaration name. */ - function getOuterNameOfJsInitializer(node: Declaration): DeclarationName | undefined; - function getRightMostAssignedExpression(node: Expression): Expression; - function isExportsIdentifier(node: Node): boolean; - function isModuleExportsPropertyAccessExpression(node: Node): boolean; - function getSpecialPropertyAssignmentKind(expr: BinaryExpression): SpecialPropertyAssignmentKind; - function getSpecialPropertyAccessKind(lhs: PropertyAccessExpression): SpecialPropertyAssignmentKind; - function getInitializerOfBinaryExpression(expr: BinaryExpression): Expression; - function isPrototypePropertyAssignment(node: Node): boolean; - function isSpecialPropertyDeclaration(expr: PropertyAccessExpression): boolean; - function importFromModuleSpecifier(node: StringLiteralLike): AnyValidImportOrReExport; - function tryGetImportFromModuleSpecifier(node: StringLiteralLike): AnyValidImportOrReExport | undefined; - function getExternalModuleName(node: AnyImportOrReExport | ImportTypeNode): Expression | undefined; - function getNamespaceDeclarationNode(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): ImportEqualsDeclaration | NamespaceImport | undefined; - function isDefaultImport(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): boolean; - function hasQuestionToken(node: Node): boolean; - function isJSDocConstructSignature(node: Node): boolean; - function isJSDocTypeAlias(node: Node): node is JSDocTypedefTag | JSDocCallbackTag; - function isTypeAlias(node: Node): node is JSDocTypedefTag | JSDocCallbackTag | TypeAliasDeclaration; - function getJSDocCommentsAndTags(hostNode: Node): ReadonlyArray; - /** Does the opposite of `getJSDocParameterTags`: given a JSDoc parameter, finds the parameter corresponding to it. */ - function getParameterSymbolFromJSDoc(node: JSDocParameterTag): Symbol | undefined; - function getHostSignatureFromJSDoc(node: Node): SignatureDeclaration | undefined; - function getHostSignatureFromJSDocHost(host: HasJSDoc): SignatureDeclaration | undefined; - function getJSDocHost(node: Node): HasJSDoc; - function getTypeParameterFromJsDoc(node: TypeParameterDeclaration & { - parent: JSDocTemplateTag; - }): TypeParameterDeclaration | undefined; - function hasRestParameter(s: SignatureDeclaration | JSDocSignature): boolean; - function isRestParameter(node: ParameterDeclaration | JSDocParameterTag): boolean; - enum AssignmentKind { - None = 0, - Definite = 1, - Compound = 2 - } - function getAssignmentTargetKind(node: Node): AssignmentKind; - function isAssignmentTarget(node: Node): boolean; - type NodeWithPossibleHoistedDeclaration = Block | VariableStatement | WithStatement | IfStatement | SwitchStatement | CaseBlock | CaseClause | DefaultClause | LabeledStatement | ForStatement | ForInStatement | ForOfStatement | DoStatement | WhileStatement | TryStatement | CatchClause; - /** - * Indicates whether a node could contain a `var` VariableDeclarationList that contributes to - * the same `var` declaration scope as the node's parent. - */ - function isNodeWithPossibleHoistedDeclaration(node: Node): node is NodeWithPossibleHoistedDeclaration; - type ValueSignatureDeclaration = FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | AccessorDeclaration | FunctionExpression | ArrowFunction; - function isValueSignatureDeclaration(node: Node): node is ValueSignatureDeclaration; - function walkUpParenthesizedTypes(node: Node): Node; - function walkUpParenthesizedExpressions(node: Node): Node; - function skipParentheses(node: Expression): Expression; - function skipParentheses(node: Node): Node; - function isDeleteTarget(node: Node): boolean; - function isNodeDescendantOf(node: Node, ancestor: Node): boolean; - function isDeclarationName(name: Node): boolean; - function isAnyDeclarationName(name: Node): boolean; - function isLiteralComputedPropertyDeclarationName(node: Node): boolean; - function isIdentifierName(node: Identifier): boolean; - function isAliasSymbolDeclaration(node: Node): boolean; - function exportAssignmentIsAlias(node: ExportAssignment | BinaryExpression): boolean; - function getEffectiveBaseTypeNode(node: ClassLikeDeclaration | InterfaceDeclaration): ExpressionWithTypeArguments | undefined; - function getClassExtendsHeritageElement(node: ClassLikeDeclaration | InterfaceDeclaration): ExpressionWithTypeArguments | undefined; - function getClassImplementsHeritageClauseElements(node: ClassLikeDeclaration): NodeArray | undefined; - /** Returns the node in an `extends` or `implements` clause of a class or interface. */ - function getAllSuperTypeNodes(node: Node): ReadonlyArray; - function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray | undefined; - function getHeritageClause(clauses: NodeArray | undefined, kind: SyntaxKind): HeritageClause | undefined; - function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile | undefined; - function getAncestor(node: Node | undefined, kind: SyntaxKind): Node | undefined; - function isKeyword(token: SyntaxKind): boolean; - function isContextualKeyword(token: SyntaxKind): boolean; - function isNonContextualKeyword(token: SyntaxKind): boolean; - function isStringANonContextualKeyword(name: string): boolean; - type TriviaKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; - function isTrivia(token: SyntaxKind): token is TriviaKind; - enum FunctionFlags { - Normal = 0, - Generator = 1, - Async = 2, - Invalid = 4, - AsyncGenerator = 3 - } - function getFunctionFlags(node: SignatureDeclaration | undefined): FunctionFlags; - function isAsyncFunction(node: Node): boolean; - function isStringOrNumericLiteral(node: Node): node is StringLiteral | NumericLiteral; - /** - * A declaration has a dynamic name if both of the following are true: - * 1. The declaration has a computed property name - * 2. The computed name is *not* expressed as Symbol., where name - * is a property of the Symbol constructor that denotes a built in - * Symbol. - */ - function hasDynamicName(declaration: Declaration): declaration is DynamicNamedDeclaration; - function isDynamicName(name: DeclarationName): boolean; - /** - * Checks if the expression is of the form: - * Symbol.name - * where Symbol is literally the word "Symbol", and name is any identifierName - */ - function isWellKnownSymbolSyntactically(node: Expression): boolean; - function getPropertyNameForPropertyNameNode(name: DeclarationName): __String | undefined; - type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral; - function isPropertyNameLiteral(node: Node): node is PropertyNameLiteral; - function getTextOfIdentifierOrLiteral(node: PropertyNameLiteral): string; - function getEscapedTextOfIdentifierOrLiteral(node: PropertyNameLiteral): __String; - function getPropertyNameForKnownSymbolName(symbolName: string): __String; - function isKnownSymbol(symbol: Symbol): boolean; - /** - * Includes the word "Symbol" with unicode escapes - */ - function isESSymbolIdentifier(node: Node): boolean; - function isPushOrUnshiftIdentifier(node: Identifier): boolean; - function isParameterDeclaration(node: VariableLikeDeclaration): boolean; - function getRootDeclaration(node: Node): Node; - function nodeStartsNewLexicalEnvironment(node: Node): boolean; - function nodeIsSynthesized(range: TextRange): boolean; - function getOriginalSourceFile(sourceFile: SourceFile): SourceFile; - enum Associativity { - Left = 0, - Right = 1 - } - function getExpressionAssociativity(expression: Expression): Associativity; - function getOperatorAssociativity(kind: SyntaxKind, operator: SyntaxKind, hasArguments?: boolean): Associativity; - function getExpressionPrecedence(expression: Expression): number; - function getOperator(expression: Expression): SyntaxKind; - function getOperatorPrecedence(nodeKind: SyntaxKind, operatorKind: SyntaxKind, hasArguments?: boolean): number; - function getBinaryOperatorPrecedence(kind: SyntaxKind): number; - function createDiagnosticCollection(): DiagnosticCollection; - /** - * Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2), - * but augmented for a few select characters (e.g. lineSeparator, paragraphSeparator, nextLine) - * Note that this doesn't actually wrap the input in double quotes. - */ - function escapeString(s: string, quoteChar?: CharacterCodes.doubleQuote | CharacterCodes.singleQuote | CharacterCodes.backtick): string; - function isIntrinsicJsxName(name: __String | string): boolean; - function escapeNonAsciiString(s: string, quoteChar?: CharacterCodes.doubleQuote | CharacterCodes.singleQuote | CharacterCodes.backtick): string; - function getIndentString(level: number): string; - function getIndentSize(): number; - function createTextWriter(newLine: string): EmitTextWriter; - function getResolvedExternalModuleName(host: EmitHost, file: SourceFile, referenceFile?: SourceFile): string; - function getExternalModuleNameFromDeclaration(host: EmitHost, resolver: EmitResolver, declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration | ImportTypeNode): string | undefined; - /** - * Resolves a local path to a path which is absolute to the base of the emit - */ - function getExternalModuleNameFromPath(host: EmitHost, fileName: string, referencePath?: string): string; - function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string): string; - function getDeclarationEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost): string; - interface EmitFileNames { - jsFilePath: string; - sourceMapFilePath: string | undefined; - declarationFilePath: string | undefined; - declarationMapPath: string | undefined; - bundleInfoPath: string | undefined; - } - /** - * Gets the source files that are expected to have an emit output. - * - * Originally part of `forEachExpectedEmitFile`, this functionality was extracted to support - * transformations. - * - * @param host An EmitHost. - * @param targetSourceFile An optional target source file to emit. - */ - function getSourceFilesToEmit(host: EmitHost, targetSourceFile?: SourceFile): ReadonlyArray; - /** Don't call this for `--outFile`, just for `--outDir` or plain emit. `--outFile` needs additional checks. */ - function sourceFileMayBeEmitted(sourceFile: SourceFile, options: CompilerOptions, isSourceFileFromExternalLibrary: (file: SourceFile) => boolean): boolean; - function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string; - function writeFile(host: EmitHost, diagnostics: DiagnosticCollection, fileName: string, data: string, writeByteOrderMark: boolean, sourceFiles?: ReadonlyArray): void; - function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number; - function getLineOfLocalPositionFromLineMap(lineMap: ReadonlyArray, pos: number): number; - function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration | undefined; - /** Get the type annotation for the value parameter. */ - function getSetAccessorTypeAnnotationNode(accessor: SetAccessorDeclaration): TypeNode | undefined; - function getThisParameter(signature: SignatureDeclaration | JSDocSignature): ParameterDeclaration | undefined; - function parameterIsThisKeyword(parameter: ParameterDeclaration): boolean; - function isThisIdentifier(node: Node | undefined): boolean; - function identifierIsThisKeyword(id: Identifier): boolean; - function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration): AllAccessorDeclarations; - /** - * Gets the effective type annotation of a variable, parameter, or property. If the node was - * parsed in a JavaScript file, gets the type annotation from JSDoc. - */ - function getEffectiveTypeAnnotationNode(node: Node): TypeNode | undefined; - function getTypeAnnotationNode(node: Node): TypeNode | undefined; - /** - * Gets the effective return type annotation of a signature. If the node was parsed in a - * JavaScript file, gets the return type annotation from JSDoc. - */ - function getEffectiveReturnTypeNode(node: SignatureDeclaration | JSDocSignature): TypeNode | undefined; - /** - * Gets the effective type parameters. If the node was parsed in a - * JavaScript file, gets the type parameters from the `@template` tag from JSDoc. - */ - function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters): ReadonlyArray; - function getJSDocTypeParameterDeclarations(node: DeclarationWithTypeParameters): ReadonlyArray; - /** - * Gets the effective type annotation of the value parameter of a set accessor. If the node - * was parsed in a JavaScript file, gets the type annotation from JSDoc. - */ - function getEffectiveSetAccessorTypeAnnotationNode(node: SetAccessorDeclaration): TypeNode | undefined; - function emitNewLineBeforeLeadingComments(lineMap: ReadonlyArray, writer: EmitTextWriter, node: TextRange, leadingComments: ReadonlyArray | undefined): void; - function emitNewLineBeforeLeadingCommentsOfPosition(lineMap: ReadonlyArray, writer: EmitTextWriter, pos: number, leadingComments: ReadonlyArray | undefined): void; - function emitNewLineBeforeLeadingCommentOfPosition(lineMap: ReadonlyArray, writer: EmitTextWriter, pos: number, commentPos: number): void; - function emitComments(text: string, lineMap: ReadonlyArray, writer: EmitTextWriter, comments: ReadonlyArray | undefined, leadingSeparator: boolean, trailingSeparator: boolean, newLine: string, writeComment: (text: string, lineMap: ReadonlyArray, writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) => void): void; - /** - * Detached comment is a comment at the top of file or function body that is separated from - * the next statement by space. - */ - function emitDetachedComments(text: string, lineMap: ReadonlyArray, writer: EmitTextWriter, writeComment: (text: string, lineMap: ReadonlyArray, writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) => void, node: TextRange, newLine: string, removeComments: boolean): { - nodePos: number; - detachedCommentEndPos: number; - } | undefined; - function writeCommentRange(text: string, lineMap: ReadonlyArray, writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string): void; - function hasModifiers(node: Node): boolean; - function hasModifier(node: Node, flags: ModifierFlags): boolean; - function hasStaticModifier(node: Node): boolean; - function hasReadonlyModifier(node: Node): boolean; - function getSelectedModifierFlags(node: Node, flags: ModifierFlags): ModifierFlags; - function getModifierFlags(node: Node): ModifierFlags; - function getModifierFlagsNoCache(node: Node): ModifierFlags; - function modifierToFlag(token: SyntaxKind): ModifierFlags; - function isLogicalOperator(token: SyntaxKind): boolean; - function isAssignmentOperator(token: SyntaxKind): boolean; - /** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */ - function tryGetClassExtendingExpressionWithTypeArguments(node: Node): ClassLikeDeclaration | undefined; - function isAssignmentExpression(node: Node, excludeCompoundAssignment: true): node is AssignmentExpression; - function isAssignmentExpression(node: Node, excludeCompoundAssignment?: false): node is AssignmentExpression; - function isDestructuringAssignment(node: Node): node is DestructuringAssignment; - function isExpressionWithTypeArgumentsInClassExtendsClause(node: Node): boolean; - function isExpressionWithTypeArgumentsInClassImplementsClause(node: Node): node is ExpressionWithTypeArguments; - function isEntityNameExpression(node: Node): node is EntityNameExpression; - function isPropertyAccessEntityNameExpression(node: Node): node is PropertyAccessEntityNameExpression; - function isPrototypeAccess(node: Node): node is PropertyAccessExpression; - function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean; - function isEmptyObjectLiteral(expression: Node): boolean; - function isEmptyArrayLiteral(expression: Node): boolean; - function getLocalSymbolForExportDefault(symbol: Symbol): Symbol | undefined; - /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ - function tryExtractTypeScriptExtension(fileName: string): string | undefined; - /** - * Converts a string to a base-64 encoded ASCII string. - */ - function convertToBase64(input: string): string; - function base64encode(host: { - base64encode?(input: string): string; - } | undefined, input: string): string; - function base64decode(host: { - base64decode?(input: string): string; - } | undefined, input: string): string; - function getNewLineCharacter(options: CompilerOptions | PrinterOptions, getNewLine?: () => string): string; - function formatSyntaxKind(kind: SyntaxKind | undefined): string; - function formatModifierFlags(flags: ModifierFlags | undefined): string; - function formatTransformFlags(flags: TransformFlags | undefined): string; - function formatEmitFlags(flags: EmitFlags | undefined): string; - function formatSymbolFlags(flags: SymbolFlags | undefined): string; - function formatTypeFlags(flags: TypeFlags | undefined): string; - function formatObjectFlags(flags: ObjectFlags | undefined): string; - /** - * Creates a new TextRange from the provided pos and end. - * - * @param pos The start position. - * @param end The end position. - */ - function createRange(pos: number, end: number): TextRange; - /** - * Creates a new TextRange from a provided range with a new end position. - * - * @param range A TextRange. - * @param end The new end position. - */ - function moveRangeEnd(range: TextRange, end: number): TextRange; - /** - * Creates a new TextRange from a provided range with a new start position. - * - * @param range A TextRange. - * @param pos The new Start position. - */ - function moveRangePos(range: TextRange, pos: number): TextRange; - /** - * Moves the start position of a range past any decorators. - */ - function moveRangePastDecorators(node: Node): TextRange; - /** - * Moves the start position of a range past any decorators or modifiers. - */ - function moveRangePastModifiers(node: Node): TextRange; - /** - * Determines whether a TextRange has the same start and end positions. - * - * @param range A TextRange. - */ - function isCollapsedRange(range: TextRange): boolean; - /** - * Creates a new TextRange for a token at the provides start position. - * - * @param pos The start position. - * @param token The token. - */ - function createTokenRange(pos: number, token: SyntaxKind): TextRange; - function rangeIsOnSingleLine(range: TextRange, sourceFile: SourceFile): boolean; - function rangeStartPositionsAreOnSameLine(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; - function rangeEndPositionsAreOnSameLine(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; - function rangeStartIsOnSameLineAsRangeEnd(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; - function rangeEndIsOnSameLineAsRangeStart(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; - function positionsAreOnSameLine(pos1: number, pos2: number, sourceFile: SourceFile): boolean; - function getStartPositionOfRange(range: TextRange, sourceFile: SourceFile): number; - /** - * Determines whether a name was originally the declaration name of an enum or namespace - * declaration. - */ - function isDeclarationNameOfEnumOrNamespace(node: Identifier): boolean; - function getInitializedVariables(node: VariableDeclarationList): ReadonlyArray; - function isWatchSet(options: CompilerOptions): boolean | undefined; - function closeFileWatcher(watcher: FileWatcher): void; - function getCheckFlags(symbol: Symbol): CheckFlags; - function getDeclarationModifierFlagsFromSymbol(s: Symbol): ModifierFlags; - function skipAlias(symbol: Symbol, checker: TypeChecker): Symbol; - /** See comment on `declareModuleMember` in `binder.ts`. */ - function getCombinedLocalAndExportSymbolFlags(symbol: Symbol): SymbolFlags; - function isWriteOnlyAccess(node: Node): boolean; - function isWriteAccess(node: Node): boolean; - function compareDataObjects(dst: any, src: any): boolean; - /** - * clears already present map by calling onDeleteExistingValue callback before deleting that key/value - */ - function clearMap(map: Map, onDeleteValue: (valueInMap: T, key: string) => void): void; - interface MutateMapOptions { - createNewValue(key: string, valueInNewMap: U): T; - onDeleteValue(existingValue: T, key: string): void; - /** - * If present this is called with the key when there is value for that key both in new map as well as existing map provided - * Caller can then decide to update or remove this key. - * If the key is removed, caller will get callback of createNewValue for that key. - * If this callback is not provided, the value of such keys is not updated. - */ - onExistingValue?(existingValue: T, valueInNewMap: U, key: string): void; - } - /** - * Mutates the map with newMap such that keys in map will be same as newMap. - */ - function mutateMap(map: Map, newMap: ReadonlyMap, options: MutateMapOptions): void; - /** Calls `callback` on `directory` and every ancestor directory it has, returning the first defined result. */ - function forEachAncestorDirectory(directory: string, callback: (directory: string) => T | undefined): T | undefined; - function isAbstractConstructorType(type: Type): boolean; - function isAbstractConstructorSymbol(symbol: Symbol): boolean; - function getClassLikeDeclarationOfSymbol(symbol: Symbol): ClassLikeDeclaration | undefined; - function getObjectFlags(type: Type): ObjectFlags; - function typeHasCallOrConstructSignatures(type: Type, checker: TypeChecker): boolean; - function forSomeAncestorDirectory(directory: string, callback: (directory: string) => boolean): boolean; - function isUMDExportSymbol(symbol: Symbol | undefined): boolean | undefined; - function showModuleSpecifier({ moduleSpecifier }: ImportDeclaration): string; - function getLastChild(node: Node): Node | undefined; - /** Add a value to a set, and return true if it wasn't already present. */ - function addToSeen(seen: Map, key: string | number): boolean; - function addToSeen(seen: Map, key: string | number, value: T): boolean; - function isObjectTypeDeclaration(node: Node): node is ObjectTypeDeclaration; -} declare namespace ts { function getDefaultLibFileName(options: CompilerOptions): string; function textSpanEnd(span: TextSpan): number; @@ -6653,7 +3167,6 @@ declare namespace ts { function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean; function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan | undefined; function createTextSpan(start: number, length: number): TextSpan; - function createTextRange(pos: number, end?: number): TextRange; function createTextSpanFromBounds(start: number, end: number): TextSpan; function textChangeRangeNewSpan(range: TextChangeRange): TextSpan; function textChangeRangeIsUnchanged(range: TextChangeRange): boolean; @@ -6730,10 +3243,6 @@ declare namespace ts { */ function unescapeIdentifier(id: string): string; function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | undefined; - /** @internal */ - function isNamedDeclaration(node: Node): node is NamedDeclaration & { - name: DeclarationName; - }; function getNameOfDeclaration(declaration: Declaration | Expression): DeclarationName | undefined; /** * Gets the JSDoc parameter tags for the node if present. @@ -6817,7 +3326,6 @@ declare namespace ts { function isCallSignatureDeclaration(node: Node): node is CallSignatureDeclaration; function isConstructSignatureDeclaration(node: Node): node is ConstructSignatureDeclaration; function isIndexSignatureDeclaration(node: Node): node is IndexSignatureDeclaration; - function isGetOrSetAccessorDeclaration(node: Node): node is AccessorDeclaration; function isTypePredicateNode(node: Node): node is TypePredicateNode; function isTypeReferenceNode(node: Node): node is TypeReferenceNode; function isFunctionTypeNode(node: Node): node is FunctionTypeNode; @@ -6961,39 +3469,25 @@ declare namespace ts { function isJSDocSignature(node: Node): node is JSDocSignature; } declare namespace ts { - function isSyntaxList(n: Node): n is SyntaxList; - function isNode(node: Node): boolean; - function isNodeKind(kind: SyntaxKind): boolean; /** * True if node is of some token syntax kind. * For example, this is true for an IfKeyword but not for an IfStatement. * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isToken(n: Node): boolean; - function isNodeArray(array: ReadonlyArray): array is NodeArray; - function isLiteralKind(kind: SyntaxKind): boolean; function isLiteralExpression(node: Node): node is LiteralExpression; - function isTemplateLiteralKind(kind: SyntaxKind): boolean; type TemplateLiteralToken = NoSubstitutionTemplateLiteral | TemplateHead | TemplateMiddle | TemplateTail; function isTemplateLiteralToken(node: Node): node is TemplateLiteralToken; function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail; function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken; - function isGeneratedIdentifier(node: Node): node is GeneratedIdentifier; - function isModifierKind(token: SyntaxKind): token is Modifier["kind"]; - function isParameterPropertyModifier(kind: SyntaxKind): boolean; - function isClassMemberModifier(idToken: SyntaxKind): boolean; function isModifier(node: Node): node is Modifier; function isEntityName(node: Node): node is EntityName; function isPropertyName(node: Node): node is PropertyName; function isBindingName(node: Node): node is BindingName; function isFunctionLike(node: Node): node is SignatureDeclaration; - function isFunctionLikeDeclaration(node: Node): node is FunctionLikeDeclaration; - function isFunctionLikeKind(kind: SyntaxKind): boolean; - function isFunctionOrModuleBlock(node: Node): boolean; function isClassElement(node: Node): node is ClassElement; function isClassLike(node: Node): node is ClassLikeDeclaration; function isAccessor(node: Node): node is AccessorDeclaration; - function isMethodOrAccessor(node: Node): node is MethodDeclaration | AccessorDeclaration; function isTypeElement(node: Node): node is TypeElement; function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement; function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike; @@ -7004,405 +3498,24 @@ declare namespace ts { */ function isTypeNode(node: Node): node is TypeNode; function isFunctionOrConstructorTypeNode(node: Node): node is FunctionTypeNode | ConstructorTypeNode; - function isBindingPattern(node: Node | undefined): node is BindingPattern; - function isAssignmentPattern(node: Node): node is AssignmentPattern; - function isArrayBindingElement(node: Node): node is ArrayBindingElement; - /** - * Determines whether the BindingOrAssignmentElement is a BindingElement-like declaration - */ - function isDeclarationBindingElement(bindingElement: BindingOrAssignmentElement): bindingElement is VariableDeclaration | ParameterDeclaration | BindingElement; - /** - * Determines whether a node is a BindingOrAssignmentPattern - */ - function isBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is BindingOrAssignmentPattern; - /** - * Determines whether a node is an ObjectBindingOrAssignmentPattern - */ - function isObjectBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is ObjectBindingOrAssignmentPattern; - /** - * Determines whether a node is an ArrayBindingOrAssignmentPattern - */ - function isArrayBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is ArrayBindingOrAssignmentPattern; - function isPropertyAccessOrQualifiedNameOrImportTypeNode(node: Node): node is PropertyAccessExpression | QualifiedName | ImportTypeNode; function isPropertyAccessOrQualifiedName(node: Node): node is PropertyAccessExpression | QualifiedName; function isCallLikeExpression(node: Node): node is CallLikeExpression; function isCallOrNewExpression(node: Node): node is CallExpression | NewExpression; function isTemplateLiteral(node: Node): node is TemplateLiteral; - function isLeftHandSideExpression(node: Node): node is LeftHandSideExpression; - function isUnaryExpression(node: Node): node is UnaryExpression; - function isUnaryExpressionWithWrite(expr: Node): expr is PrefixUnaryExpression | PostfixUnaryExpression; - /** - * Determines whether a node is an expression based only on its kind. - * Use `isExpressionNode` if not in transforms. - */ - function isExpression(node: Node): node is Expression; function isAssertionExpression(node: Node): node is AssertionExpression; - function isPartiallyEmittedExpression(node: Node): node is PartiallyEmittedExpression; - function isNotEmittedStatement(node: Node): node is NotEmittedStatement; - function isNotEmittedOrPartiallyEmittedNode(node: Node): node is NotEmittedStatement | PartiallyEmittedExpression; function isIterationStatement(node: Node, lookInLabeledStatements: false): node is IterationStatement; function isIterationStatement(node: Node, lookInLabeledStatements: boolean): node is IterationStatement | LabeledStatement; - function isForInOrOfStatement(node: Node): node is ForInOrOfStatement; - function isConciseBody(node: Node): node is ConciseBody; - function isFunctionBody(node: Node): node is FunctionBody; - function isForInitializer(node: Node): node is ForInitializer; - function isModuleBody(node: Node): node is ModuleBody; - function isNamespaceBody(node: Node): node is NamespaceBody; - function isJSDocNamespaceBody(node: Node): node is JSDocNamespaceBody; - function isNamedImportBindings(node: Node): node is NamedImportBindings; - function isModuleOrEnumDeclaration(node: Node): node is ModuleDeclaration | EnumDeclaration; - function isDeclaration(node: Node): node is NamedDeclaration; - function isDeclarationStatement(node: Node): node is DeclarationStatement; - /** - * Determines whether the node is a statement that is not also a declaration - */ - function isStatementButNotDeclaration(node: Node): node is Statement; - function isStatement(node: Node): node is Statement; - function isModuleReference(node: Node): node is ModuleReference; - function isJsxTagNameExpression(node: Node): node is JsxTagNameExpression; - function isJsxChild(node: Node): node is JsxChild; - function isJsxAttributeLike(node: Node): node is JsxAttributeLike; - function isStringLiteralOrJsxExpression(node: Node): node is StringLiteral | JsxExpression; function isJsxOpeningLikeElement(node: Node): node is JsxOpeningLikeElement; function isCaseOrDefaultClause(node: Node): node is CaseOrDefaultClause; - /** True if node is of some JSDoc syntax kind. */ - function isJSDocNode(node: Node): boolean; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node: Node): boolean; - function isJSDocTag(node: Node): boolean; function isSetAccessor(node: Node): node is SetAccessorDeclaration; function isGetAccessor(node: Node): node is GetAccessorDeclaration; - /** True if has jsdoc nodes attached to it. */ - function hasJSDocNodes(node: Node): node is HasJSDoc; - /** True if has type node attached to it. */ - function hasType(node: Node): node is HasType; - function couldHaveType(node: Node): node is HasType; - /** True if has initializer node attached to it. */ - function hasInitializer(node: Node): node is HasInitializer; - /** True if has initializer node attached to it. */ - function hasOnlyExpressionInitializer(node: Node): node is HasExpressionInitializer; function isObjectLiteralElement(node: Node): node is ObjectLiteralElement; - function isTypeReferenceType(node: Node): node is TypeReferenceType; - function guessIndentation(lines: string[]): number | undefined; function isStringLiteralLike(node: Node): node is StringLiteralLike; } -declare namespace ts { - /** @internal */ - function isNamedImportsOrExports(node: Node): node is NamedImportsOrExports; - interface ObjectAllocator { - getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node; - getTokenConstructor(): new (kind: TKind, pos?: number, end?: number) => Token; - getIdentifierConstructor(): new (kind: SyntaxKind.Identifier, pos?: number, end?: number) => Identifier; - getSourceFileConstructor(): new (kind: SyntaxKind.SourceFile, pos?: number, end?: number) => SourceFile; - getSymbolConstructor(): new (flags: SymbolFlags, name: __String) => Symbol; - getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type; - getSignatureConstructor(): new (checker: TypeChecker) => Signature; - getSourceMapSourceConstructor(): new (fileName: string, text: string, skipTrivia?: (pos: number) => number) => SourceMapSource; - } - let objectAllocator: ObjectAllocator; - function formatStringFromArgs(text: string, args: ArrayLike, baseIndex?: number): string; - let localizedDiagnosticMessages: MapLike | undefined; - function getLocaleSpecificMessage(message: DiagnosticMessage): string; - function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: (string | number | undefined)[]): DiagnosticWithLocation; - function formatMessage(_dummy: any, message: DiagnosticMessage): string; - function createCompilerDiagnostic(message: DiagnosticMessage, ...args: (string | number | undefined)[]): Diagnostic; - function createCompilerDiagnosticFromMessageChain(chain: DiagnosticMessageChain): Diagnostic; - function chainDiagnosticMessages(details: DiagnosticMessageChain | undefined, message: DiagnosticMessage, ...args: (string | undefined)[]): DiagnosticMessageChain; - function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain; - function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): Comparison; - function getEmitScriptTarget(compilerOptions: CompilerOptions): ScriptTarget; - function getEmitModuleKind(compilerOptions: { - module?: CompilerOptions["module"]; - target?: CompilerOptions["target"]; - }): ModuleKind; - function getEmitModuleResolutionKind(compilerOptions: CompilerOptions): ModuleResolutionKind; - function unreachableCodeIsError(options: CompilerOptions): boolean; - function unusedLabelIsError(options: CompilerOptions): boolean; - function getAreDeclarationMapsEnabled(options: CompilerOptions): boolean; - function getAllowSyntheticDefaultImports(compilerOptions: CompilerOptions): boolean; - function getEmitDeclarations(compilerOptions: CompilerOptions): boolean; - type StrictOptionName = "noImplicitAny" | "noImplicitThis" | "strictNullChecks" | "strictFunctionTypes" | "strictPropertyInitialization" | "alwaysStrict"; - function getStrictOptionValue(compilerOptions: CompilerOptions, flag: StrictOptionName): boolean; - function hasZeroOrOneAsteriskCharacter(str: string): boolean; - /** - * Internally, we represent paths as strings with '/' as the directory separator. - * When we make system calls (eg: LanguageServiceHost.getDirectory()), - * we expect the host to correctly handle paths in our specified format. - */ - const directorySeparator = "/"; - /** - * Normalize path separators. - */ - function normalizeSlashes(path: string): string; - /** - * Returns length of the root part of a path or URL (i.e. length of "/", "x:/", "//server/share/, file:///user/files"). - * - * For example: - * ```ts - * getRootLength("a") === 0 // "" - * getRootLength("/") === 1 // "/" - * getRootLength("c:") === 2 // "c:" - * getRootLength("c:d") === 0 // "" - * getRootLength("c:/") === 3 // "c:/" - * getRootLength("c:\\") === 3 // "c:\\" - * getRootLength("//server") === 7 // "//server" - * getRootLength("//server/share") === 8 // "//server/" - * getRootLength("\\\\server") === 7 // "\\\\server" - * getRootLength("\\\\server\\share") === 8 // "\\\\server\\" - * getRootLength("file:///path") === 8 // "file:///" - * getRootLength("file:///c:") === 10 // "file:///c:" - * getRootLength("file:///c:d") === 8 // "file:///" - * getRootLength("file:///c:/path") === 11 // "file:///c:/" - * getRootLength("file://server") === 13 // "file://server" - * getRootLength("file://server/path") === 14 // "file://server/" - * getRootLength("http://server") === 13 // "http://server" - * getRootLength("http://server/path") === 14 // "http://server/" - * ``` - */ - function getRootLength(path: string): number; - function normalizePath(path: string): string; - function normalizePathAndParts(path: string): { - path: string; - parts: string[]; - }; - /** - * Returns the path except for its basename. Semantics align with NodeJS's `path.dirname` - * except that we support URL's as well. - * - * ```ts - * getDirectoryPath("/path/to/file.ext") === "/path/to" - * getDirectoryPath("/path/to/") === "/path" - * getDirectoryPath("/") === "/" - * ``` - */ - function getDirectoryPath(path: Path): Path; - /** - * Returns the path except for its basename. Semantics align with NodeJS's `path.dirname` - * except that we support URL's as well. - * - * ```ts - * getDirectoryPath("/path/to/file.ext") === "/path/to" - * getDirectoryPath("/path/to/") === "/path" - * getDirectoryPath("/") === "/" - * ``` - */ - function getDirectoryPath(path: string): string; - function isUrl(path: string): boolean; - function pathIsRelative(path: string): boolean; - /** - * Determines whether a path is an absolute path (e.g. starts with `/`, or a dos path - * like `c:`, `c:\` or `c:/`). - */ - function isRootedDiskPath(path: string): boolean; - /** - * Determines whether a path consists only of a path root. - */ - function isDiskPathRoot(path: string): boolean; - function convertToRelativePath(absoluteOrRelativePath: string, basePath: string, getCanonicalFileName: (path: string) => string): string; - /** - * Parse a path into an array containing a root component (at index 0) and zero or more path - * components (at indices > 0). The result is not normalized. - * If the path is relative, the root component is `""`. - * If the path is absolute, the root component includes the first path separator (`/`). - */ - function getPathComponents(path: string, currentDirectory?: string): string[]; - /** - * Reduce an array of path components to a more simplified path by navigating any - * `"."` or `".."` entries in the path. - */ - function reducePathComponents(components: ReadonlyArray): string[]; - /** - * Parse a path into an array containing a root component (at index 0) and zero or more path - * components (at indices > 0). The result is normalized. - * If the path is relative, the root component is `""`. - * If the path is absolute, the root component includes the first path separator (`/`). - */ - function getNormalizedPathComponents(path: string, currentDirectory: string | undefined): string[]; - function getNormalizedAbsolutePath(fileName: string, currentDirectory: string | undefined): string; - /** - * Formats a parsed path consisting of a root component (at index 0) and zero or more path - * segments (at indices > 0). - */ - function getPathFromPathComponents(pathComponents: ReadonlyArray): string; -} -declare namespace ts { - function getPathComponentsRelativeTo(from: string, to: string, stringEqualityComparer: (a: string, b: string) => boolean, getCanonicalFileName: GetCanonicalFileName): string[]; - function getRelativePathFromFile(from: string, to: string, getCanonicalFileName: GetCanonicalFileName): string; - /** - * Gets a relative path that can be used to traverse between `from` and `to`. - */ - function getRelativePathFromDirectory(from: string, to: string, ignoreCase: boolean): string; - /** - * Gets a relative path that can be used to traverse between `from` and `to`. - */ - function getRelativePathFromDirectory(fromDirectory: string, to: string, getCanonicalFileName: GetCanonicalFileName): string; - function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: GetCanonicalFileName, isAbsolutePathAnUrl: boolean): string; - /** - * Ensures a path is either absolute (prefixed with `/` or `c:`) or dot-relative (prefixed - * with `./` or `../`) so as not to be confused with an unprefixed module name. - */ - function ensurePathIsNonModuleName(path: string): string; - /** - * Returns the path except for its containing directory name. - * Semantics align with NodeJS's `path.basename` except that we support URL's as well. - * - * ```ts - * getBaseFileName("/path/to/file.ext") === "file.ext" - * getBaseFileName("/path/to/") === "to" - * getBaseFileName("/") === "" - * ``` - */ - function getBaseFileName(path: string): string; - /** - * Gets the portion of a path following the last (non-terminal) separator (`/`). - * Semantics align with NodeJS's `path.basename` except that we support URL's as well. - * If the base name has any one of the provided extensions, it is removed. - * - * ```ts - * getBaseFileName("/path/to/file.ext", ".ext", true) === "file" - * getBaseFileName("/path/to/file.js", ".ext", true) === "file.js" - * ``` - */ - function getBaseFileName(path: string, extensions: string | ReadonlyArray, ignoreCase: boolean): string; - /** - * Combines paths. If a path is absolute, it replaces any previous path. - */ - function combinePaths(path: string, ...paths: (string | undefined)[]): string; - /** - * Combines and resolves paths. If a path is absolute, it replaces any previous path. Any - * `.` and `..` path components are resolved. - */ - function resolvePath(path: string, ...paths: (string | undefined)[]): string; - /** - * Determines whether a path has a trailing separator (`/` or `\\`). - */ - function hasTrailingDirectorySeparator(path: string): boolean; - /** - * Removes a trailing directory separator from a path. - * @param path The path. - */ - function removeTrailingDirectorySeparator(path: Path): Path; - function removeTrailingDirectorySeparator(path: string): string; - /** - * Adds a trailing directory separator to a path, if it does not already have one. - * @param path The path. - */ - function ensureTrailingDirectorySeparator(path: Path): Path; - function ensureTrailingDirectorySeparator(path: string): string; - /** - * Performs a case-sensitive comparison of two paths. - */ - function comparePathsCaseSensitive(a: string, b: string): Comparison; - /** - * Performs a case-insensitive comparison of two paths. - */ - function comparePathsCaseInsensitive(a: string, b: string): Comparison; - function comparePaths(a: string, b: string, ignoreCase?: boolean): Comparison; - function comparePaths(a: string, b: string, currentDirectory: string, ignoreCase?: boolean): Comparison; - function containsPath(parent: string, child: string, ignoreCase?: boolean): boolean; - function containsPath(parent: string, child: string, currentDirectory: string, ignoreCase?: boolean): boolean; - function tryRemoveDirectoryPrefix(path: string, dirPath: string, getCanonicalFileName: GetCanonicalFileName): string | undefined; - function hasExtension(fileName: string): boolean; - const commonPackageFolders: ReadonlyArray; - function getRegularExpressionForWildcard(specs: ReadonlyArray | undefined, basePath: string, usage: "files" | "directories" | "exclude"): string | undefined; - /** - * An "includes" path "foo" is implicitly a glob "foo/** /*" (without the space) if its last component has no extension, - * and does not contain any glob characters itself. - */ - function isImplicitGlob(lastPathComponent: string): boolean; - interface FileSystemEntries { - readonly files: ReadonlyArray; - readonly directories: ReadonlyArray; - } - interface FileMatcherPatterns { - /** One pattern for each "include" spec. */ - includeFilePatterns: ReadonlyArray | undefined; - /** One pattern matching one of any of the "include" specs. */ - includeFilePattern: string | undefined; - includeDirectoryPattern: string | undefined; - excludePattern: string | undefined; - basePaths: ReadonlyArray; - } - /** @param path directory of the tsconfig.json */ - function getFileMatcherPatterns(path: string, excludes: ReadonlyArray | undefined, includes: ReadonlyArray | undefined, useCaseSensitiveFileNames: boolean, currentDirectory: string): FileMatcherPatterns; - function getRegexFromPattern(pattern: string, useCaseSensitiveFileNames: boolean): RegExp; - /** @param path directory of the tsconfig.json */ - function matchFiles(path: string, extensions: ReadonlyArray | undefined, excludes: ReadonlyArray | undefined, includes: ReadonlyArray | undefined, useCaseSensitiveFileNames: boolean, currentDirectory: string, depth: number | undefined, getFileSystemEntries: (path: string) => FileSystemEntries): string[]; - function ensureScriptKind(fileName: string, scriptKind: ScriptKind | undefined): ScriptKind; - function getScriptKindFromFileName(fileName: string): ScriptKind; - /** - * List of supported extensions in order of file resolution precedence. - */ - const supportedTypeScriptExtensions: ReadonlyArray; - /** Must have ".d.ts" first because if ".ts" goes first, that will be detected as the extension instead of ".d.ts". */ - const supportedTypescriptExtensionsForExtractExtension: ReadonlyArray; - const supportedJavascriptExtensions: ReadonlyArray; - function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: ReadonlyArray): ReadonlyArray; - function hasJavaScriptFileExtension(fileName: string): boolean; - function hasTypeScriptFileExtension(fileName: string): boolean; - function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions, extraFileExtensions?: ReadonlyArray): boolean; - /** - * Extension boundaries by priority. Lower numbers indicate higher priorities, and are - * aligned to the offset of the highest priority extension in the - * allSupportedExtensions array. - */ - enum ExtensionPriority { - TypeScriptFiles = 0, - DeclarationAndJavaScriptFiles = 2, - Highest = 0, - Lowest = 2 - } - function getExtensionPriority(path: string, supportedExtensions: ReadonlyArray): ExtensionPriority; - /** - * Adjusts an extension priority to be the highest priority within the same range. - */ - function adjustExtensionPriority(extensionPriority: ExtensionPriority, supportedExtensions: ReadonlyArray): ExtensionPriority; - /** - * Gets the next lowest extension priority for a given priority. - */ - function getNextLowestExtensionPriority(extensionPriority: ExtensionPriority, supportedExtensions: ReadonlyArray): ExtensionPriority; - function removeFileExtension(path: string): string; - function tryRemoveExtension(path: string, extension: string): string | undefined; - function removeExtension(path: string, extension: string): string; - function changeExtension(path: T, newExtension: string): T; - function changeAnyExtension(path: string, ext: string): string; - function changeAnyExtension(path: string, ext: string, extensions: string | ReadonlyArray, ignoreCase: boolean): string; - namespace Debug { - function showSymbol(symbol: Symbol): string; - function showSyntaxKind(node: Node): string; - } - function tryParsePattern(pattern: string): Pattern | undefined; - function positionIsSynthesized(pos: number): boolean; - /** True if an extension is one of the supported TypeScript extensions. */ - function extensionIsTypeScript(ext: Extension): boolean; - function resolutionExtensionIsTypeScriptOrJson(ext: Extension): boolean; - /** - * Gets the extension from a path. - * Path must have a valid extension. - */ - function extensionFromPath(path: string): Extension; - function isAnySupportedFileExtension(path: string): boolean; - function tryGetExtensionFromPath(path: string): Extension | undefined; - /** - * Gets the file extension for a path. - */ - function getAnyExtensionFromPath(path: string): string; - /** - * Gets the file extension for a path, provided it is one of the provided extensions. - */ - function getAnyExtensionFromPath(path: string, extensions: string | ReadonlyArray, ignoreCase: boolean): string; - function isCheckJsEnabledForFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean | undefined; - const emptyFileSystemEntries: FileSystemEntries; - /** - * patternStrings contains both pattern strings (containing "*") and regular strings. - * Return an exact match if possible, or a pattern match, or undefined. - * (These are verified by verifyCompilerOptions to have 0 or 1 "*" characters.) - */ - function matchPatternOrExact(patternStrings: ReadonlyArray, candidate: string): string | Pattern | undefined; -} declare namespace ts { function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; - function isJSDocLikeText(text: string, start: number): boolean; /** * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -7427,60 +3540,9 @@ declare namespace ts { function parseJsonText(fileName: string, sourceText: string): JsonSourceFile; function isExternalModule(file: SourceFile): boolean; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; - function parseIsolatedJSDocComment(content: string, start?: number, length?: number): { - jsDoc: JSDoc; - diagnostics: Diagnostic[]; - } | undefined; - function parseJSDocTypeExpressionForTests(content: string, start?: number, length?: number): { - jsDocTypeExpression: JSDocTypeExpression; - diagnostics: Diagnostic[]; - } | undefined; - interface PragmaContext { - languageVersion: ScriptTarget; - pragmas?: PragmaMap; - checkJsDirective?: CheckJsDirective; - referencedFiles: FileReference[]; - typeReferenceDirectives: FileReference[]; - libReferenceDirectives: FileReference[]; - amdDependencies: AmdDependency[]; - hasNoDefaultLib?: boolean; - moduleName?: string; - } - function processCommentPragmas(context: PragmaContext, sourceText: string): void; - type PragmaDiagnosticReporter = (pos: number, length: number, message: DiagnosticMessage) => void; - function processPragmasIntoFields(context: PragmaContext, reportDiagnostic: PragmaDiagnosticReporter): void; - /** @internal */ - function tagNamesAreEquivalent(lhs: JsxTagNameExpression, rhs: JsxTagNameExpression): boolean; } declare namespace ts { - const compileOnSaveCommandLineOption: CommandLineOption; - /** - * An array of supported "lib" reference file names used to determine the order for inclusion - * when referenced, as well as for spelling suggestions. This ensures the correct ordering for - * overload resolution when a type declared in one lib is extended by another. - */ - const libs: string[]; - /** - * A map of lib names to lib files. This map is used both for parsing the "lib" command line - * option as well as for resolving lib reference directives. - */ - const libMap: Map; - const optionDeclarations: CommandLineOption[]; - const typeAcquisitionDeclarations: CommandLineOption[]; - interface OptionNameMap { - optionNameMap: Map; - shortOptionNames: Map; - } - const defaultInitCompilerOptions: CompilerOptions; - function convertEnableAutoDiscoveryToEnable(typeAcquisition: TypeAcquisition): TypeAcquisition; - function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType): Diagnostic; - function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Push): string | number | undefined; - function parseListTypeOption(opt: CommandLineOptionOfListType, value: string | undefined, errors: Push): (string | number)[] | undefined; function parseCommandLine(commandLine: ReadonlyArray, readFile?: (path: string) => string | undefined): ParsedCommandLine; - /** @internal */ - function getOptionFromName(optionName: string, allowShort?: boolean): CommandLineOption | undefined; - function printVersion(): void; - function printHelp(optionsList: CommandLineOption[], syntaxPrefix?: string): void; type DiagnosticReporter = (diagnostic: Diagnostic) => void; /** * Reports config file diagnostics @@ -7523,49 +3585,10 @@ declare namespace ts { * @param fileName The path to the config file */ function readJsonConfigFile(fileName: string, readFile: (path: string) => string | undefined): TsConfigSourceFile; - interface JsonConversionNotifier { - /** - * Notifies parent option object is being set with the optionKey and a valid optionValue - * Currently it notifies only if there is element with type object (parentOption) and - * has element's option declarations map associated with it - * @param parentOption parent option name in which the option and value are being set - * @param option option declaration which is being set with the value - * @param value value of the option - */ - onSetValidOptionKeyValueInParent(parentOption: string, option: CommandLineOption, value: CompilerOptionsValue): void; - /** - * Notify when valid root key value option is being set - * @param key option key - * @param keyNode node corresponding to node in the source file - * @param value computed value of the key - * @param ValueNode node corresponding to value in the source file - */ - onSetValidOptionKeyValueInRoot(key: string, keyNode: PropertyName, value: CompilerOptionsValue, valueNode: Expression): void; - /** - * Notify when unknown root key value option is being set - * @param key option key - * @param keyNode node corresponding to node in the source file - * @param value computed value of the key - * @param ValueNode node corresponding to value in the source file - */ - onSetUnknownOptionKeyValueInRoot(key: string, keyNode: PropertyName, value: CompilerOptionsValue, valueNode: Expression): void; - } /** * Convert the json syntax tree into the json value */ function convertToObject(sourceFile: JsonSourceFile, errors: Push): any; - /** - * Convert the json syntax tree into the json value and report errors - * This returns the json value (apart from checking errors) only if returnValue provided is true. - * Otherwise it just checks the errors and returns undefined - */ - function convertToObjectWorker(sourceFile: JsonSourceFile, errors: Push, returnValue: boolean, knownRootOptions: CommandLineOption | undefined, jsonConversionNotifier: JsonConversionNotifier | undefined): any; - /** - * Generate tsconfig configuration when running command line "--init" - * @param options commandlineOptions to be generated into tsconfig.json - * @param fileNames array of filenames to be generated into tsconfig.json - */ - function generateTSConfig(options: CompilerOptions, fileNames: ReadonlyArray, newLine: string): string; /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse @@ -7582,9 +3605,6 @@ declare namespace ts { * file to. e.g. outDir */ function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; - function setConfigFileInOptions(options: CompilerOptions, configFile: TsConfigSourceFile | undefined): void; - function isErrorNoInputFiles(error: Diagnostic): boolean; - function getErrorForNoInputFiles({ includeSpecs, excludeSpecs }: ConfigFileSpecs, configFileName: string | undefined): Diagnostic; function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; errors: Diagnostic[]; @@ -7593,32 +3613,8 @@ declare namespace ts { options: TypeAcquisition; errors: Diagnostic[]; }; - /** - * Gets the file names from the provided config file specs that contain, files, include, exclude and - * other properties needed to resolve the file names - * @param spec The config file specs extracted with file names to include, wildcards to include/exclude and other details - * @param basePath The base path for any relative file specifications. - * @param options Compiler options. - * @param host The host used to resolve files and directories. - * @param extraFileExtensions optionaly file extra file extension information from host - */ - function getFileNamesFromConfigSpecs(spec: ConfigFileSpecs, basePath: string, options: CompilerOptions, host: ParseConfigHost, extraFileExtensions?: ReadonlyArray): ExpandResult; - /** - * Produces a cleaned version of compiler options with personally identifiying info (aka, paths) removed. - * Also converts enum values back to strings. - */ - function convertCompilerOptionsForTelemetry(opts: CompilerOptions): CompilerOptions; } declare namespace ts { - function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void; - function isTraceEnabled(compilerOptions: CompilerOptions, host: ModuleResolutionHost): boolean; - /** Array that is only intended to be pushed to, never read. */ - interface Push { - push(value: T): void; - } - function readJson(path: string, host: { - readFile(fileName: string): string | undefined; - }): object; function getEffectiveTypeRoots(options: CompilerOptions, host: GetEffectiveTypeRootsHost): string[] | undefined; /** * @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown. @@ -7654,78 +3650,13 @@ declare namespace ts { set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void; } function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache; - function createModuleResolutionCacheWithMaps(directoryToModuleNameMap: Map>, moduleNameToDirectoryMap: Map, currentDirectory: string, getCanonicalFileName: GetCanonicalFileName): ModuleResolutionCache; function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations | undefined; function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; - /** - * Expose resolution logic to allow us to use Node module resolution logic from arbitrary locations. - * No way to do this with `require()`: https://github.com/nodejs/node/issues/5963 - * Throws an error if the module can't be resolved. - */ - function resolveJavaScriptModule(moduleName: string, initialDir: string, host: ModuleResolutionHost): string; - function directoryProbablyExists(directoryName: string, host: { - directoryExists?: (directoryName: string) => boolean; - }): boolean; - function getPackageName(moduleName: string): { - packageName: string; - rest: string; - }; - function getTypesPackageName(packageName: string): string; - function getMangledNameForScopedPackage(packageName: string): string; - function getPackageNameFromAtTypesDirectory(mangledName: string): string; - function getUnmangledNameForScopedPackage(typesPackageName: string): string; function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations; - /** - * LSHost may load a module from a global cache of typings. - * This is the minumum code needed to expose that functionality; the rest is in LSHost. - */ - function loadModuleFromGlobalCache(moduleName: string, projectName: string | undefined, compilerOptions: CompilerOptions, host: ModuleResolutionHost, globalCache: string): ResolvedModuleWithFailedLookupLocations; -} -declare namespace ts { - enum ModuleInstanceState { - NonInstantiated = 0, - Instantiated = 1, - ConstEnumOnly = 2 - } - function getModuleInstanceState(node: ModuleDeclaration): ModuleInstanceState; - function bindSourceFile(file: SourceFile, options: CompilerOptions): void; - function isExportsOrModuleExportsOrAlias(sourceFile: SourceFile, node: Expression): boolean; - /** - * Computes the transform flags for a node, given the transform flags of its subtree - * - * @param node The node to analyze - * @param subtreeFlags Transform flags computed for this node's subtree - */ - function computeTransformFlagsForNode(node: Node, subtreeFlags: TransformFlags): TransformFlags; - /** - * Gets the transform flags to exclude when unioning the transform flags of a subtree. - * - * NOTE: This needs to be kept up-to-date with the exclusions used in `computeTransformFlagsForNode`. - * For performance reasons, `computeTransformFlagsForNode` uses local constant values rather - * than calling this function. - */ - function getTransformFlagsSubtreeExclusions(kind: SyntaxKind): TransformFlags; -} -/** @internal */ -declare namespace ts { - function createGetSymbolWalker(getRestTypeOfSignature: (sig: Signature) => Type, getTypePredicateOfSignature: (sig: Signature) => TypePredicate | undefined, getReturnTypeOfSignature: (sig: Signature) => Type, getBaseTypes: (type: Type) => Type[], resolveStructuredTypeMembers: (type: ObjectType) => ResolvedType, getTypeOfSymbol: (sym: Symbol) => Type, getResolvedSymbol: (node: Node) => Symbol, getIndexTypeOfStructuredType: (type: Type, kind: IndexKind) => Type | undefined, getConstraintFromTypeParameter: (typeParameter: TypeParameter) => Type | undefined, getFirstIdentifier: (node: EntityNameOrEntityNameExpression) => Identifier): (accept?: (symbol: Symbol) => boolean) => SymbolWalker; -} -declare namespace ts { - function getNodeId(node: Node): number; - function getSymbolId(symbol: Symbol): number; - function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean; - function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; } declare namespace ts { - function updateNode(updated: T, original: T): T; - function createNodeArray(elements?: T[], hasTrailingComma?: boolean): MutableNodeArray; function createNodeArray(elements?: ReadonlyArray, hasTrailingComma?: boolean): NodeArray; - /** - * Creates a shallow, memberwise clone of a node with no source map location. - */ - function getSynthesizedClone(node: T): T; - function createLiteral(value: string | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier, isSingleQuote: boolean): StringLiteral; /** If a node is passed, creates a string literal whose source text is read from a source node during emit. */ function createLiteral(value: string | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier): StringLiteral; function createLiteral(value: number): NumericLiteral; @@ -7735,24 +3666,19 @@ declare namespace ts { function createStringLiteral(text: string): StringLiteral; function createRegularExpressionLiteral(text: string): RegularExpressionLiteral; function createIdentifier(text: string): Identifier; - function createIdentifier(text: string, typeArguments: ReadonlyArray | undefined): Identifier; function updateIdentifier(node: Identifier): Identifier; - function updateIdentifier(node: Identifier, typeArguments: NodeArray | undefined): Identifier; /** Create a unique temporary variable. */ function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined): Identifier; - function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, reservedInNestedScopes: boolean): GeneratedIdentifier; /** Create a unique temporary variable for use in a loop. */ function createLoopVariable(): Identifier; /** Create a unique name based on the supplied text. */ function createUniqueName(text: string): Identifier; - function createOptimisticUniqueName(text: string): GeneratedIdentifier; /** Create a unique name based on the supplied text. */ function createOptimisticUniqueName(text: string): Identifier; /** Create a unique name based on the supplied text. This does not consider names injected by the transformer. */ function createFileLevelUniqueName(text: string): Identifier; /** Create a unique name generated for a node. */ function getGeneratedNameForNode(node: Node | undefined): Identifier; - function getGeneratedNameForNode(node: Node | undefined, flags: GeneratedIdentifierFlags): Identifier; function createToken(token: TKind): Token; function createSuper(): SuperExpression; function createThis(): ThisExpression & Token; @@ -7791,7 +3717,6 @@ declare namespace ts { function updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; function createIndexSignature(decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode): IndexSignatureDeclaration; function updateIndexSignature(node: IndexSignatureDeclaration, decorators: ReadonlyArray | undefined, modifiers: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode): IndexSignatureDeclaration; - function createSignatureDeclaration(kind: SyntaxKind, typeParameters: ReadonlyArray | undefined, parameters: ReadonlyArray, type: TypeNode | undefined, typeArguments?: ReadonlyArray | undefined): SignatureDeclaration; function createKeywordTypeNode(kind: KeywordTypeNode["kind"]): KeywordTypeNode; function createTypePredicateNode(parameterName: Identifier | ThisTypeNode | string, type: TypeNode): TypePredicateNode; function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode): TypePredicateNode; @@ -7856,8 +3781,6 @@ declare namespace ts { function updateNew(node: NewExpression, expression: Expression, typeArguments: ReadonlyArray | undefined, argumentsArray: ReadonlyArray | undefined): NewExpression; function createTaggedTemplate(tag: Expression, template: TemplateLiteral): TaggedTemplateExpression; function createTaggedTemplate(tag: Expression, typeArguments: ReadonlyArray | undefined, template: TemplateLiteral): TaggedTemplateExpression; - /** @internal */ - function createTaggedTemplate(tag: Expression, typeArgumentsOrTemplate: ReadonlyArray | TemplateLiteral | undefined, template?: TemplateLiteral): TaggedTemplateExpression; function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression; function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, typeArguments: ReadonlyArray | undefined, template: TemplateLiteral): TaggedTemplateExpression; function createTypeAssertion(type: TypeNode, expression: Expression): TypeAssertion; @@ -7913,7 +3836,6 @@ declare namespace ts { function updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; function createSemicolonClassElement(): SemicolonClassElement; function createBlock(statements: ReadonlyArray, multiLine?: boolean): Block; - function createExpressionStatement(expression: Expression): ExpressionStatement; function updateBlock(node: Block, statements: ReadonlyArray): Block; function createVariableStatement(modifiers: ReadonlyArray | undefined, declarationList: VariableDeclarationList | ReadonlyArray): VariableStatement; function updateVariableStatement(node: VariableStatement, modifiers: ReadonlyArray | undefined, declarationList: VariableDeclarationList): VariableStatement; @@ -8039,16 +3961,6 @@ declare namespace ts { * @param original The original statement. */ function createNotEmittedStatement(original: Node): NotEmittedStatement; - /** - * Creates a synthetic element to act as a placeholder for the end of an emitted declaration in - * order to properly emit exports. - */ - function createEndOfDeclarationMarker(original: Node): EndOfDeclarationMarker; - /** - * Creates a synthetic element to act as a placeholder for the beginning of a merged declaration in - * order to properly emit exports. - */ - function createMergeDeclarationMarker(original: Node): MergeDeclarationMarker; /** * Creates a synthetic expression to act as a placeholder for a not-emitted expression in * order to preserve comments or sourcemap positions. @@ -8091,20 +4003,11 @@ declare namespace ts { * @param sourceFile A source file. */ function disposeEmitNodes(sourceFile: SourceFile): void; - /** - * Associates a node with the current transformation, initializing - * various transient transformation properties. - */ - function getOrCreateEmitNode(node: Node): EmitNode; function setTextRange(range: T, location: TextRange | undefined): T; /** * Sets flags that control emit behavior of a node. */ function setEmitFlags(node: T, emitFlags: EmitFlags): T; - /** - * Sets flags that control emit behavior of a node. - */ - function addEmitFlags(node: T, emitFlags: EmitFlags): T; /** * Gets a custom text range to use when emitting source maps. */ @@ -8125,14 +4028,6 @@ declare namespace ts { * Sets the TextRange to use for source maps for a token of a node. */ function setTokenSourceMapRange(node: T, token: SyntaxKind, range: SourceMapRange | undefined): T; - /** - * Gets a custom text range to use when emitting comments. - */ - function getStartsOnNewLine(node: Node): boolean | undefined; - /** - * Sets a custom text range to use when emitting comments. - */ - function setStartsOnNewLine(node: T, newLine: boolean): T; /** * Gets a custom text range to use when emitting comments. */ @@ -8176,262 +4071,8 @@ declare namespace ts { * Moves matching emit helpers from a source node to a target node. */ function moveEmitHelpers(source: Node, target: Node, predicate: (helper: EmitHelper) => boolean): void; - function compareEmitHelpers(x: EmitHelper, y: EmitHelper): Comparison; function setOriginalNode(node: T, original: Node | undefined): T; } -declare namespace ts { - const nullTransformationContext: TransformationContext; - type TypeOfTag = "undefined" | "number" | "boolean" | "string" | "symbol" | "object" | "function"; - function createTypeCheck(value: Expression, tag: TypeOfTag): BinaryExpression; - function createMemberAccessForPropertyName(target: Expression, memberName: PropertyName, location?: TextRange): MemberExpression; - function createFunctionCall(func: Expression, thisArg: Expression, argumentsList: ReadonlyArray, location?: TextRange): CallExpression; - function createFunctionApply(func: Expression, thisArg: Expression, argumentsExpression: Expression, location?: TextRange): CallExpression; - function createArraySlice(array: Expression, start?: number | Expression): CallExpression; - function createArrayConcat(array: Expression, values: ReadonlyArray): CallExpression; - function createMathPow(left: Expression, right: Expression, location?: TextRange): CallExpression; - function createExpressionForJsxElement(jsxFactoryEntity: EntityName | undefined, reactNamespace: string, tagName: Expression, props: Expression, children: ReadonlyArray, parentElement: JsxOpeningLikeElement, location: TextRange): LeftHandSideExpression; - function createExpressionForJsxFragment(jsxFactoryEntity: EntityName | undefined, reactNamespace: string, children: ReadonlyArray, parentElement: JsxOpeningFragment, location: TextRange): LeftHandSideExpression; - function getHelperName(name: string): Identifier; - function createValuesHelper(context: TransformationContext, expression: Expression, location?: TextRange): CallExpression; - function createReadHelper(context: TransformationContext, iteratorRecord: Expression, count: number | undefined, location?: TextRange): CallExpression; - function createSpreadHelper(context: TransformationContext, argumentList: ReadonlyArray, location?: TextRange): CallExpression; - function createForOfBindingStatement(node: ForInitializer, boundValue: Expression): Statement; - function insertLeadingStatement(dest: Statement, source: Statement): Block; - function restoreEnclosingLabel(node: Statement, outermostLabeledStatement: LabeledStatement | undefined, afterRestoreLabelCallback?: (node: LabeledStatement) => void): Statement; - interface CallBinding { - target: LeftHandSideExpression; - thisArg: Expression; - } - function createCallBinding(expression: Expression, recordTempVariable: (temp: Identifier) => void, languageVersion?: ScriptTarget, cacheIdentifiers?: boolean): CallBinding; - function inlineExpressions(expressions: ReadonlyArray): Expression; - function createExpressionFromEntityName(node: EntityName | Expression): Expression; - function createExpressionForPropertyName(memberName: PropertyName): Expression; - function createExpressionForObjectLiteralElementLike(node: ObjectLiteralExpression, property: ObjectLiteralElementLike, receiver: Expression): Expression | undefined; - /** - * Gets the internal name of a declaration. This is primarily used for declarations that can be - * referred to by name in the body of an ES5 class function body. An internal name will *never* - * be prefixed with an module or namespace export modifier like "exports." when emitted as an - * expression. An internal name will also *never* be renamed due to a collision with a block - * scoped variable. - * - * @param node The declaration. - * @param allowComments A value indicating whether comments may be emitted for the name. - * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. - */ - function getInternalName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; - /** - * Gets whether an identifier should only be referred to by its internal name. - */ - function isInternalName(node: Identifier): boolean; - /** - * Gets the local name of a declaration. This is primarily used for declarations that can be - * referred to by name in the declaration's immediate scope (classes, enums, namespaces). A - * local name will *never* be prefixed with an module or namespace export modifier like - * "exports." when emitted as an expression. - * - * @param node The declaration. - * @param allowComments A value indicating whether comments may be emitted for the name. - * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. - */ - function getLocalName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; - /** - * Gets whether an identifier should only be referred to by its local name. - */ - function isLocalName(node: Identifier): boolean; - /** - * Gets the export name of a declaration. This is primarily used for declarations that can be - * referred to by name in the declaration's immediate scope (classes, enums, namespaces). An - * export name will *always* be prefixed with an module or namespace export modifier like - * `"exports."` when emitted as an expression if the name points to an exported symbol. - * - * @param node The declaration. - * @param allowComments A value indicating whether comments may be emitted for the name. - * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. - */ - function getExportName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; - /** - * Gets whether an identifier should only be referred to by its export representation if the - * name points to an exported symbol. - */ - function isExportName(node: Identifier): boolean; - /** - * Gets the name of a declaration for use in declarations. - * - * @param node The declaration. - * @param allowComments A value indicating whether comments may be emitted for the name. - * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. - */ - function getDeclarationName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; - /** - * Gets the exported name of a declaration for use in expressions. - * - * An exported name will *always* be prefixed with an module or namespace export modifier like - * "exports." if the name points to an exported symbol. - * - * @param ns The namespace identifier. - * @param node The declaration. - * @param allowComments A value indicating whether comments may be emitted for the name. - * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. - */ - function getExternalModuleOrNamespaceExportName(ns: Identifier | undefined, node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier | PropertyAccessExpression; - /** - * Gets a namespace-qualified name for use in expressions. - * - * @param ns The namespace identifier. - * @param name The name. - * @param allowComments A value indicating whether comments may be emitted for the name. - * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. - */ - function getNamespaceMemberName(ns: Identifier, name: Identifier, allowComments?: boolean, allowSourceMaps?: boolean): PropertyAccessExpression; - function convertToFunctionBody(node: ConciseBody, multiLine?: boolean): Block; - function convertFunctionDeclarationToExpression(node: FunctionDeclaration): FunctionExpression; - /** - * Add any necessary prologue-directives into target statement-array. - * The function needs to be called during each transformation step. - * This function needs to be called whenever we transform the statement - * list of a source file, namespace, or function-like body. - * - * @param target: result statements array - * @param source: origin statements array - * @param ensureUseStrict: boolean determining whether the function need to add prologue-directives - * @param visitor: Optional callback used to visit any custom prologue directives. - */ - function addPrologue(target: Statement[], source: ReadonlyArray, ensureUseStrict?: boolean, visitor?: (node: Node) => VisitResult): number; - /** - * Add just the standard (string-expression) prologue-directives into target statement-array. - * The function needs to be called during each transformation step. - * This function needs to be called whenever we transform the statement - * list of a source file, namespace, or function-like body. - */ - function addStandardPrologue(target: Statement[], source: ReadonlyArray, ensureUseStrict?: boolean): number; - /** - * Add just the custom prologue-directives into target statement-array. - * The function needs to be called during each transformation step. - * This function needs to be called whenever we transform the statement - * list of a source file, namespace, or function-like body. - */ - function addCustomPrologue(target: Statement[], source: ReadonlyArray, statementOffset: number, visitor?: (node: Node) => VisitResult): number; - function addCustomPrologue(target: Statement[], source: ReadonlyArray, statementOffset: number | undefined, visitor?: (node: Node) => VisitResult): number | undefined; - function startsWithUseStrict(statements: ReadonlyArray): boolean; - /** - * Ensures "use strict" directive is added - * - * @param statements An array of statements - */ - function ensureUseStrict(statements: NodeArray): NodeArray; - /** - * Wraps the operand to a BinaryExpression in parentheses if they are needed to preserve the intended - * order of operations. - * - * @param binaryOperator The operator for the BinaryExpression. - * @param operand The operand for the BinaryExpression. - * @param isLeftSideOfBinary A value indicating whether the operand is the left side of the - * BinaryExpression. - */ - function parenthesizeBinaryOperand(binaryOperator: SyntaxKind, operand: Expression, isLeftSideOfBinary: boolean, leftOperand?: Expression): Expression; - function parenthesizeForConditionalHead(condition: Expression): Expression; - function parenthesizeSubexpressionOfConditionalExpression(e: Expression): Expression; - /** - * [Per the spec](https://tc39.github.io/ecma262/#prod-ExportDeclaration), `export default` accepts _AssigmentExpression_ but - * has a lookahead restriction for `function`, `async function`, and `class`. - * - * Basically, that means we need to parenthesize in the following cases: - * - * - BinaryExpression of CommaToken - * - CommaList (synthetic list of multiple comma expressions) - * - FunctionExpression - * - ClassExpression - */ - function parenthesizeDefaultExpression(e: Expression): Expression; - /** - * Wraps an expression in parentheses if it is needed in order to use the expression - * as the expression of a NewExpression node. - * - * @param expression The Expression node. - */ - function parenthesizeForNew(expression: Expression): LeftHandSideExpression; - /** - * Wraps an expression in parentheses if it is needed in order to use the expression for - * property or element access. - * - * @param expr The expression node. - */ - function parenthesizeForAccess(expression: Expression): LeftHandSideExpression; - function parenthesizePostfixOperand(operand: Expression): LeftHandSideExpression; - function parenthesizePrefixOperand(operand: Expression): UnaryExpression; - function parenthesizeListElements(elements: NodeArray): NodeArray; - function parenthesizeExpressionForList(expression: Expression): Expression; - function parenthesizeExpressionForExpressionStatement(expression: Expression): Expression; - function parenthesizeConditionalTypeMember(member: TypeNode): TypeNode; - function parenthesizeElementTypeMember(member: TypeNode): TypeNode; - function parenthesizeArrayTypeMember(member: TypeNode): TypeNode; - function parenthesizeElementTypeMembers(members: ReadonlyArray): NodeArray; - function parenthesizeTypeParameters(typeParameters: ReadonlyArray | undefined): MutableNodeArray | undefined; - function parenthesizeConciseBody(body: ConciseBody): ConciseBody; - enum OuterExpressionKinds { - Parentheses = 1, - Assertions = 2, - PartiallyEmittedExpressions = 4, - All = 7 - } - type OuterExpression = ParenthesizedExpression | TypeAssertion | AsExpression | NonNullExpression | PartiallyEmittedExpression; - function isOuterExpression(node: Node, kinds?: OuterExpressionKinds): node is OuterExpression; - function skipOuterExpressions(node: Expression, kinds?: OuterExpressionKinds): Expression; - function skipOuterExpressions(node: Node, kinds?: OuterExpressionKinds): Node; - function skipAssertions(node: Expression): Expression; - function skipAssertions(node: Node): Node; - function recreateOuterExpressions(outerExpression: Expression | undefined, innerExpression: Expression, kinds?: OuterExpressionKinds): Expression; - function startOnNewLine(node: T): T; - function getExternalHelpersModuleName(node: SourceFile): Identifier | undefined; - function getOrCreateExternalHelpersModuleNameIfNeeded(node: SourceFile, compilerOptions: CompilerOptions, hasExportStarsToExportValues?: boolean, hasImportStarOrImportDefault?: boolean): Identifier | undefined; - /** - * Get the name of that target module from an import or export declaration - */ - function getLocalNameForExternalImport(node: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile): Identifier | undefined; - /** - * Get the name of a target module from an import/export declaration as should be written in the emitted output. - * The emitted output name can be different from the input if: - * 1. The module has a /// - * 2. --out or --outFile is used, making the name relative to the rootDir - * 3- The containing SourceFile has an entry in renamedDependencies for the import as requested by some module loaders (e.g. System). - * Otherwise, a new StringLiteral node representing the module name will be returned. - */ - function getExternalModuleNameLiteral(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile, host: EmitHost, resolver: EmitResolver, compilerOptions: CompilerOptions): StringLiteral | undefined; - /** - * Get the name of a module as should be written in the emitted output. - * The emitted output name can be different from the input if: - * 1. The module has a /// - * 2. --out or --outFile is used, making the name relative to the rootDir - * Otherwise, a new StringLiteral node representing the module name will be returned. - */ - function tryGetModuleNameFromFile(file: SourceFile | undefined, host: EmitHost, options: CompilerOptions): StringLiteral | undefined; - /** - * Gets the initializer of an BindingOrAssignmentElement. - */ - function getInitializerOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): Expression | undefined; - /** - * Gets the name of an BindingOrAssignmentElement. - */ - function getTargetOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): BindingOrAssignmentElementTarget | undefined; - /** - * Determines whether an BindingOrAssignmentElement is a rest element. - */ - function getRestIndicatorOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): BindingOrAssignmentElementRestIndicator | undefined; - /** - * Gets the property name of a BindingOrAssignmentElement - */ - function getPropertyNameOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | undefined; - /** - * Gets the elements of a BindingOrAssignmentPattern - */ - function getElementsOfBindingOrAssignmentPattern(name: BindingOrAssignmentPattern): ReadonlyArray; - function convertToArrayAssignmentElement(element: BindingOrAssignmentElement): Expression; - function convertToObjectAssignmentElement(element: BindingOrAssignmentElement): ObjectLiteralElementLike; - function convertToAssignmentPattern(node: BindingOrAssignmentPattern): AssignmentPattern; - function convertToObjectAssignmentPattern(node: ObjectBindingOrAssignmentPattern): ObjectLiteralExpression; - function convertToArrayAssignmentPattern(node: ArrayBindingOrAssignmentPattern): ArrayLiteralExpression; - function convertToAssignmentElementTarget(node: BindingOrAssignmentElementTarget): Expression; -} declare namespace ts { /** * Visits a Node using the supplied visitor, possibly returning a new Node in its place. @@ -8514,450 +4155,34 @@ declare namespace ts { function visitEachChild(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined; } declare namespace ts { + function createPrinter(printerOptions?: PrinterOptions, handlers?: PrintHandlers): Printer; +} +declare namespace ts { + function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string | undefined; + function resolveTripleslashReference(moduleName: string, containingFile: string): string; + function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; + function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; + interface FormatDiagnosticsHost { + getCurrentDirectory(): string; + getCanonicalFileName(fileName: string): string; + getNewLine(): string; + } + function formatDiagnostics(diagnostics: ReadonlyArray, host: FormatDiagnosticsHost): string; + function formatDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost): string; + function formatDiagnosticsWithColorAndContext(diagnostics: ReadonlyArray, host: FormatDiagnosticsHost): string; + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain | undefined, newLine: string): string; + function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): ReadonlyArray; /** - * Similar to `reduceLeft`, performs a reduction against each child of a node. - * NOTE: Unlike `forEachChild`, this does *not* visit every node. + * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' + * that represent a compilation unit. * - * @param node The node containing the children to reduce. - * @param initial The initial value to supply to the reduction. - * @param f The callback function - */ - function reduceEachChild(node: Node | undefined, initial: T, cbNode: (memo: T, node: Node) => T, cbNodeArray?: (memo: T, nodes: NodeArray) => T): T; - /** - * Merges generated lexical declarations into a new statement list. - */ - function mergeLexicalEnvironment(statements: NodeArray, declarations: ReadonlyArray | undefined): NodeArray; - /** - * Appends generated lexical declarations to an array of statements. - */ - function mergeLexicalEnvironment(statements: Statement[], declarations: ReadonlyArray | undefined): Statement[]; - /** - * Lifts a NodeArray containing only Statement nodes to a block. + * Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and + * triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in. * - * @param nodes The NodeArray. + * @param createProgramOptions - The options for creating a program. + * @returns A 'Program' object. */ - function liftToBlock(nodes: ReadonlyArray): Statement; - /** - * Aggregates the TransformFlags for a Node and its subtree. - */ - function aggregateTransformFlags(node: T): T; - namespace Debug { - function failBadSyntaxKind(node: Node, message?: string): never; - const assertEachNode: (nodes: Node[], test: (node: Node) => boolean, message?: string | undefined) => void; - const assertNode: (node: Node | undefined, test: ((node: Node | undefined) => boolean) | undefined, message?: string | undefined) => void; - const assertOptionalNode: (node: Node, test: (node: Node) => boolean, message?: string | undefined) => void; - const assertOptionalToken: (node: Node, kind: SyntaxKind, message?: string | undefined) => void; - const assertMissingNode: typeof noop; - /** - * Injects debug information into frequently used types. - */ - function enableDebugInfo(): void; - } -} -declare namespace ts { - interface SourceFileLikeCache { - get(path: Path): SourceFileLike | undefined; - } - function createSourceFileLikeCache(host: { - readFile?: (path: string) => string | undefined; - fileExists?: (path: string) => boolean; - }): SourceFileLikeCache; -} -declare namespace ts.sourcemaps { - interface SourceMapData { - version?: number; - file?: string; - sourceRoot?: string; - sources: string[]; - sourcesContent?: (string | null)[]; - names?: string[]; - mappings: string; - } - interface SourceMappableLocation { - fileName: string; - position: number; - } - interface SourceMapper { - getOriginalPosition(input: SourceMappableLocation): SourceMappableLocation; - getGeneratedPosition(input: SourceMappableLocation): SourceMappableLocation; - } - const identitySourceMapper: { - getOriginalPosition: typeof identity; - getGeneratedPosition: typeof identity; - }; - interface SourceMapDecodeHost { - readFile(path: string): string | undefined; - fileExists(path: string): boolean; - getCanonicalFileName(path: string): string; - log(text: string): void; - } - function decode(host: SourceMapDecodeHost, mapPath: string, map: SourceMapData, program?: Program, fallbackCache?: SourceFileLikeCache): SourceMapper; - interface MappingsDecoder extends Iterator { - readonly decodingIndex: number; - readonly error: string | undefined; - readonly lastSpan: SourceMapSpan; - } - function decodeMappings(map: SourceMapData): MappingsDecoder; - function calculateDecodedMappings(map: SourceMapData, processPosition: (position: RawSourceMapPosition) => T, host?: { - log?(s: string): void; - }): T[]; - interface RawSourceMapPosition { - emittedLine: number; - emittedColumn: number; - sourceLine: number; - sourceColumn: number; - sourceIndex: number; - nameIndex?: number; - } -} -declare namespace ts { - function getOriginalNodeId(node: Node): number; - interface ExternalModuleInfo { - externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; - externalHelpersImportDeclaration: ImportDeclaration | undefined; - exportSpecifiers: Map; - exportedBindings: Identifier[][]; - exportedNames: Identifier[] | undefined; - exportEquals: ExportAssignment | undefined; - hasExportStarsToExportValues: boolean; - } - function chainBundle(transformSourceFile: (x: SourceFile) => SourceFile): (x: SourceFile | Bundle) => SourceFile | Bundle; - function getImportNeedsImportStarHelper(node: ImportDeclaration): boolean; - function getImportNeedsImportDefaultHelper(node: ImportDeclaration): boolean; - function collectExternalModuleInfo(sourceFile: SourceFile, resolver: EmitResolver, compilerOptions: CompilerOptions): ExternalModuleInfo; - /** - * Used in the module transformer to check if an expression is reasonably without sideeffect, - * and thus better to copy into multiple places rather than to cache in a temporary variable - * - this is mostly subjective beyond the requirement that the expression not be sideeffecting - */ - function isSimpleCopiableExpression(expression: Expression): boolean; - /** - * @param input Template string input strings - * @param args Names which need to be made file-level unique - */ - function helperString(input: TemplateStringsArray, ...args: string[]): (uniqueName: EmitHelperUniqueNameCallback) => string; -} -declare namespace ts { - enum FlattenLevel { - All = 0, - ObjectRest = 1 - } - /** - * Flattens a DestructuringAssignment or a VariableDeclaration to an expression. - * - * @param node The node to flatten. - * @param visitor An optional visitor used to visit initializers. - * @param context The transformation context. - * @param level Indicates the extent to which flattening should occur. - * @param needsValue An optional value indicating whether the value from the right-hand-side of - * the destructuring assignment is needed as part of a larger expression. - * @param createAssignmentCallback An optional callback used to create the assignment expression. - */ - function flattenDestructuringAssignment(node: VariableDeclaration | DestructuringAssignment, visitor: ((node: Node) => VisitResult) | undefined, context: TransformationContext, level: FlattenLevel, needsValue?: boolean, createAssignmentCallback?: (name: Identifier, value: Expression, location?: TextRange) => Expression): Expression; - /** - * Flattens a VariableDeclaration or ParameterDeclaration to one or more variable declarations. - * - * @param node The node to flatten. - * @param visitor An optional visitor used to visit initializers. - * @param context The transformation context. - * @param boundValue The value bound to the declaration. - * @param skipInitializer A value indicating whether to ignore the initializer of `node`. - * @param hoistTempVariables Indicates whether temporary variables should not be recorded in-line. - * @param level Indicates the extent to which flattening should occur. - */ - function flattenDestructuringBinding(node: VariableDeclaration | ParameterDeclaration, visitor: (node: Node) => VisitResult, context: TransformationContext, level: FlattenLevel, rval?: Expression, hoistTempVariables?: boolean, skipInitializer?: boolean): VariableDeclaration[]; -} -declare namespace ts { - function transformTypeScript(context: TransformationContext): (node: SourceFile | Bundle) => SourceFile | Bundle; -} -declare namespace ts { - function transformES2017(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle; - const asyncSuperHelper: EmitHelper; - const advancedAsyncSuperHelper: EmitHelper; -} -declare namespace ts { - function transformESNext(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle; - function createAssignHelper(context: TransformationContext, attributesSegments: Expression[]): CallExpression; -} -declare namespace ts { - function transformJsx(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle; -} -declare namespace ts { - function transformES2016(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle; -} -declare namespace ts { - function transformES2015(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle; -} -declare namespace ts { - /** - * Transforms ES5 syntax into ES3 syntax. - * - * @param context Context and state information for the transformation. - */ - function transformES5(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle; -} -declare namespace ts { - function transformGenerators(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle; -} -declare namespace ts { - function transformModule(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle; -} -declare namespace ts { - function transformSystemModule(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle; -} -declare namespace ts { - function transformES2015Module(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle; -} -declare namespace ts { - type GetSymbolAccessibilityDiagnostic = (symbolAccessibilityResult: SymbolAccessibilityResult) => (SymbolAccessibilityDiagnostic | undefined); - interface SymbolAccessibilityDiagnostic { - errorNode: Node; - diagnosticMessage: DiagnosticMessage; - typeName?: DeclarationName | QualifiedName; - } - type DeclarationDiagnosticProducing = VariableDeclaration | PropertyDeclaration | PropertySignature | BindingElement | SetAccessorDeclaration | GetAccessorDeclaration | ConstructSignatureDeclaration | CallSignatureDeclaration | MethodDeclaration | MethodSignature | FunctionDeclaration | ParameterDeclaration | TypeParameterDeclaration | ExpressionWithTypeArguments | ImportEqualsDeclaration | TypeAliasDeclaration | ConstructorDeclaration | IndexSignatureDeclaration; - function canProduceDiagnostics(node: Node): node is DeclarationDiagnosticProducing; - function createGetSymbolAccessibilityDiagnosticForNodeName(node: DeclarationDiagnosticProducing): (symbolAccessibilityResult: SymbolAccessibilityResult) => SymbolAccessibilityDiagnostic | undefined; - function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationDiagnosticProducing): (symbolAccessibilityResult: SymbolAccessibilityResult) => SymbolAccessibilityDiagnostic | undefined; -} -declare namespace ts { - function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, file: SourceFile | undefined): DiagnosticWithLocation[] | undefined; - /** - * Transforms a ts file into a .d.ts file - * This process requires type information, which is retrieved through the emit resolver. Because of this, - * in many places this transformer assumes it will be operating on parse tree nodes directly. - * This means that _no transforms should be allowed to occur before this one_. - */ - function transformDeclarations(context: TransformationContext): { - (node: Bundle): Bundle; - (node: SourceFile): SourceFile; - (node: SourceFile | Bundle): SourceFile | Bundle; - }; -} -declare namespace ts { - function getTransformers(compilerOptions: CompilerOptions, customTransformers?: CustomTransformers): TransformerFactory[]; - /** - * Transforms an array of SourceFiles by passing them through each transformer. - * - * @param resolver The emit resolver provided by the checker. - * @param host The emit host object used to interact with the file system. - * @param options Compiler options to surface in the `TransformationContext`. - * @param nodes An array of nodes to transform. - * @param transforms An array of `TransformerFactory` callbacks. - * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. - */ - function transformNodes(resolver: EmitResolver | undefined, host: EmitHost | undefined, options: CompilerOptions, nodes: ReadonlyArray, transformers: ReadonlyArray>, allowDtsFiles: boolean): TransformationResult; -} -declare namespace ts { - interface SourceMapWriter { - /** - * Initialize the SourceMapWriter for a new output file. - * - * @param filePath The path to the generated output file. - * @param sourceMapFilePath The path to the output source map file. - * @param sourceFileOrBundle The input source file or bundle for the program. - */ - initialize(filePath: string, sourceMapFilePath: string | undefined, sourceFileOrBundle: SourceFile | Bundle, sourceMapOutput?: SourceMapData[]): void; - /** - * Reset the SourceMapWriter to an empty state. - */ - reset(): void; - /** - * Set the current source file. - * - * @param sourceFile The source file. - */ - setSourceFile(sourceFile: SourceMapSource): void; - /** - * Emits a mapping. - * - * If the position is synthetic (undefined or a negative value), no mapping will be - * created. - * - * @param pos The position. - */ - emitPos(pos: number): void; - /** - * Emits a node with possible leading and trailing source maps. - * - * @param hint The current emit context - * @param node The node to emit. - * @param emitCallback The callback used to emit the node. - */ - emitNodeWithSourceMap(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; - /** - * Emits a token of a node node with possible leading and trailing source maps. - * - * @param node The node containing the token. - * @param token The token to emit. - * @param tokenStartPos The start pos of the token. - * @param emitCallback The callback used to emit the token. - */ - emitTokenWithSourceMap(node: Node, token: SyntaxKind, writer: (s: string) => void, tokenStartPos: number, emitCallback: (token: SyntaxKind, writer: (s: string) => void, tokenStartPos: number) => number): number; - /** - * Gets the text for the source map. - */ - getText(): string; - /** - * Gets the SourceMappingURL for the source map. - */ - getSourceMappingURL(): string; - } - interface SourceMapOptions { - sourceMap?: boolean; - inlineSourceMap?: boolean; - inlineSources?: boolean; - sourceRoot?: string; - mapRoot?: string; - extendedDiagnostics?: boolean; - } - function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter, compilerOptions?: SourceMapOptions): SourceMapWriter; -} -declare namespace ts { - interface CommentWriter { - reset(): void; - setSourceFile(sourceFile: SourceFile): void; - setWriter(writer: EmitTextWriter | undefined): void; - emitNodeWithComments(hint: EmitHint, node: Node | undefined, emitCallback: (hint: EmitHint, node: Node) => void): void; - emitBodyWithDetachedComments(node: Node, detachedRange: TextRange, emitCallback: (node: Node) => void): void; - emitTrailingCommentsOfPosition(pos: number, prefixSpace?: boolean): void; - emitLeadingCommentsOfPosition(pos: number): void; - } - function createCommentWriter(printerOptions: PrinterOptions, emitPos: ((pos: number) => void) | undefined): CommentWriter; -} -declare namespace ts { - /** - * Iterates over the source files that are expected to have an emit output. - * - * @param host An EmitHost. - * @param action The action to execute. - * @param sourceFilesOrTargetSourceFile - * If an array, the full list of source files to emit. - * Else, calls `getSourceFilesToEmit` with the (optional) target source file to determine the list of source files to emit. - */ - function forEachEmittedFile(host: EmitHost, action: (emitFileNames: EmitFileNames, sourceFileOrBundle: SourceFile | Bundle) => T, sourceFilesOrTargetSourceFile?: ReadonlyArray | SourceFile, emitOnlyDtsFiles?: boolean): T | undefined; - function getOutputPathsFor(sourceFile: SourceFile | Bundle, host: EmitHost, forceDtsPaths: boolean): EmitFileNames; - function getOutputExtension(sourceFile: SourceFile, options: CompilerOptions): Extension; - function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile, emitOnlyDtsFiles?: boolean, transformers?: TransformerFactory[], declarationTransformers?: TransformerFactory[]): EmitResult; - function createPrinter(printerOptions?: PrinterOptions, handlers?: PrintHandlers): Printer; -} -declare namespace ts { - /** - * Partial interface of the System thats needed to support the caching of directory structure - */ - interface DirectoryStructureHost { - fileExists(path: string): boolean; - readFile(path: string, encoding?: string): string | undefined; - directoryExists?(path: string): boolean; - getDirectories?(path: string): string[]; - readDirectory?(path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray, depth?: number): string[]; - createDirectory?(path: string): void; - writeFile?(path: string, data: string, writeByteOrderMark?: boolean): void; - } - interface FileAndDirectoryExistence { - fileExists: boolean; - directoryExists: boolean; - } - interface CachedDirectoryStructureHost extends DirectoryStructureHost { - useCaseSensitiveFileNames: boolean; - getDirectories(path: string): string[]; - readDirectory(path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray, depth?: number): string[]; - /** Returns the queried result for the file exists and directory exists if at all it was done */ - addOrDeleteFileOrDirectory(fileOrDirectory: string, fileOrDirectoryPath: Path): FileAndDirectoryExistence | undefined; - addOrDeleteFile(fileName: string, filePath: Path, eventKind: FileWatcherEventKind): void; - clearCache(): void; - } - function createCachedDirectoryStructureHost(host: DirectoryStructureHost, currentDirectory: string, useCaseSensitiveFileNames: boolean): CachedDirectoryStructureHost | undefined; - enum ConfigFileProgramReloadLevel { - None = 0, - /** Update the file name list from the disk */ - Partial = 1, - /** Reload completely by re-reading contents of config file from disk and updating program */ - Full = 2 - } - /** - * Updates the existing missing file watches with the new set of missing files after new program is created - */ - function updateMissingFilePathsWatch(program: Program, missingFileWatches: Map, createMissingFileWatch: (missingFilePath: Path) => FileWatcher): void; - interface WildcardDirectoryWatcher { - watcher: FileWatcher; - flags: WatchDirectoryFlags; - } - /** - * Updates the existing wild card directory watches with the new set of wild card directories from the config file - * after new program is created because the config file was reloaded or program was created first time from the config file - * Note that there is no need to call this function when the program is updated with additional files without reloading config files, - * as wildcard directories wont change unless reloading config file - */ - function updateWatchingWildcardDirectories(existingWatchedForWildcards: Map, wildcardDirectories: Map, watchDirectory: (directory: string, flags: WatchDirectoryFlags) => FileWatcher): void; - function isEmittedFileOfProgram(program: Program | undefined, file: string): boolean; - enum WatchLogLevel { - None = 0, - TriggerOnly = 1, - Verbose = 2 - } - interface WatchFileHost { - watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher; - } - interface WatchDirectoryHost { - watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; - } - type WatchFile = (host: WatchFileHost, file: string, callback: FileWatcherCallback, pollingInterval: PollingInterval, detailInfo1?: X, detailInfo2?: Y) => FileWatcher; - type FilePathWatcherCallback = (fileName: string, eventKind: FileWatcherEventKind, filePath: Path) => void; - type WatchFilePath = (host: WatchFileHost, file: string, callback: FilePathWatcherCallback, pollingInterval: PollingInterval, path: Path, detailInfo1?: X, detailInfo2?: Y) => FileWatcher; - type WatchDirectory = (host: WatchDirectoryHost, directory: string, callback: DirectoryWatcherCallback, flags: WatchDirectoryFlags, detailInfo1?: X, detailInfo2?: Y) => FileWatcher; - interface WatchFactory { - watchFile: WatchFile; - watchFilePath: WatchFilePath; - watchDirectory: WatchDirectory; - } - function getWatchFactory(watchLogLevel: WatchLogLevel, log: (s: string) => void, getDetailWatchInfo?: GetDetailWatchInfo): WatchFactory; - type GetDetailWatchInfo = (detailInfo1: X, detailInfo2: Y | undefined) => string; - function closeFileWatcherOf(objWithWatcher: T): void; -} -declare namespace ts { - function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string | undefined; - function resolveTripleslashReference(moduleName: string, containingFile: string): string; - function computeCommonSourceDirectoryOfFilenames(fileNames: string[], currentDirectory: string, getCanonicalFileName: GetCanonicalFileName): string; - function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; - function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; - interface FormatDiagnosticsHost { - getCurrentDirectory(): string; - getCanonicalFileName(fileName: string): string; - getNewLine(): string; - } - function formatDiagnostics(diagnostics: ReadonlyArray, host: FormatDiagnosticsHost): string; - function formatDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost): string; - /** @internal */ - enum ForegroundColorEscapeSequences { - Grey = "\u001B[90m", - Red = "\u001B[91m", - Yellow = "\u001B[93m", - Blue = "\u001B[94m", - Cyan = "\u001B[96m" - } - /** @internal */ - function formatColorAndReset(text: string, formatStyle: string): string; - function formatDiagnosticsWithColorAndContext(diagnostics: ReadonlyArray, host: FormatDiagnosticsHost): string; - function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain | undefined, newLine: string): string; - /** - * Determines if program structure is upto date or needs to be recreated - */ - function isProgramUptoDate(program: Program | undefined, rootFileNames: string[], newOptions: CompilerOptions, getSourceVersion: (path: Path) => string | undefined, fileExists: (fileName: string) => boolean, hasInvalidatedResolution: HasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames: boolean): boolean; - function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): ReadonlyArray; - /** - * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' - * that represent a compilation unit. - * - * Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and - * triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in. - * - * @param createProgramOptions - The options for creating a program. - * @returns A 'Program' object. - */ - function createProgram(createProgramOptions: CreateProgramOptions): Program; + function createProgram(createProgramOptions: CreateProgramOptions): Program; /** * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' * that represent a compilation unit. @@ -8973,17 +4198,10 @@ declare namespace ts { * @returns A 'Program' object. */ function createProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: ReadonlyArray): Program; - function parseConfigHostFromCompilerHost(host: CompilerHost): ParseConfigFileHost; /** * Returns the target config filename of a project reference */ function resolveProjectReferencePath(host: CompilerHost | UpToDateHost, ref: ProjectReference): ResolvedConfigFileName; - /** - * Returns a DiagnosticMessage if we won't include a resolved module due to its extension. - * The DiagnosticMessage's parameters are the imported module name, and the filename it resolved to. - * This returns a diagnostic even if the module will be an untyped module. - */ - function getResolutionDiagnostic(options: CompilerOptions, { extension }: ResolvedModuleFull): DiagnosticMessage | undefined; } declare namespace ts { interface EmitOutput { @@ -8996,126 +4214,6 @@ declare namespace ts { text: string; } } -declare namespace ts { - function getFileEmitOutput(program: Program, sourceFile: SourceFile, emitOnlyDtsFiles: boolean, cancellationToken?: CancellationToken, customTransformers?: CustomTransformers): EmitOutput; - interface BuilderState { - /** - * Information of the file eg. its version, signature etc - */ - fileInfos: Map; - /** - * Contains the map of ReferencedSet=Referenced files of the file if module emit is enabled - * Otherwise undefined - * Thus non undefined value indicates, module emit - */ - readonly referencedMap: ReadonlyMap | undefined; - /** - * Map of files that have already called update signature. - * That means hence forth these files are assumed to have - * no change in their signature for this version of the program - */ - hasCalledUpdateShapeSignature: Map; - /** - * Cache of all files excluding default library file for the current program - */ - allFilesExcludingDefaultLibraryFile: ReadonlyArray | undefined; - /** - * Cache of all the file names - */ - allFileNames: ReadonlyArray | undefined; - } -} -declare namespace ts.BuilderState { - /** - * Information about the source file: Its version and optional signature from last emit - */ - interface FileInfo { - readonly version: string; - signature: string | undefined; - } - /** - * Referenced files with values for the keys as referenced file's path to be true - */ - type ReferencedSet = ReadonlyMap; - /** - * Compute the hash to store the shape of the file - */ - type ComputeHash = (data: string) => string; - /** - * Returns true if oldState is reusable, that is the emitKind = module/non module has not changed - */ - function canReuseOldState(newReferencedMap: ReadonlyMap | undefined, oldState: Readonly | undefined): boolean | undefined; - /** - * Creates the state of file references and signature for the new program from oldState if it is safe - */ - function create(newProgram: Program, getCanonicalFileName: GetCanonicalFileName, oldState?: Readonly): BuilderState; - /** - * Gets the files affected by the path from the program - */ - function getFilesAffectedBy(state: BuilderState, programOfThisState: Program, path: Path, cancellationToken: CancellationToken | undefined, computeHash: ComputeHash, cacheToUpdateSignature?: Map): ReadonlyArray; - /** - * Updates the signatures from the cache into state's fileinfo signatures - * This should be called whenever it is safe to commit the state of the builder - */ - function updateSignaturesFromCache(state: BuilderState, signatureCache: Map): void; - /** - * Get all the dependencies of the sourceFile - */ - function getAllDependencies(state: BuilderState, programOfThisState: Program, sourceFile: SourceFile): ReadonlyArray; -} -declare namespace ts { - /** - * State to store the changed files, affected files and cache semantic diagnostics - */ - interface BuilderProgramState extends BuilderState { - /** - * Cache of semantic diagnostics for files with their Path being the key - */ - semanticDiagnosticsPerFile: Map> | undefined; - /** - * The map has key by source file's path that has been changed - */ - changedFilesSet: Map; - /** - * Set of affected files being iterated - */ - affectedFiles: ReadonlyArray | undefined; - /** - * Current index to retrieve affected file from - */ - affectedFilesIndex: number | undefined; - /** - * Current changed file for iterating over affected files - */ - currentChangedFilePath: Path | undefined; - /** - * Map of file signatures, with key being file path, calculated while getting current changed file's affected files - * These will be commited whenever the iteration through affected files of current changed file is complete - */ - currentAffectedFilesSignatures: Map | undefined; - /** - * Already seen affected files - */ - seenAffectedFiles: Map | undefined; - /** - * program corresponding to this state - */ - program: Program; - } - enum BuilderProgramKind { - SemanticDiagnosticsBuilderProgram = 0, - EmitAndSemanticDiagnosticsBuilderProgram = 1 - } - interface BuilderCreationParameters { - newProgram: Program; - host: BuilderProgramHost; - oldProgram: BuilderProgram | undefined; - configFileParsingDiagnostics: ReadonlyArray; - } - function getBuilderCreationParameters(newProgramOrRootNames: Program | ReadonlyArray | undefined, hostOrOptions: BuilderProgramHost | CompilerOptions | undefined, oldProgramOrHost?: BuilderProgram | CompilerHost, configFileParsingDiagnosticsOrOldProgram?: ReadonlyArray | BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderCreationParameters; - function createBuilderProgram(kind: BuilderProgramKind.SemanticDiagnosticsBuilderProgram, builderCreationParameters: BuilderCreationParameters): SemanticDiagnosticsBuilderProgram; - function createBuilderProgram(kind: BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, builderCreationParameters: BuilderCreationParameters): EmitAndSemanticDiagnosticsBuilderProgram; -} declare namespace ts { type AffectedFileResult = { result: T; @@ -9140,7 +4238,6 @@ declare namespace ts { * Builder to manage the program state changes */ interface BuilderProgram { - getState(): BuilderProgramState; /** * Returns current program */ @@ -9242,99 +4339,6 @@ declare namespace ts { function createAbstractBuilder(newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderProgram; function createAbstractBuilder(rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderProgram; } -declare namespace ts { - /** This is the cache of module/typedirectives resolution that can be retained across program */ - interface ResolutionCache { - startRecordingFilesWithChangedResolutions(): void; - finishRecordingFilesWithChangedResolutions(): Path[] | undefined; - resolveModuleNames(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined): ResolvedModuleFull[]; - getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string): CachedResolvedModuleWithFailedLookupLocations | undefined; - resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; - invalidateResolutionOfFile(filePath: Path): void; - removeResolutionsOfFile(filePath: Path): void; - setFilesWithInvalidatedNonRelativeUnresolvedImports(filesWithUnresolvedImports: Map>): void; - createHasInvalidatedResolution(forceAllFilesAsInvalidated?: boolean): HasInvalidatedResolution; - startCachingPerDirectoryResolution(): void; - finishCachingPerDirectoryResolution(): void; - updateTypeRootsWatch(): void; - closeTypeRootsWatch(): void; - clear(): void; - } - interface ResolutionWithFailedLookupLocations { - readonly failedLookupLocations: ReadonlyArray; - isInvalidated?: boolean; - refCount?: number; - } - interface CachedResolvedModuleWithFailedLookupLocations extends ResolvedModuleWithFailedLookupLocations, ResolutionWithFailedLookupLocations { - } - interface ResolutionCacheHost extends ModuleResolutionHost { - toPath(fileName: string): Path; - getCanonicalFileName: GetCanonicalFileName; - getCompilationSettings(): CompilerOptions; - watchDirectoryOfFailedLookupLocation(directory: string, cb: DirectoryWatcherCallback, flags: WatchDirectoryFlags): FileWatcher; - onInvalidatedResolution(): void; - watchTypeRootsDirectory(directory: string, cb: DirectoryWatcherCallback, flags: WatchDirectoryFlags): FileWatcher; - onChangedAutomaticTypeDirectiveNames(): void; - getCachedDirectoryStructureHost(): CachedDirectoryStructureHost | undefined; - projectName?: string; - getGlobalCache?(): string | undefined; - writeLog(s: string): void; - maxNumberOfFilesToIterateForInvalidation?: number; - getCurrentProgram(): Program; - } - const maxNumberOfFilesToIterateForInvalidation = 256; - function createResolutionCache(resolutionHost: ResolutionCacheHost, rootDirForResolution: string | undefined, logChangesWhenResolvingModule: boolean): ResolutionCache; -} -declare namespace ts.moduleSpecifiers { - interface ModuleSpecifierPreferences { - importModuleSpecifierPreference?: "relative" | "non-relative"; - } - function getModuleSpecifier(compilerOptions: CompilerOptions, fromSourceFile: SourceFile, fromSourceFileName: string, toFileName: string, host: ModuleSpecifierResolutionHost, preferences?: ModuleSpecifierPreferences): string; - function getModuleSpecifiers(moduleSymbol: Symbol, compilerOptions: CompilerOptions, importingSourceFile: SourceFile, host: ModuleSpecifierResolutionHost, files: ReadonlyArray, preferences: ModuleSpecifierPreferences): ReadonlyArray>; -} -declare namespace ts { - /** - * Create a function that reports error by writing to the system and handles the formating of the diagnostic - */ - function createDiagnosticReporter(system: System, pretty?: boolean): DiagnosticReporter; - /** @internal */ - const nonClearingMessageCodes: number[]; - /** @internal */ - const screenStartingMessageCodes: number[]; - /** - * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic - */ - function createWatchStatusReporter(system: System, pretty?: boolean): WatchStatusReporter; - /** Parses config file using System interface */ - function parseConfigFileWithSystem(configFileName: string, optionsToExtend: CompilerOptions, system: System, reportDiagnostic: DiagnosticReporter): ParsedCommandLine | undefined; - /** - * Program structure needed to emit the files and report diagnostics - */ - interface ProgramToEmitFilesAndReportErrors { - getCurrentDirectory(): string; - getCompilerOptions(): CompilerOptions; - getSourceFiles(): ReadonlyArray; - getSyntacticDiagnostics(): ReadonlyArray; - getOptionsDiagnostics(): ReadonlyArray; - getGlobalDiagnostics(): ReadonlyArray; - getSemanticDiagnostics(): ReadonlyArray; - getConfigFileParsingDiagnostics(): ReadonlyArray; - emit(): EmitResult; - } - type ReportEmitErrorSummary = (errorCount: number) => void; - /** - * Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options - */ - function emitFilesAndReportErrors(program: ProgramToEmitFilesAndReportErrors, reportDiagnostic: DiagnosticReporter, writeFileName?: (s: string) => void, reportSummary?: ReportEmitErrorSummary): ExitStatus; - /** - * Creates the watch compiler host from system for config file in watch mode - */ - function createWatchCompilerHostOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions | undefined, system: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): WatchCompilerHostOfConfigFile; - /** - * Creates the watch compiler host from system for compiling root files and options in watch mode - */ - function createWatchCompilerHostOfFilesAndCompilerOptions(rootFiles: string[], options: CompilerOptions, system: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): WatchCompilerHostOfFilesAndCompilerOptions; -} declare namespace ts { type WatchStatusReporter = (diagnostic: Diagnostic, newLine: string, options: CompilerOptions) => void; /** Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program */ @@ -9348,7 +4352,6 @@ declare namespace ts { afterProgramCreate?(program: T): void; /** If provided, called with Diagnostic message that informs about change in watch status */ onWatchStatusChange?(diagnostic: Diagnostic, newLine: string, options: CompilerOptions): void; - maxNumberOfFilesToIterateForInvalidation?: number; useCaseSensitiveFileNames(): boolean; getNewLine(): string; getCurrentDirectory(): string; @@ -9390,12 +4393,6 @@ declare namespace ts { /** If provided, will be used to reset existing delayed compilation */ clearTimeout?(timeoutId: any): void; } - /** Internal interface used to wire emit through same host */ - interface WatchCompilerHost { - createDirectory?(path: string): void; - writeFile?(path: string, data: string, writeByteOrderMark?: boolean): void; - onCachedDirectoryStructureHostCreate?(host: CachedDirectoryStructureHost): void; - } /** * Host to create watch with root files and options */ @@ -9416,21 +4413,12 @@ declare namespace ts { /** * Used to generate source file names from the config file and its include, exclude, files rules * and also to cache the directory stucture - */ - readDirectory(path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray, depth?: number): string[]; - } - /** - * Host to create watch with config file that is already parsed (from tsc) - */ - interface WatchCompilerHostOfConfigFile extends WatchCompilerHost { - optionsToExtend?: CompilerOptions; - configFileParsingResult?: ParsedCommandLine; + */ + readDirectory(path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray, depth?: number): string[]; } interface Watch { /** Synchronize with host and get updated program */ getProgram(): T; - /** Gets the existing program without synchronizing with changes on host */ - getCurrentProgram(): T; } /** * Creates the watch what generates program using the config file @@ -9632,31 +4620,6 @@ declare namespace ts { function getAllProjectOutputs(project: ParsedCommandLine): ReadonlyArray; function formatUpToDateStatus(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T): T | undefined; } -//# sourceMappingURL=compiler.d.ts.map -declare namespace ts.server { - const ActionSet: ActionSet; - const ActionInvalidate: ActionInvalidate; - const ActionPackageInstalled: ActionPackageInstalled; - const EventTypesRegistry: EventTypesRegistry; - const EventBeginInstallTypes: EventBeginInstallTypes; - const EventEndInstallTypes: EventEndInstallTypes; - const EventInitializationFailed: EventInitializationFailed; - namespace Arguments { - const GlobalCacheLocation = "--globalTypingsCacheLocation"; - const LogFile = "--logFile"; - const EnableTelemetry = "--enableTelemetry"; - const TypingSafeListLocation = "--typingSafeListLocation"; - const TypesMapLocation = "--typesMapLocation"; - /** - * This argument specifies the location of the NPM executable. - * typingsInstaller will run the command with `${npmLocation} install ...`. - */ - const NpmLocation = "--npmLocation"; - } - function hasArgument(argumentName: string): boolean; - function findArgument(argumentName: string): string | undefined; - function nowString(): string; -} declare namespace ts.server { type ActionSet = "action::set"; type ActionInvalidate = "action::invalidate"; @@ -9674,7 +4637,6 @@ declare namespace ts.server { interface TypingInstallerRequestWithProjectName { readonly projectName: string; } - type TypingInstallerRequestUnion = DiscoverTypings | CloseProject | TypesRegistryRequest | InstallPackageRequest; interface DiscoverTypings extends TypingInstallerRequestWithProjectName { readonly fileNames: string[]; readonly projectRootPath: Path; @@ -9696,10 +4658,6 @@ declare namespace ts.server { readonly packageName: string; readonly projectRootPath: Path; } - interface TypesRegistryResponse extends TypingInstallerResponse { - readonly kind: EventTypesRegistry; - readonly typesRegistry: MapLike>; - } interface PackageInstalledResponse extends ProjectResponse { readonly kind: ActionPackageInstalled; readonly success: boolean; @@ -9728,13 +4686,6 @@ declare namespace ts.server { readonly kind: EventEndInstallTypes; readonly installSuccess: boolean; } - interface InstallTypingHost extends JsTyping.TypingResolutionHost { - useCaseSensitiveFileNames: boolean; - writeFile(path: string, content: string): void; - createDirectory(path: string): void; - watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher; - watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; - } interface SetTypings extends ProjectResponse { readonly typeAcquisition: TypeAcquisition; readonly compilerOptions: CompilerOptions; @@ -9742,86 +4693,14 @@ declare namespace ts.server { readonly unresolvedImports: SortedReadonlyArray; readonly kind: ActionSet; } - type TypingInstallerResponseUnion = SetTypings | InvalidateCachedTypings | TypesRegistryResponse | PackageInstalledResponse | InstallTypes | InitializationFailedResponse; -} -declare namespace ts.JsTyping { - interface TypingResolutionHost { - directoryExists(path: string): boolean; - fileExists(fileName: string): boolean; - readFile(path: string, encoding?: string): string | undefined; - readDirectory(rootDir: string, extensions: ReadonlyArray, excludes: ReadonlyArray | undefined, includes: ReadonlyArray | undefined, depth?: number): string[]; - } - interface CachedTyping { - typingLocation: string; - version: Semver; - } - function isTypingUpToDate(cachedTyping: CachedTyping, availableTypingVersions: MapLike): boolean; - const nodeCoreModuleList: ReadonlyArray; - const nodeCoreModules: Map; - /** - * A map of loose file names to library names that we are confident require typings - */ - type SafeList = ReadonlyMap; - function loadSafeList(host: TypingResolutionHost, safeListPath: Path): SafeList; - function loadTypesMap(host: TypingResolutionHost, typesMapPath: Path): SafeList | undefined; - /** - * @param host is the object providing I/O related operations. - * @param fileNames are the file names that belong to the same project - * @param projectRootPath is the path to the project root directory - * @param safeListPath is the path used to retrieve the safe list - * @param packageNameToTypingLocation is the map of package names to their cached typing locations and installed versions - * @param typeAcquisition is used to customize the typing acquisition process - * @param compilerOptions are used as a source for typing inference - */ - function discoverTypings(host: TypingResolutionHost, log: ((message: string) => void) | undefined, fileNames: string[], projectRootPath: Path, safeList: SafeList, packageNameToTypingLocation: ReadonlyMap, typeAcquisition: TypeAcquisition, unresolvedImports: ReadonlyArray, typesRegistry: ReadonlyMap>): { - cachedTypingPaths: string[]; - newTypingNames: string[]; - filesToWatch: string[]; - }; - enum PackageNameValidationResult { - Ok = 0, - ScopedPackagesNotSupported = 1, - EmptyName = 2, - NameTooLong = 3, - NameStartsWithDot = 4, - NameStartsWithUnderscore = 5, - NameContainsNonURISafeCharacters = 6 - } - /** - * Validates package name using rules defined at https://docs.npmjs.com/files/package.json - */ - function validatePackageName(packageName: string): PackageNameValidationResult; - function renderPackageNameValidationFailure(result: PackageNameValidationResult, typing: string): string; -} -declare namespace ts { - class Semver { - readonly major: number; - readonly minor: number; - readonly patch: number; - /** - * If true, this is `major.minor.0-next.patch`. - * If false, this is `major.minor.patch`. - */ - readonly isPrerelease: boolean; - static parse(semver: string): Semver; - static fromRaw({ major, minor, patch, isPrerelease }: Semver): Semver; - private static tryParse; - private constructor(); - readonly versionString: string; - equals(sem: Semver): boolean; - greaterThan(sem: Semver): boolean; - } } -//# sourceMappingURL=jsTyping.d.ts.map declare namespace ts { interface Node { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; getChildAt(index: number, sourceFile?: SourceFile): Node; getChildren(sourceFile?: SourceFile): Node[]; - getChildren(sourceFile?: SourceFileLike): Node[]; getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; - getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number; getFullStart(): number; getEnd(): number; getWidth(sourceFile?: SourceFileLike): number; @@ -9878,20 +4757,14 @@ declare namespace ts { getJsDocTags(): JSDocTagInfo[]; } interface SourceFile { - version: string; - scriptSnapshot: IScriptSnapshot | undefined; - nameTable: UnderscoreEscapedMap | undefined; - getNamedDeclarations(): Map; getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineEndOfPosition(pos: number): number; getLineStarts(): ReadonlyArray; getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; - sourceMapper?: sourcemaps.SourceMapper; } interface SourceFileLike { getLineAndCharacterOfPosition(pos: number): LineAndCharacter; - sourceMapper?: sourcemaps.SourceMapper; } interface SourceMapSource { getLineAndCharacterOfPosition(pos: number): LineAndCharacter; @@ -9960,8 +4833,6 @@ declare namespace ts { resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[]): ResolvedModule[]; getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined; resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; - hasInvalidatedResolution?: HasInvalidatedResolution; - hasChangedAutomaticTypeDirectiveNames?: boolean; getDirectories?(directoryName: string): string[]; /** * Gets a set of custom transformers to use during emit. @@ -9978,7 +4849,6 @@ declare namespace ts { readonly importModuleSpecifierPreference?: "relative" | "non-relative"; readonly allowTextChangesInNewFiles?: boolean; } - const defaultPreferences: UserPreferences; interface LanguageService { cleanupSemanticCache(): void; getSyntacticDiagnostics(fileName: string): DiagnosticWithLocation[]; @@ -10050,7 +4920,6 @@ declare namespace ts { getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): ReadonlyArray; getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; getProgram(): Program | undefined; - getNonBoundSourceFile(fileName: string): SourceFile; dispose(): void; } interface JsxClosingTagInfo { @@ -10161,9 +5030,6 @@ declare namespace ts { } type CodeActionCommand = InstallPackageAction; interface InstallPackageAction { - file: string; - type: "install package"; - packageName: string; } /** * A set of one or more available refactoring actions, grouped under a parent refactoring. @@ -10675,267 +5541,8 @@ declare namespace ts { jsxAttributeStringLiteralValue = 24 } } -interface PromiseConstructor { - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - reject(reason: any): Promise; - all(values: (T | PromiseLike)[]): Promise; -} -declare var Promise: PromiseConstructor; -declare namespace ts { - const scanner: Scanner; - enum SemanticMeaning { - None = 0, - Value = 1, - Type = 2, - Namespace = 4, - All = 7 - } - function getMeaningFromDeclaration(node: Node): SemanticMeaning; - function getMeaningFromLocation(node: Node): SemanticMeaning; - function isInRightSideOfInternalImportEqualsDeclaration(node: Node): boolean; - function isCallExpressionTarget(node: Node): boolean; - function isNewExpressionTarget(node: Node): boolean; - function climbPastPropertyAccess(node: Node): Node; - function getTargetLabel(referenceNode: Node, labelName: string): Identifier | undefined; - function isJumpStatementTarget(node: Node): node is Identifier & { - parent: BreakOrContinueStatement; - }; - function isLabelOfLabeledStatement(node: Node): node is Identifier; - function isLabelName(node: Node): boolean; - function isRightSideOfQualifiedName(node: Node): boolean; - function isRightSideOfPropertyAccess(node: Node): boolean; - function isNameOfModuleDeclaration(node: Node): boolean; - function isNameOfFunctionDeclaration(node: Node): boolean; - function isLiteralNameOfPropertyDeclarationOrIndexAccess(node: StringLiteral | NumericLiteral): boolean; - function isExpressionOfExternalModuleImportEqualsDeclaration(node: Node): boolean; - function getContainerNode(node: Node): Declaration | undefined; - function getNodeKind(node: Node): ScriptElementKind; - function isThis(node: Node): boolean; - interface ListItemInfo { - listItemIndex: number; - list: Node; - } - function getLineStartPositionForPosition(position: number, sourceFile: SourceFileLike): number; - function rangeContainsRange(r1: TextRange, r2: TextRange): boolean; - function rangeContainsPosition(r: TextRange, pos: number): boolean; - function rangeContainsPositionExclusive(r: TextRange, pos: number): boolean; - function startEndContainsRange(start: number, end: number, range: TextRange): boolean; - function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean; - function rangeOverlapsWithStartEnd(r1: TextRange, start: number, end: number): boolean; - function nodeOverlapsWithStartEnd(node: Node, sourceFile: SourceFile, start: number, end: number): boolean; - function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number): boolean; - /** - * Assumes `candidate.start <= position` holds. - */ - function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean; - function findListItemInfo(node: Node): ListItemInfo | undefined; - function hasChildOfKind(n: Node, kind: SyntaxKind, sourceFile: SourceFile): boolean; - function findChildOfKind(n: Node, kind: T["kind"], sourceFile: SourceFileLike): T | undefined; - function findContainingList(node: Node): SyntaxList | undefined; - /** - * Gets the token whose text has range [start, end) and - * position >= start and (position < end or (position === end && token is literal or keyword or identifier)) - */ - function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node; - /** - * Returns the token if position is in [start, end). - * If position === end, returns the preceding token if includeItemAtEndPosition(previousToken) === true - */ - function getTouchingToken(sourceFile: SourceFile, position: number, includeJsDocComment: boolean, includePrecedingTokenAtEndPosition?: (n: Node) => boolean): Node; - /** Returns a token if position is in [start-of-leading-trivia, end) */ - function getTokenAtPosition(sourceFile: SourceFile, position: number, includeJsDocComment: boolean, includeEndPosition?: boolean): Node; - /** - * The token on the left of the position is the token that strictly includes the position - * or sits to the left of the cursor if it is on a boundary. For example - * - * fo|o -> will return foo - * foo |bar -> will return foo - * - */ - function findTokenOnLeftOfPosition(file: SourceFile, position: number): Node | undefined; - function findNextToken(previousToken: Node, parent: Node, sourceFile: SourceFile): Node | undefined; - /** - * Finds the rightmost token satisfying `token.end <= position`, - * excluding `JsxText` tokens containing only whitespace. - */ - function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node, includeJsDoc?: boolean): Node | undefined; - function isInString(sourceFile: SourceFile, position: number, previousToken?: Node | undefined): boolean; - /** - * returns true if the position is in between the open and close elements of an JSX expression. - */ - function isInsideJsxElementOrAttribute(sourceFile: SourceFile, position: number): boolean; - function isInTemplateString(sourceFile: SourceFile, position: number): boolean; - function findPrecedingMatchingToken(token: Node, matchingTokenKind: SyntaxKind, sourceFile: SourceFile): Node | undefined; - interface PossibleTypeArgumentInfo { - readonly called: Identifier; - readonly nTypeArguments: number; - } - function isPossiblyTypeArgumentPosition(tokenIn: Node, sourceFile: SourceFile): PossibleTypeArgumentInfo | undefined; - /** - * Returns true if the cursor at position in sourceFile is within a comment. - * - * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position) - * @param predicate Additional predicate to test on the comment range. - */ - function isInComment(sourceFile: SourceFile, position: number, tokenAtPosition?: Node, predicate?: (c: CommentRange) => boolean): boolean; - function hasDocComment(sourceFile: SourceFile, position: number): boolean | undefined; - function getNodeModifiers(node: Node): string; - function getTypeArgumentOrTypeParameterList(node: Node): NodeArray | undefined; - function isComment(kind: SyntaxKind): boolean; - function isStringOrRegularExpressionOrTemplateLiteral(kind: SyntaxKind): boolean; - function isPunctuation(kind: SyntaxKind): boolean; - function isInsideTemplateLiteral(node: TemplateLiteralToken, position: number, sourceFile: SourceFile): boolean; - function isAccessibilityModifier(kind: SyntaxKind): boolean; - function cloneCompilerOptions(options: CompilerOptions): CompilerOptions; - function isArrayLiteralOrObjectLiteralDestructuringPattern(node: Node): boolean; - function isInReferenceComment(sourceFile: SourceFile, position: number): boolean; - function isInNonReferenceComment(sourceFile: SourceFile, position: number): boolean; - function createTextSpanFromNode(node: Node, sourceFile?: SourceFile): TextSpan; - function createTextSpanFromRange(range: TextRange): TextSpan; - function createTextRangeFromSpan(span: TextSpan): TextRange; - function createTextChangeFromStartLength(start: number, length: number, newText: string): TextChange; - function createTextChange(span: TextSpan, newText: string): TextChange; - const typeKeywords: ReadonlyArray; - function isTypeKeyword(kind: SyntaxKind): boolean; - /** True if the symbol is for an external module, as opposed to a namespace. */ - function isExternalModuleSymbol(moduleSymbol: Symbol): boolean; - /** Returns `true` the first time it encounters a node and `false` afterwards. */ - type NodeSeenTracker = (node: T) => boolean; - function nodeSeenTracker(): NodeSeenTracker; - function getSnapshotText(snap: IScriptSnapshot): string; - function repeatString(str: string, count: number): string; - function skipConstraint(type: Type): Type; - function getNameFromPropertyName(name: PropertyName): string | undefined; - function programContainsEs6Modules(program: Program): boolean; - function compilerOptionsIndicateEs6Modules(compilerOptions: CompilerOptions): boolean; - function hostUsesCaseSensitiveFileNames(host: LanguageServiceHost): boolean; - function hostGetCanonicalFileName(host: LanguageServiceHost): GetCanonicalFileName; - function makeImportIfNecessary(defaultImport: Identifier | undefined, namedImports: ReadonlyArray | undefined, moduleSpecifier: string, quotePreference: QuotePreference): ImportDeclaration | undefined; - function makeImport(defaultImport: Identifier | undefined, namedImports: ReadonlyArray | undefined, moduleSpecifier: string | Expression, quotePreference: QuotePreference): ImportDeclaration; - function makeStringLiteral(text: string, quotePreference: QuotePreference): StringLiteral; - enum QuotePreference { - Single = 0, - Double = 1 - } - function quotePreferenceFromString(str: StringLiteral, sourceFile: SourceFile): QuotePreference; - function getQuotePreference(sourceFile: SourceFile, preferences: UserPreferences): QuotePreference; - function symbolNameNoDefault(symbol: Symbol): string | undefined; - function symbolEscapedNameNoDefault(symbol: Symbol): __String | undefined; - function getPropertySymbolFromBindingElement(checker: TypeChecker, bindingElement: BindingElement & { - name: Identifier; - }): Symbol | undefined; - /** - * Find symbol of the given property-name and add the symbol to the given result array - * @param symbol a symbol to start searching for the given propertyName - * @param propertyName a name of property to search for - * @param result an array of symbol of found property symbols - * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. - * The value of previousIterationSymbol is undefined when the function is first called. - */ - function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, checker: TypeChecker, cb: (symbol: Symbol) => T | undefined): T | undefined; - function isMemberSymbolInBaseType(memberSymbol: Symbol, checker: TypeChecker): boolean; - class NodeSet { - private map; - add(node: Node): void; - has(node: Node): boolean; - forEach(cb: (node: Node) => void): void; - some(pred: (node: Node) => boolean): boolean; - } - function getParentNodeInSpan(node: Node | undefined, file: SourceFile, span: TextSpan): Node | undefined; - function findModifier(node: Node, kind: Modifier["kind"]): Modifier | undefined; - function insertImport(changes: textChanges.ChangeTracker, sourceFile: SourceFile, importDecl: Statement): void; -} -declare namespace ts { - function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean; - function symbolPart(text: string, symbol: Symbol): SymbolDisplayPart; - function displayPart(text: string, kind: SymbolDisplayPartKind): SymbolDisplayPart; - function spacePart(): SymbolDisplayPart; - function keywordPart(kind: SyntaxKind): SymbolDisplayPart; - function punctuationPart(kind: SyntaxKind): SymbolDisplayPart; - function operatorPart(kind: SyntaxKind): SymbolDisplayPart; - function textOrKeywordPart(text: string): SymbolDisplayPart; - function textPart(text: string): SymbolDisplayPart; - /** - * The default is CRLF. - */ - function getNewLineOrDefaultFromHost(host: LanguageServiceHost | LanguageServiceShimHost, formatSettings?: FormatCodeSettings): string; - function lineBreakPart(): SymbolDisplayPart; - function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[]; - function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; - function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[]; - function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; - function isImportOrExportSpecifierName(location: Node): location is Identifier; - /** - * Strip off existed single quotes or double quotes from a given string - * - * @return non-quoted string - */ - function stripQuotes(name: string): string; - function startsWithQuote(name: string): boolean; - function scriptKindIs(fileName: string, host: LanguageServiceHost, ...scriptKinds: ScriptKind[]): boolean; - function getScriptKind(fileName: string, host?: LanguageServiceHost): ScriptKind; - function getUniqueSymbolId(symbol: Symbol, checker: TypeChecker): number; - function getFirstNonSpaceCharacterPosition(text: string, position: number): number; - /** - * Creates a deep, memberwise clone of a node with no source map location. - * - * WARNING: This is an expensive operation and is only intended to be used in refactorings - * and code fixes (because those are triggered by explicit user actions). - */ - function getSynthesizedDeepClone(node: T, includeTrivia?: boolean): T; - function getSynthesizedDeepClones(nodes: NodeArray, includeTrivia?: boolean): NodeArray; - function getSynthesizedDeepClones(nodes: NodeArray | undefined, includeTrivia?: boolean): NodeArray | undefined; - /** - * Sets EmitFlags to suppress leading and trailing trivia on the node. - */ - function suppressLeadingAndTrailingTrivia(node: Node): void; - /** - * Sets EmitFlags to suppress leading trivia on the node. - */ - function suppressLeadingTrivia(node: Node): void; - /** - * Sets EmitFlags to suppress trailing trivia on the node. - */ - function suppressTrailingTrivia(node: Node): void; - function getUniqueName(baseName: string, sourceFile: SourceFile): string; - /** - * @return The index of the (only) reference to the extracted symbol. We want the cursor - * to be on the reference, rather than the declaration, because it's closer to where the - * user was before extracting it. - */ - function getRenameLocation(edits: ReadonlyArray, renameFilename: string, name: string, preferLastLocation: boolean): number; - function copyComments(sourceNode: Node, targetNode: Node, sourceFile: SourceFile, commentKind?: CommentKind, hasTrailingNewLine?: boolean): void; -} declare namespace ts { function createClassifier(): Classifier; - function getSemanticClassifications(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, classifiableNames: UnderscoreEscapedMap, span: TextSpan): ClassifiedSpan[]; - function getEncodedSemanticClassifications(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, classifiableNames: UnderscoreEscapedMap, span: TextSpan): Classifications; - function getSyntacticClassifications(cancellationToken: CancellationToken, sourceFile: SourceFile, span: TextSpan): ClassifiedSpan[]; - function getEncodedSyntacticClassifications(cancellationToken: CancellationToken, sourceFile: SourceFile, span: TextSpan): Classifications; -} -declare namespace ts.Completions.PathCompletions { - interface NameAndKind { - readonly name: string; - readonly kind: ScriptElementKind.scriptElement | ScriptElementKind.directory | ScriptElementKind.externalModuleName; - } - interface PathCompletion extends NameAndKind { - readonly span: TextSpan | undefined; - } - function getStringLiteralCompletionsFromModuleNames(sourceFile: SourceFile, node: LiteralExpression, compilerOptions: CompilerOptions, host: LanguageServiceHost, typeChecker: TypeChecker): ReadonlyArray; - function getTripleSlashReferenceCompletion(sourceFile: SourceFile, position: number, compilerOptions: CompilerOptions, host: LanguageServiceHost): ReadonlyArray | undefined; -} -declare namespace ts.Completions { - type Log = (message: string) => void; - function getCompletionsAtPosition(host: LanguageServiceHost, program: Program, log: Log, sourceFile: SourceFile, position: number, preferences: UserPreferences, triggerCharacter: CompletionsTriggerCharacter | undefined): CompletionInfo | undefined; - interface CompletionEntryIdentifier { - name: string; - source?: string; - } - function getCompletionEntryDetails(program: Program, log: Log, sourceFile: SourceFile, position: number, entryId: CompletionEntryIdentifier, host: LanguageServiceHost, formatContext: formatting.FormatContext, getCanonicalFileName: GetCanonicalFileName, preferences: UserPreferences, cancellationToken: CancellationToken): CompletionEntryDetails | undefined; - function getCompletionEntrySymbol(program: Program, log: Log, sourceFile: SourceFile, position: number, entryId: CompletionEntryIdentifier): Symbol | undefined; -} -declare namespace ts.DocumentHighlights { - function getDocumentHighlights(program: Program, cancellationToken: CancellationToken, sourceFile: SourceFile, position: number, sourceFilesToSearch: ReadonlyArray): DocumentHighlights[] | undefined; } declare namespace ts { /** @@ -10994,800 +5601,38 @@ declare namespace ts { * @param fileName The name of the file to be released * @param compilationSettings The compilation settings used to acquire the file */ - releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; - releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; - getLanguageServiceRefCounts(path: Path): [string, number | undefined][]; - reportStats(): string; - } - interface ExternalDocumentCache { - setDocument(key: DocumentRegistryBucketKey, path: Path, sourceFile: SourceFile): void; - getDocument(key: DocumentRegistryBucketKey, path: Path): SourceFile | undefined; - } - type DocumentRegistryBucketKey = string & { - __bucketKey: any; - }; - function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; - function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boolean, currentDirectory?: string, externalCache?: ExternalDocumentCache): DocumentRegistry; -} -declare namespace ts.FindAllReferences { - interface ImportsResult { - /** For every import of the symbol, the location and local symbol for the import. */ - importSearches: ReadonlyArray<[Identifier, Symbol]>; - /** For rename imports/exports `{ foo as bar }`, `foo` is not a local, so it may be added as a reference immediately without further searching. */ - singleReferences: ReadonlyArray; - /** List of source files that may (or may not) use the symbol via a namespace. (For UMD modules this is every file.) */ - indirectUsers: ReadonlyArray; - } - type ImportTracker = (exportSymbol: Symbol, exportInfo: ExportInfo, isForRename: boolean) => ImportsResult; - /** Creates the imports map and returns an ImportTracker that uses it. Call this lazily to avoid calling `getDirectImportsMap` unnecessarily. */ - function createImportTracker(sourceFiles: ReadonlyArray, sourceFilesSet: ReadonlyMap, checker: TypeChecker, cancellationToken: CancellationToken | undefined): ImportTracker; - /** Info about an exported symbol to perform recursive search on. */ - interface ExportInfo { - exportingModuleSymbol: Symbol; - exportKind: ExportKind; - } - enum ExportKind { - Named = 0, - Default = 1, - ExportEquals = 2 - } - enum ImportExport { - Import = 0, - Export = 1 - } - type ModuleReference = { - kind: "import"; - literal: StringLiteralLike; - } - /** or */ - | { - kind: "reference"; - referencingFile: SourceFile; - ref: FileReference; - }; - function findModuleReferences(program: Program, sourceFiles: ReadonlyArray, searchModuleSymbol: Symbol): ModuleReference[]; - interface ImportedSymbol { - kind: ImportExport.Import; - symbol: Symbol; - isNamedImport: boolean; - } - interface ExportedSymbol { - kind: ImportExport.Export; - symbol: Symbol; - exportInfo: ExportInfo; - } - /** - * Given a local reference, we might notice that it's an import/export and recursively search for references of that. - * If at an import, look locally for the symbol it imports. - * If an an export, look for all imports of it. - * This doesn't handle export specifiers; that is done in `getReferencesAtExportSpecifier`. - * @param comingFromExport If we are doing a search for all exports, don't bother looking backwards for the imported symbol, since that's the reason we're here. - */ - function getImportOrExportSymbol(node: Node, symbol: Symbol, checker: TypeChecker, comingFromExport: boolean): ImportedSymbol | ExportedSymbol | undefined; - function getExportInfo(exportSymbol: Symbol, exportKind: ExportKind, checker: TypeChecker): ExportInfo | undefined; -} -declare namespace ts.FindAllReferences { - interface SymbolAndEntries { - definition: Definition | undefined; - references: Entry[]; - } - type Definition = { - type: "symbol"; - symbol: Symbol; - } | { - type: "label"; - node: Identifier; - } | { - type: "keyword"; - node: Node; - } | { - type: "this"; - node: Node; - } | { - type: "string"; - node: StringLiteral; - }; - type Entry = NodeEntry | SpanEntry; - interface NodeEntry { - type: "node"; - node: Node; - isInString?: true; - } - interface SpanEntry { - type: "span"; - fileName: string; - textSpan: TextSpan; - } - function nodeEntry(node: Node, isInString?: true): NodeEntry; - interface Options { - readonly findInStrings?: boolean; - readonly findInComments?: boolean; - /** - * True if we are renaming the symbol. - * If so, we will find fewer references -- if it is referenced by several different names, we sill only find references for the original name. - */ - readonly isForRename?: boolean; - /** True if we are searching for implementations. We will have a different method of adding references if so. */ - readonly implementations?: boolean; - } - function findReferencedSymbols(program: Program, cancellationToken: CancellationToken, sourceFiles: ReadonlyArray, sourceFile: SourceFile, position: number): ReferencedSymbol[] | undefined; - function getImplementationsAtPosition(program: Program, cancellationToken: CancellationToken, sourceFiles: ReadonlyArray, sourceFile: SourceFile, position: number): ImplementationLocation[] | undefined; - function findReferencedEntries(program: Program, cancellationToken: CancellationToken, sourceFiles: ReadonlyArray, sourceFile: SourceFile, position: number, options?: Options): ReferenceEntry[] | undefined; - function getReferenceEntriesForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken, options?: Options, sourceFilesSet?: ReadonlyMap): Entry[] | undefined; - function toHighlightSpan(entry: Entry): { - fileName: string; - span: HighlightSpan; - }; -} -/** Encapsulates the core find-all-references algorithm. */ -declare namespace ts.FindAllReferences.Core { - /** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */ - function getReferencedSymbolsForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken, options?: Options, sourceFilesSet?: ReadonlyMap): SymbolAndEntries[] | undefined; - function eachExportReference(sourceFiles: ReadonlyArray, checker: TypeChecker, cancellationToken: CancellationToken | undefined, exportSymbol: Symbol, exportingModuleSymbol: Symbol, exportName: string, isDefaultExport: boolean, cb: (ref: Identifier) => void): void; - /** Used as a quick check for whether a symbol is used at all in a file (besides its definition). */ - function isSymbolReferencedInFile(definition: Identifier, checker: TypeChecker, sourceFile: SourceFile): boolean; - function eachSymbolReferenceInFile(definition: Identifier, checker: TypeChecker, sourceFile: SourceFile, cb: (token: Identifier) => T): T | undefined; - /** - * Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations - * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class - * then we need to widen the search to include type positions as well. - * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated - * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) - * do not intersect in any of the three spaces. - */ - function getIntersectingMeaningFromDeclarations(node: Node, symbol: Symbol): SemanticMeaning; - function getReferenceEntriesForShorthandPropertyAssignment(node: Node, checker: TypeChecker, addReference: (node: Node) => void): void; -} -declare namespace ts { - function getEditsForFileRename(program: Program, oldFileOrDirPath: string, newFileOrDirPath: string, host: LanguageServiceHost, formatContext: formatting.FormatContext, preferences: UserPreferences): ReadonlyArray; -} -declare namespace ts.GoToDefinition { - function getDefinitionAtPosition(program: Program, sourceFile: SourceFile, position: number): DefinitionInfo[] | undefined; - function getReferenceAtPosition(sourceFile: SourceFile, position: number, program: Program): { - fileName: string; - file: SourceFile; - } | undefined; - function getTypeDefinitionAtPosition(typeChecker: TypeChecker, sourceFile: SourceFile, position: number): DefinitionInfo[] | undefined; - function getDefinitionAndBoundSpan(program: Program, sourceFile: SourceFile, position: number): DefinitionInfoAndBoundSpan | undefined; - function findReferenceInPosition(refs: ReadonlyArray, pos: number): FileReference | undefined; -} -declare namespace ts.JsDoc { - function getJsDocCommentsFromDeclarations(declarations: ReadonlyArray): SymbolDisplayPart[]; - function getJsDocTagsFromDeclarations(declarations?: Declaration[]): JSDocTagInfo[]; - function getJSDocTagNameCompletions(): CompletionEntry[]; - const getJSDocTagNameCompletionDetails: typeof getJSDocTagCompletionDetails; - function getJSDocTagCompletions(): CompletionEntry[]; - function getJSDocTagCompletionDetails(name: string): CompletionEntryDetails; - function getJSDocParameterNameCompletions(tag: JSDocParameterTag): CompletionEntry[]; - function getJSDocParameterNameCompletionDetails(name: string): CompletionEntryDetails; - /** - * Checks if position points to a valid position to add JSDoc comments, and if so, - * returns the appropriate template. Otherwise returns an empty string. - * Valid positions are - * - outside of comments, statements, and expressions, and - * - preceding a: - * - function/constructor/method declaration - * - class declarations - * - variable statements - * - namespace declarations - * - interface declarations - * - method signatures - * - type alias declarations - * - * Hosts should ideally check that: - * - The line is all whitespace up to 'position' before performing the insertion. - * - If the keystroke sequence "/\*\*" induced the call, we also check that the next - * non-whitespace character is '*', which (approximately) indicates whether we added - * the second '*' to complete an existing (JSDoc) comment. - * @param fileName The file in which to perform the check. - * @param position The (character-indexed) position in the file where the check should - * be performed. - */ - function getDocCommentTemplateAtPosition(newLine: string, sourceFile: SourceFile, position: number): TextInsertion | undefined; -} -declare namespace ts.NavigateTo { - function getNavigateToItems(sourceFiles: ReadonlyArray, checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number | undefined, excludeDtsFiles: boolean): NavigateToItem[]; -} -declare namespace ts.NavigationBar { - function getNavigationBarItems(sourceFile: SourceFile, cancellationToken: CancellationToken): NavigationBarItem[]; - function getNavigationTree(sourceFile: SourceFile, cancellationToken: CancellationToken): NavigationTree; -} -declare namespace ts.OrganizeImports { - /** - * Organize imports by: - * 1) Removing unused imports - * 2) Coalescing imports from the same module - * 3) Sorting imports - */ - function organizeImports(sourceFile: SourceFile, formatContext: formatting.FormatContext, host: LanguageServiceHost, program: Program, _preferences: UserPreferences): FileTextChanges[]; - /** - * @param importGroup a list of ImportDeclarations, all with the same module name. - */ - function coalesceImports(importGroup: ReadonlyArray): ReadonlyArray; - /** - * @param exportGroup a list of ExportDeclarations, all with the same module name. - */ - function coalesceExports(exportGroup: ReadonlyArray): ReadonlyArray; - function compareModuleSpecifiers(m1: Expression, m2: Expression): Comparison; -} -declare namespace ts.OutliningElementsCollector { - function collectElements(sourceFile: SourceFile, cancellationToken: CancellationToken): OutliningSpan[]; -} -declare namespace ts { - enum PatternMatchKind { - exact = 0, - prefix = 1, - substring = 2, - camelCase = 3 - } - interface PatternMatch { - kind: PatternMatchKind; - isCaseSensitive: boolean; - } - interface PatternMatcher { - getMatchForLastSegmentOfPattern(candidate: string): PatternMatch | undefined; - getFullMatch(candidateContainers: ReadonlyArray, candidate: string): PatternMatch | undefined; - patternContainsDots: boolean; - } - function createPatternMatcher(pattern: string): PatternMatcher | undefined; - function breakIntoCharacterSpans(identifier: string): TextSpan[]; - function breakIntoWordSpans(identifier: string): TextSpan[]; -} -declare namespace ts { - function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; -} -declare namespace ts.Rename { - function getRenameInfo(typeChecker: TypeChecker, defaultLibFileName: string, getCanonicalFileName: GetCanonicalFileName, sourceFile: SourceFile, position: number): RenameInfo; -} -declare namespace ts.SignatureHelp { - function getSignatureHelpItems(program: Program, sourceFile: SourceFile, position: number, cancellationToken: CancellationToken): SignatureHelpItems | undefined; - interface ArgumentInfoForCompletions { - readonly invocation: CallLikeExpression; - readonly argumentIndex: number; - readonly argumentCount: number; - } - function getArgumentInfoForCompletions(node: Node, position: number, sourceFile: SourceFile): ArgumentInfoForCompletions | undefined; -} -declare namespace ts { - function computeSuggestionDiagnostics(sourceFile: SourceFile, program: Program, cancellationToken: CancellationToken): DiagnosticWithLocation[]; -} -declare namespace ts.SymbolDisplay { - function getSymbolKind(typeChecker: TypeChecker, symbol: Symbol, location: Node): ScriptElementKind; - function getSymbolModifiers(symbol: Symbol): string; - interface SymbolDisplayPartsDocumentationAndSymbolKind { - displayParts: SymbolDisplayPart[]; - documentation: SymbolDisplayPart[]; - symbolKind: ScriptElementKind; - tags: JSDocTagInfo[] | undefined; - } - function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker: TypeChecker, symbol: Symbol, sourceFile: SourceFile, enclosingDeclaration: Node | undefined, location: Node, semanticMeaning?: SemanticMeaning, alias?: Symbol): SymbolDisplayPartsDocumentationAndSymbolKind; -} -declare namespace ts { - interface TranspileOptions { - compilerOptions?: CompilerOptions; - fileName?: string; - reportDiagnostics?: boolean; - moduleName?: string; - renamedDependencies?: MapLike; - transformers?: CustomTransformers; - } - interface TranspileOutput { - outputText: string; - diagnostics?: Diagnostic[]; - sourceMapText?: string; - } - function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; - function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; - /** JS users may pass in string values for enum compiler options (such as ModuleKind), so convert. */ - function fixupCompilerOptions(options: CompilerOptions, diagnostics: Diagnostic[]): CompilerOptions; -} -declare namespace ts.formatting { - enum FormattingRequestKind { - FormatDocument = 0, - FormatSelection = 1, - FormatOnEnter = 2, - FormatOnSemicolon = 3, - FormatOnOpeningCurlyBrace = 4, - FormatOnClosingCurlyBrace = 5 - } - class FormattingContext { - readonly sourceFile: SourceFileLike; - formattingRequestKind: FormattingRequestKind; - options: FormatCodeSettings; - currentTokenSpan: TextRangeWithKind; - nextTokenSpan: TextRangeWithKind; - contextNode: Node; - currentTokenParent: Node; - nextTokenParent: Node; - private contextNodeAllOnSameLine; - private nextNodeAllOnSameLine; - private tokensAreOnSameLine; - private contextNodeBlockIsOnOneLine; - private nextNodeBlockIsOnOneLine; - constructor(sourceFile: SourceFileLike, formattingRequestKind: FormattingRequestKind, options: FormatCodeSettings); - updateContext(currentRange: TextRangeWithKind, currentTokenParent: Node, nextRange: TextRangeWithKind, nextTokenParent: Node, commonParent: Node): void; - ContextNodeAllOnSameLine(): boolean; - NextNodeAllOnSameLine(): boolean; - TokensAreOnSameLine(): boolean; - ContextNodeBlockIsOnOneLine(): boolean; - NextNodeBlockIsOnOneLine(): boolean; - private NodeIsOnOneLine; - private BlockIsOnOneLine; - } -} -declare namespace ts.formatting { - interface FormattingScanner { - advance(): void; - isOnToken(): boolean; - readTokenInfo(n: Node): TokenInfo; - getCurrentLeadingTrivia(): TextRangeWithKind[] | undefined; - lastTrailingTriviaWasNewLine(): boolean; - skipToEndOf(node: Node): void; - } - function getFormattingScanner(text: string, languageVariant: LanguageVariant, startPos: number, endPos: number, cb: (scanner: FormattingScanner) => T): T; -} -declare namespace ts.formatting { - interface Rule { - readonly debugName: string; - readonly context: ReadonlyArray; - readonly action: RuleAction; - readonly flags: RuleFlags; - } - type ContextPredicate = (context: FormattingContext) => boolean; - const anyContext: ReadonlyArray; - enum RuleAction { - Ignore = 1, - Space = 2, - NewLine = 4, - Delete = 8 - } - enum RuleFlags { - None = 0, - CanDeleteNewLines = 1 - } - interface TokenRange { - readonly tokens: ReadonlyArray; - readonly isSpecific: boolean; - } -} -declare namespace ts.formatting { - interface RuleSpec { - readonly leftTokenRange: TokenRange; - readonly rightTokenRange: TokenRange; - readonly rule: Rule; - } - function getAllRules(): RuleSpec[]; -} -declare namespace ts.formatting { - function getFormatContext(options: FormatCodeSettings): FormatContext; - type RulesMap = (context: FormattingContext) => Rule | undefined; -} -declare namespace ts.formatting { - interface FormatContext { - readonly options: FormatCodeSettings; - readonly getRule: RulesMap; - } - interface TextRangeWithKind extends TextRange { - kind: SyntaxKind; - } - interface TextRangeWithTriviaKind extends TextRange { - kind: TriviaKind; - } - interface TokenInfo { - leadingTrivia: TextRangeWithTriviaKind[] | undefined; - token: TextRangeWithKind; - trailingTrivia: TextRangeWithTriviaKind[] | undefined; - } - function formatOnEnter(position: number, sourceFile: SourceFile, formatContext: FormatContext): TextChange[]; - function formatOnSemicolon(position: number, sourceFile: SourceFile, formatContext: FormatContext): TextChange[]; - function formatOnOpeningCurly(position: number, sourceFile: SourceFile, formatContext: FormatContext): TextChange[]; - function formatOnClosingCurly(position: number, sourceFile: SourceFile, formatContext: FormatContext): TextChange[]; - function formatDocument(sourceFile: SourceFile, formatContext: FormatContext): TextChange[]; - function formatSelection(start: number, end: number, sourceFile: SourceFile, formatContext: FormatContext): TextChange[]; - function formatNodeGivenIndentation(node: Node, sourceFileLike: SourceFileLike, languageVariant: LanguageVariant, initialIndentation: number, delta: number, formatContext: FormatContext): TextChange[]; - /** - * @param precedingToken pass `null` if preceding token was already computed and result was `undefined`. - */ - function getRangeOfEnclosingComment(sourceFile: SourceFile, position: number, onlyMultiLine: boolean, precedingToken?: Node | null, // tslint:disable-line:no-null-keyword - tokenAtPosition?: Node, predicate?: (c: CommentRange) => boolean): CommentRange | undefined; - function getIndentationString(indentation: number, options: EditorSettings): string; -} -declare namespace ts.formatting { - namespace SmartIndenter { - /** - * @param assumeNewLineBeforeCloseBrace - * `false` when called on text from a real source file. - * `true` when we need to assume `position` is on a newline. - * - * This is useful for codefixes. Consider - * ``` - * function f() { - * |} - * ``` - * with `position` at `|`. - * - * When inserting some text after an open brace, we would like to get indentation as if a newline was already there. - * By default indentation at `position` will be 0 so 'assumeNewLineBeforeCloseBrace' overrides this behavior. - */ - function getIndentation(position: number, sourceFile: SourceFile, options: EditorSettings, assumeNewLineBeforeCloseBrace?: boolean): number; - function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: EditorSettings): number; - function getBaseIndentation(options: EditorSettings): number; - function isArgumentAndStartLineOverlapsExpressionBeingCalled(parent: Node, child: Node, childStartLine: number, sourceFile: SourceFileLike): boolean; - function childStartsOnTheSameLineWithElseInIfStatement(parent: Node, child: TextRangeWithKind, childStartLine: number, sourceFile: SourceFileLike): boolean; - function getContainingList(node: Node, sourceFile: SourceFile): NodeArray | undefined; - /** - * Character is the actual index of the character since the beginning of the line. - * Column - position of the character after expanding tabs to spaces. - * "0\t2$" - * value of 'character' for '$' is 3 - * value of 'column' for '$' is 6 (assuming that tab size is 4) - */ - function findFirstNonWhitespaceCharacterAndColumn(startPos: number, endPos: number, sourceFile: SourceFileLike, options: EditorSettings): { - column: number; - character: number; - }; - function findFirstNonWhitespaceColumn(startPos: number, endPos: number, sourceFile: SourceFileLike, options: EditorSettings): number; - function nodeWillIndentChild(settings: FormatCodeSettings, parent: TextRangeWithKind, child: TextRangeWithKind | undefined, sourceFile: SourceFileLike | undefined, indentByDefault: boolean): boolean; - /** - * True when the parent node should indent the given child by an explicit rule. - * @param isNextChild If true, we are judging indent of a hypothetical child *after* this one, not the current child. - */ - function shouldIndentChildNode(settings: FormatCodeSettings, parent: TextRangeWithKind, child?: Node, sourceFile?: SourceFileLike, isNextChild?: boolean): boolean; - } -} -declare namespace ts.textChanges { - interface ConfigurableStart { - /** True to use getStart() (NB, not getFullStart()) without adjustment. */ - useNonAdjustedStartPosition?: boolean; - } - interface ConfigurableEnd { - /** True to use getEnd() without adjustment. */ - useNonAdjustedEndPosition?: boolean; - } - enum Position { - FullStart = 0, - Start = 1 - } - /** - * Usually node.pos points to a position immediately after the previous token. - * If this position is used as a beginning of the span to remove - it might lead to removing the trailing trivia of the previous node, i.e: - * const x; // this is x - * ^ - pos for the next variable declaration will point here - * const y; // this is y - * ^ - end for previous variable declaration - * Usually leading trivia of the variable declaration 'y' should not include trailing trivia (whitespace, comment 'this is x' and newline) from the preceding - * variable declaration and trailing trivia for 'y' should include (whitespace, comment 'this is y', newline). - * By default when removing nodes we adjust start and end positions to respect specification of the trivia above. - * If pos\end should be interpreted literally 'useNonAdjustedStartPosition' or 'useNonAdjustedEndPosition' should be set to true - */ - interface ConfigurableStartEnd extends ConfigurableStart, ConfigurableEnd { - } - const useNonAdjustedPositions: ConfigurableStartEnd; - interface InsertNodeOptions { - /** - * Text to be inserted before the new node - */ - prefix?: string; - /** - * Text to be inserted after the new node - */ - suffix?: string; - /** - * Text of inserted node will be formatted with this indentation, otherwise indentation will be inferred from the old node - */ - indentation?: number; - /** - * Text of inserted node will be formatted with this delta, otherwise delta will be inferred from the new node kind - */ - delta?: number; - /** - * Do not trim leading white spaces in the edit range - */ - preserveLeadingWhitespace?: boolean; - } - interface ReplaceWithMultipleNodesOptions extends InsertNodeOptions { - readonly joiner?: string; - } - interface ChangeNodeOptions extends ConfigurableStartEnd, InsertNodeOptions { - } - interface TextChangesContext { - host: LanguageServiceHost; - formatContext: formatting.FormatContext; - } - type TypeAnnotatable = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertyDeclaration | PropertySignature; - class ChangeTracker { - private readonly newLineCharacter; - private readonly formatContext; - private readonly changes; - private readonly newFiles; - private readonly deletedNodesInLists; - private readonly classesWithNodesInsertedAtStart; - static fromContext(context: TextChangesContext): ChangeTracker; - static with(context: TextChangesContext, cb: (tracker: ChangeTracker) => void): FileTextChanges[]; - /** Public for tests only. Other callers should use `ChangeTracker.with`. */ - constructor(newLineCharacter: string, formatContext: formatting.FormatContext); - deleteRange(sourceFile: SourceFile, range: TextRange): this; - /** Warning: This deletes comments too. See `copyComments` in `convertFunctionToEs6Class`. */ - deleteNode(sourceFile: SourceFile, node: Node, options?: ConfigurableStartEnd): this; - deleteModifier(sourceFile: SourceFile, modifier: Modifier): void; - deleteNodeRange(sourceFile: SourceFile, startNode: Node, endNode: Node, options?: ConfigurableStartEnd): this; - deleteNodeRangeExcludingEnd(sourceFile: SourceFile, startNode: Node, afterEndNode: Node | undefined, options?: ConfigurableStartEnd): void; - deleteNodeInList(sourceFile: SourceFile, node: Node): this; - replaceRange(sourceFile: SourceFile, range: TextRange, newNode: Node, options?: InsertNodeOptions): this; - replaceNode(sourceFile: SourceFile, oldNode: Node, newNode: Node, options?: ChangeNodeOptions): this; - replaceNodeRange(sourceFile: SourceFile, startNode: Node, endNode: Node, newNode: Node, options?: ChangeNodeOptions): void; - private replaceRangeWithNodes; - replaceNodeWithNodes(sourceFile: SourceFile, oldNode: Node, newNodes: ReadonlyArray, options?: ChangeNodeOptions): this; - replaceNodeRangeWithNodes(sourceFile: SourceFile, startNode: Node, endNode: Node, newNodes: ReadonlyArray, options?: ReplaceWithMultipleNodesOptions & ConfigurableStartEnd): this; - private nextCommaToken; - replacePropertyAssignment(sourceFile: SourceFile, oldNode: PropertyAssignment, newNode: PropertyAssignment): this; - private insertNodeAt; - private insertNodesAt; - insertNodeAtTopOfFile(sourceFile: SourceFile, newNode: Statement, blankLineBetween: boolean): void; - insertNodeBefore(sourceFile: SourceFile, before: Node, newNode: Node, blankLineBetween?: boolean): void; - insertModifierBefore(sourceFile: SourceFile, modifier: SyntaxKind, before: Node): void; - insertCommentBeforeLine(sourceFile: SourceFile, lineNumber: number, position: number, commentText: string): void; - replaceRangeWithText(sourceFile: SourceFile, range: TextRange, text: string): void; - private insertText; - /** Prefer this over replacing a node with another that has a type annotation, as it avoids reformatting the other parts of the node. */ - tryInsertTypeAnnotation(sourceFile: SourceFile, node: TypeAnnotatable, type: TypeNode): void; - insertTypeParameters(sourceFile: SourceFile, node: SignatureDeclaration, typeParameters: ReadonlyArray): void; - private getOptionsForInsertNodeBefore; - insertNodeAtConstructorStart(sourceFile: SourceFile, ctr: ConstructorDeclaration, newStatement: Statement): void; - insertNodeAtConstructorEnd(sourceFile: SourceFile, ctr: ConstructorDeclaration, newStatement: Statement): void; - private replaceConstructorBody; - insertNodeAtEndOfScope(sourceFile: SourceFile, scope: Node, newNode: Node): void; - insertNodeAtClassStart(sourceFile: SourceFile, cls: ClassLikeDeclaration, newElement: ClassElement): void; - private getInsertNodeAtClassStartPrefixSuffix; - insertNodeAfterComma(sourceFile: SourceFile, after: Node, newNode: Node): void; - insertNodeAfter(sourceFile: SourceFile, after: Node, newNode: Node): void; - insertNodeAtEndOfList(sourceFile: SourceFile, list: NodeArray, newNode: Node): void; - insertNodesAfter(sourceFile: SourceFile, after: Node, newNodes: ReadonlyArray): void; - private insertNodeAfterWorker; - private getInsertNodeAfterOptions; - private getInsertNodeAfterOptionsWorker; - insertName(sourceFile: SourceFile, node: FunctionExpression | ClassExpression | ArrowFunction, name: string): void; - insertExportModifier(sourceFile: SourceFile, node: DeclarationStatement | VariableStatement): void; - /** - * This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range, - * i.e. arguments in arguments lists, parameters in parameter lists etc. - * Note that separators are part of the node in statements and class elements. - */ - insertNodeInListAfter(sourceFile: SourceFile, after: Node, newNode: Node, containingList?: NodeArray | undefined): this; - private finishClassesWithNodesInsertedAtStart; - private finishTrailingCommaAfterDeletingNodesInList; - /** - * Note: after calling this, the TextChanges object must be discarded! - * @param validate only for tests - * The reason we must validate as part of this method is that `getNonFormattedText` changes the node's positions, - * so we can only call this once and can't get the non-formatted text separately. - */ - getChanges(validate?: ValidateNonFormattedText): FileTextChanges[]; - createNewFile(oldFile: SourceFile, fileName: string, statements: ReadonlyArray): void; - } - type ValidateNonFormattedText = (node: Node, text: string) => void; - function applyChanges(text: string, changes: TextChange[]): string; - function isValidLocationToAddComment(sourceFile: SourceFile, position: number): boolean; -} -declare namespace ts { - interface CodeFixRegistration { - errorCodes: number[]; - getCodeActions(context: CodeFixContext): CodeFixAction[] | undefined; - fixIds?: string[]; - getAllCodeActions?(context: CodeFixAllContext): CombinedCodeActions; - } - interface CodeFixContextBase extends textChanges.TextChangesContext { - sourceFile: SourceFile; - program: Program; - cancellationToken: CancellationToken; - preferences: UserPreferences; - } - interface CodeFixAllContext extends CodeFixContextBase { - fixId: {}; - } - interface CodeFixContext extends CodeFixContextBase { - errorCode: number; - span: TextSpan; - } - namespace codefix { - type DiagnosticAndArguments = DiagnosticMessage | [DiagnosticMessage, string] | [DiagnosticMessage, string, string]; - function createCodeFixActionNoFixId(fixName: string, changes: FileTextChanges[], description: DiagnosticAndArguments): CodeFixAction; - function createCodeFixAction(fixName: string, changes: FileTextChanges[], description: DiagnosticAndArguments, fixId: {}, fixAllDescription: DiagnosticAndArguments, command?: CodeActionCommand): CodeFixAction; - function registerCodeFix(reg: CodeFixRegistration): void; - function getSupportedErrorCodes(): string[]; - function getFixes(context: CodeFixContext): CodeFixAction[]; - function getAllFixes(context: CodeFixAllContext): CombinedCodeActions; - function createFileTextChanges(fileName: string, textChanges: TextChange[]): FileTextChanges; - function codeFixAll(context: CodeFixAllContext, errorCodes: number[], use: (changes: textChanges.ChangeTracker, error: DiagnosticWithLocation, commands: Push) => void): CombinedCodeActions; - } -} -declare namespace ts { - interface Refactor { - /** Compute the associated code actions */ - getEditsForAction(context: RefactorContext, actionName: string): RefactorEditInfo | undefined; - /** Compute (quickly) which actions are available here */ - getAvailableActions(context: RefactorContext): ApplicableRefactorInfo[] | undefined; - } - interface RefactorContext extends textChanges.TextChangesContext { - file: SourceFile; - startPosition: number; - endPosition?: number; - program: Program; - cancellationToken?: CancellationToken; - preferences: UserPreferences; - } - namespace refactor { - /** @param name An unique code associated with each refactor. Does not have to be human-readable. */ - function registerRefactor(name: string, refactor: Refactor): void; - function getApplicableRefactors(context: RefactorContext): ApplicableRefactorInfo[]; - function getEditsForRefactor(context: RefactorContext, refactorName: string, actionName: string): RefactorEditInfo | undefined; - } - function getRefactorContextSpan({ startPosition, endPosition }: RefactorContext): TextSpan; -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { - type DeclarationWithType = FunctionLikeDeclaration | VariableDeclaration | PropertySignature | PropertyDeclaration; - function parameterShouldGetTypeFromJSDoc(node: Node): node is DeclarationWithType; -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { - function getImportCompletionAction(exportedSymbol: Symbol, moduleSymbol: Symbol, sourceFile: SourceFile, symbolName: string, host: LanguageServiceHost, program: Program, checker: TypeChecker, compilerOptions: CompilerOptions, allSourceFiles: ReadonlyArray, formatContext: formatting.FormatContext, getCanonicalFileName: GetCanonicalFileName, symbolToken: Node | undefined, preferences: UserPreferences): { - readonly moduleSpecifier: string; - readonly codeAction: CodeAction; - }; - function forEachExternalModuleToImportFrom(checker: TypeChecker, from: SourceFile, allSourceFiles: ReadonlyArray, cb: (module: Symbol) => void): void; - function moduleSymbolToValidIdentifier(moduleSymbol: Symbol, target: ScriptTarget): string; - function moduleSpecifierToValidIdentifier(moduleSpecifier: string, target: ScriptTarget): string; -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { - /** - * Finds members of the resolved type that are missing in the class pointed to by class decl - * and generates source code for the missing members. - * @param possiblyMissingSymbols The collection of symbols to filter and then get insertions for. - * @returns Empty string iff there are no member insertions. - */ - function createMissingMemberNodes(classDeclaration: ClassLikeDeclaration, possiblyMissingSymbols: ReadonlyArray, checker: TypeChecker, preferences: UserPreferences, out: (node: ClassElement) => void): void; - function createMethodFromCallExpression(context: CodeFixContextBase, { typeArguments, arguments: args, parent: parent }: CallExpression, methodName: string, inJs: boolean, makeStatic: boolean, preferences: UserPreferences): MethodDeclaration; -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.refactor { -} -declare namespace ts.refactor { -} -declare namespace ts.refactor.extractSymbol { - /** - * Compute the associated code actions - * Exported for tests. - */ - function getAvailableActions(context: RefactorContext): ApplicableRefactorInfo[] | undefined; - function getEditsForAction(context: RefactorContext, actionName: string): RefactorEditInfo | undefined; - namespace Messages { - const cannotExtractRange: DiagnosticMessage; - const cannotExtractImport: DiagnosticMessage; - const cannotExtractSuper: DiagnosticMessage; - const cannotExtractEmpty: DiagnosticMessage; - const expressionExpected: DiagnosticMessage; - const uselessConstantType: DiagnosticMessage; - const statementOrExpressionExpected: DiagnosticMessage; - const cannotExtractRangeContainingConditionalBreakOrContinueStatements: DiagnosticMessage; - const cannotExtractRangeContainingConditionalReturnStatement: DiagnosticMessage; - const cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange: DiagnosticMessage; - const cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators: DiagnosticMessage; - const typeWillNotBeVisibleInTheNewScope: DiagnosticMessage; - const functionWillNotBeVisibleInTheNewScope: DiagnosticMessage; - const cannotExtractIdentifier: DiagnosticMessage; - const cannotExtractExportedEntity: DiagnosticMessage; - const cannotWriteInExpression: DiagnosticMessage; - const cannotExtractReadonlyPropertyInitializerOutsideConstructor: DiagnosticMessage; - const cannotExtractAmbientBlock: DiagnosticMessage; - const cannotAccessVariablesFromNestedScopes: DiagnosticMessage; - const cannotExtractToOtherFunctionLike: DiagnosticMessage; - const cannotExtractToJSClass: DiagnosticMessage; - const cannotExtractToExpressionArrowFunction: DiagnosticMessage; - } - enum RangeFacts { - None = 0, - HasReturn = 1, - IsGenerator = 2, - IsAsyncFunction = 4, - UsesThis = 8, - /** - * The range is in a function which needs the 'static' modifier in a class - */ - InStaticRegion = 16 - } - /** - * Represents an expression or a list of statements that should be extracted with some extra information - */ - interface TargetRange { - readonly range: Expression | Statement[]; - readonly facts: RangeFacts; - /** - * A list of symbols that are declared in the selected range which are visible in the containing lexical scope - * Used to ensure we don't turn something used outside the range free (or worse, resolve to a different entity). - */ - readonly declarations: Symbol[]; + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; + reportStats(): string; } - /** - * Result of 'getRangeToExtract' operation: contains either a range or a list of errors - */ - type RangeToExtract = { - readonly targetRange?: never; - readonly errors: ReadonlyArray; - } | { - readonly targetRange: TargetRange; - readonly errors?: never; + type DocumentRegistryBucketKey = string & { + __bucketKey: any; }; - /** - * getRangeToExtract takes a span inside a text file and returns either an expression or an array - * of statements representing the minimum set of nodes needed to extract the entire span. This - * process may fail, in which case a set of errors is returned instead (these are currently - * not shown to the user, but can be used by us diagnostically) - */ - function getRangeToExtract(sourceFile: SourceFile, span: TextSpan): RangeToExtract; -} -declare namespace ts.refactor.generateGetAccessorAndSetAccessor { + function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; } -declare namespace ts.refactor { +declare namespace ts { + function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; } -declare namespace ts.refactor.addOrRemoveBracesToArrowFunction { +declare namespace ts { + interface TranspileOptions { + compilerOptions?: CompilerOptions; + fileName?: string; + reportDiagnostics?: boolean; + moduleName?: string; + renamedDependencies?: MapLike; + transformers?: CustomTransformers; + } + interface TranspileOutput { + outputText: string; + diagnostics?: Diagnostic[]; + sourceMapText?: string; + } + function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; } declare namespace ts { /** The version of the language service API */ const servicesVersion = "0.8"; - interface DisplayPartsSymbolWriter extends EmitTextWriter { - displayParts(): SymbolDisplayPart[]; - } - function toEditorSettings(options: FormatCodeOptions | FormatCodeSettings): FormatCodeSettings; function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings; function displayPartsToString(displayParts: SymbolDisplayPart[] | undefined): string; function getDefaultCompilerOptions(): CompilerOptions; @@ -11795,24 +5640,7 @@ declare namespace ts { function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange | undefined, aggressiveChecks?: boolean): SourceFile; - /** A cancellation that throttles calls to the host */ - class ThrottledCancellationToken implements CancellationToken { - private hostCancellationToken; - private readonly throttleWaitMilliseconds; - private lastCancellationCheckTime; - constructor(hostCancellationToken: HostCancellationToken, throttleWaitMilliseconds?: number); - isCancellationRequested(): boolean; - throwIfCancellationRequested(): void; - } function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry, syntaxOnly?: boolean): LanguageService; - /** Names in the name table are escaped, so an identifier `__foo` will have a name table entry `___foo`. */ - function getNameTable(sourceFile: SourceFile): UnderscoreEscapedMap; - /** - * Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 } - */ - function getContainingObjectLiteralElement(node: Node): ObjectLiteralElement | undefined; - function getPropertySymbolsFromContextualType(typeChecker: TypeChecker, node: ObjectLiteralElement): Symbol[]; - function getPropertySymbolsFromType(type: Type, propName: PropertyName): Symbol[] | undefined; /** * Get the path of the default library files (lib.d.ts) as distributed with the typescript * node package. @@ -11820,12 +5648,6 @@ declare namespace ts { */ function getDefaultLibFilePath(options: CompilerOptions): string; } -declare namespace ts.BreakpointResolver { - /** - * Get the breakpoint span in given sourceFile - */ - function spanInSourceFileAtLocation(sourceFile: SourceFile, position: number): TextSpan | undefined; -} declare namespace ts { /** * Transform one or more nodes using the supplied transformers. @@ -11835,278 +5657,6 @@ declare namespace ts { */ function transform(source: T | T[], transformers: TransformerFactory[], compilerOptions?: CompilerOptions): TransformationResult; } -declare let debugObjectHost: { - CollectGarbage(): void; -}; -declare namespace ts { - interface ScriptSnapshotShim { - /** Gets a portion of the script snapshot specified by [start, end). */ - getText(start: number, end: number): string; - /** Gets the length of this script snapshot. */ - getLength(): number; - /** - * Returns a JSON-encoded value of the type: - * { span: { start: number; length: number }; newLength: number } - * - * Or undefined value if there was no change. - */ - getChangeRange(oldSnapshot: ScriptSnapshotShim): string | undefined; - /** Releases all resources held by this script snapshot */ - dispose?(): void; - } - interface Logger { - log(s: string): void; - trace(s: string): void; - error(s: string): void; - } - /** Public interface of the host of a language service shim instance. */ - interface LanguageServiceShimHost extends Logger { - getCompilationSettings(): string; - /** Returns a JSON-encoded value of the type: string[] */ - getScriptFileNames(): string; - getScriptKind?(fileName: string): ScriptKind; - getScriptVersion(fileName: string): string; - getScriptSnapshot(fileName: string): ScriptSnapshotShim; - getLocalizedDiagnosticMessages(): string; - getCancellationToken(): HostCancellationToken; - getCurrentDirectory(): string; - getDirectories(path: string): string; - getDefaultLibFileName(options: string): string; - getNewLine?(): string; - getProjectVersion?(): string; - useCaseSensitiveFileNames?(): boolean; - getTypeRootsVersion?(): number; - readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string; - readFile(path: string, encoding?: string): string | undefined; - fileExists(path: string): boolean; - getModuleResolutionsForFile?(fileName: string): string; - getTypeReferenceDirectiveResolutionsForFile?(fileName: string): string; - directoryExists(directoryName: string): boolean; - } - /** Public interface of the core-services host instance used in managed side */ - interface CoreServicesShimHost extends Logger { - directoryExists(directoryName: string): boolean; - fileExists(fileName: string): boolean; - getCurrentDirectory(): string; - getDirectories(path: string): string; - /** - * Returns a JSON-encoded value of the type: string[] - * - * @param exclude A JSON encoded string[] containing the paths to exclude - * when enumerating the directory. - */ - readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string; - /** - * Read arbitary text files on disk, i.e. when resolution procedure needs the content of 'package.json' to determine location of bundled typings for node modules - */ - readFile(fileName: string): string | undefined; - realpath?(path: string): string; - trace(s: string): void; - useCaseSensitiveFileNames?(): boolean; - } - interface ShimsFileReference { - path: string; - position: number; - length: number; - } - /** Public interface of a language service instance shim. */ - interface ShimFactory { - registerShim(shim: Shim): void; - unregisterShim(shim: Shim): void; - } - interface Shim { - dispose(_dummy: {}): void; - } - interface LanguageServiceShim extends Shim { - languageService: LanguageService; - dispose(_dummy: {}): void; - refresh(throwOnError: boolean): void; - cleanupSemanticCache(): void; - getSyntacticDiagnostics(fileName: string): string; - getSemanticDiagnostics(fileName: string): string; - getSuggestionDiagnostics(fileName: string): string; - getCompilerOptionsDiagnostics(): string; - getSyntacticClassifications(fileName: string, start: number, length: number): string; - getSemanticClassifications(fileName: string, start: number, length: number): string; - getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string; - getEncodedSemanticClassifications(fileName: string, start: number, length: number): string; - getCompletionsAtPosition(fileName: string, position: number, preferences: UserPreferences | undefined): string; - getCompletionEntryDetails(fileName: string, position: number, entryName: string, formatOptions: string | undefined, source: string | undefined, preferences: UserPreferences | undefined): string; - getQuickInfoAtPosition(fileName: string, position: number): string; - getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): string; - getBreakpointStatementAtPosition(fileName: string, position: number): string; - getSignatureHelpItems(fileName: string, position: number): string; - /** - * Returns a JSON-encoded value of the type: - * { canRename: boolean, localizedErrorMessage: string, displayName: string, fullDisplayName: string, kind: string, kindModifiers: string, triggerSpan: { start; length } } - */ - getRenameInfo(fileName: string, position: number): string; - /** - * Returns a JSON-encoded value of the type: - * { fileName: string, textSpan: { start: number, length: number } }[] - */ - findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): string; - /** - * Returns a JSON-encoded value of the type: - * { fileName: string; textSpan: { start: number; length: number}; kind: string; name: string; containerKind: string; containerName: string } - * - * Or undefined value if no definition can be found. - */ - getDefinitionAtPosition(fileName: string, position: number): string; - getDefinitionAndBoundSpan(fileName: string, position: number): string; - /** - * Returns a JSON-encoded value of the type: - * { fileName: string; textSpan: { start: number; length: number}; kind: string; name: string; containerKind: string; containerName: string } - * - * Or undefined value if no definition can be found. - */ - getTypeDefinitionAtPosition(fileName: string, position: number): string; - /** - * Returns a JSON-encoded value of the type: - * { fileName: string; textSpan: { start: number; length: number}; }[] - */ - getImplementationAtPosition(fileName: string, position: number): string; - /** - * Returns a JSON-encoded value of the type: - * { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean, isDefinition?: boolean }[] - */ - getReferencesAtPosition(fileName: string, position: number): string; - /** - * Returns a JSON-encoded value of the type: - * { definition: ; references: [] }[] - */ - findReferences(fileName: string, position: number): string; - /** - * @deprecated - * Returns a JSON-encoded value of the type: - * { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[] - */ - getOccurrencesAtPosition(fileName: string, position: number): string; - /** - * Returns a JSON-encoded value of the type: - * { fileName: string; highlights: { start: number; length: number, isDefinition: boolean }[] }[] - * - * @param fileToSearch A JSON encoded string[] containing the file names that should be - * considered when searching. - */ - getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string; - /** - * Returns a JSON-encoded value of the type: - * { name: string; kind: string; kindModifiers: string; containerName: string; containerKind: string; matchKind: string; fileName: string; textSpan: { start: number; length: number}; } [] = []; - */ - getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string): string; - /** - * Returns a JSON-encoded value of the type: - * { text: string; kind: string; kindModifiers: string; bolded: boolean; grayed: boolean; indent: number; spans: { start: number; length: number; }[]; childItems: [] } [] = []; - */ - getNavigationBarItems(fileName: string): string; - /** Returns a JSON-encoded value of the type ts.NavigationTree. */ - getNavigationTree(fileName: string): string; - /** - * Returns a JSON-encoded value of the type: - * { textSpan: { start: number, length: number }; hintSpan: { start: number, length: number }; bannerText: string; autoCollapse: boolean } [] = []; - */ - getOutliningSpans(fileName: string): string; - getTodoComments(fileName: string, todoCommentDescriptors: string): string; - getBraceMatchingAtPosition(fileName: string, position: number): string; - getIndentationAtPosition(fileName: string, position: number, options: string): string; - getFormattingEditsForRange(fileName: string, start: number, end: number, options: string): string; - getFormattingEditsForDocument(fileName: string, options: string): string; - getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: string): string; - /** - * Returns JSON-encoded value of the type TextInsertion. - */ - getDocCommentTemplateAtPosition(fileName: string, position: number): string; - /** - * Returns JSON-encoded boolean to indicate whether we should support brace location - * at the current position. - * E.g. we don't want brace completion inside string-literals, comments, etc. - */ - isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): string; - /** - * Returns a JSON-encoded TextSpan | undefined indicating the range of the enclosing comment, if it exists. - */ - getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): string; - getEmitOutput(fileName: string): string; - getEmitOutputObject(fileName: string): EmitOutput; - } - interface ClassifierShim extends Shim { - getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; - getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; - } - interface CoreServicesShim extends Shim { - getAutomaticTypeDirectiveNames(compilerOptionsJson: string): string; - getPreProcessedFileInfo(fileName: string, sourceText: IScriptSnapshot): string; - getTSConfigFileInfo(fileName: string, sourceText: IScriptSnapshot): string; - getDefaultCompilationSettings(): string; - discoverTypings(discoverTypingsJson: string): string; - } - class LanguageServiceShimHostAdapter implements LanguageServiceHost { - private shimHost; - private files; - private loggingEnabled; - private tracingEnabled; - resolveModuleNames: (moduleName: string[], containingFile: string) => ResolvedModuleFull[]; - resolveTypeReferenceDirectives: (typeDirectiveNames: string[], containingFile: string) => ResolvedTypeReferenceDirective[]; - directoryExists: (directoryName: string) => boolean; - constructor(shimHost: LanguageServiceShimHost); - log(s: string): void; - trace(s: string): void; - error(s: string): void; - getProjectVersion(): string; - getTypeRootsVersion(): number; - useCaseSensitiveFileNames(): boolean; - getCompilationSettings(): CompilerOptions; - getScriptFileNames(): string[]; - getScriptSnapshot(fileName: string): IScriptSnapshot | undefined; - getScriptKind(fileName: string): ScriptKind; - getScriptVersion(fileName: string): string; - getLocalizedDiagnosticMessages(): any; - getCancellationToken(): HostCancellationToken; - getCurrentDirectory(): string; - getDirectories(path: string): string[]; - getDefaultLibFileName(options: CompilerOptions): string; - readDirectory(path: string, extensions?: ReadonlyArray, exclude?: string[], include?: string[], depth?: number): string[]; - readFile(path: string, encoding?: string): string | undefined; - fileExists(path: string): boolean; - } - class CoreServicesShimHostAdapter implements ParseConfigHost, ModuleResolutionHost, JsTyping.TypingResolutionHost { - private shimHost; - directoryExists: (directoryName: string) => boolean; - realpath: (path: string) => string; - useCaseSensitiveFileNames: boolean; - constructor(shimHost: CoreServicesShimHost); - readDirectory(rootDir: string, extensions: ReadonlyArray, exclude: ReadonlyArray, include: ReadonlyArray, depth?: number): string[]; - fileExists(fileName: string): boolean; - readFile(fileName: string): string | undefined; - getDirectories(path: string): string[]; - } - interface RealizedDiagnostic { - message: string; - start: number; - length: number; - category: string; - code: number; - reportsUnnecessary?: {}; - } - function realizeDiagnostics(diagnostics: ReadonlyArray, newLine: string): RealizedDiagnostic[]; - class TypeScriptServicesFactory implements ShimFactory { - private _shims; - private documentRegistry; - getServicesVersion(): string; - createLanguageServiceShim(host: LanguageServiceShimHost): LanguageServiceShim; - createClassifierShim(logger: Logger): ClassifierShim; - createCoreServicesShim(host: CoreServicesShimHost): CoreServicesShim; - close(): void; - registerShim(shim: Shim): void; - unregisterShim(shim: Shim): void; - } -} -declare namespace TypeScript.Services { - const TypeScriptServicesFactory: typeof ts.TypeScriptServicesFactory; -} -declare const toolsVersion = "3.0"; -//# sourceMappingURL=services.d.ts.map declare namespace ts.server { interface CompressedData { length: number; @@ -12160,6 +5710,7 @@ declare namespace ts.server { Perf = "Perf" } namespace Msg { + /** @deprecated Only here for backwards-compatibility. Prefer just `Msg`. */ type Types = Msg; } function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, cachePath?: string): DiscoverTypings; @@ -12184,10 +5735,16 @@ declare namespace ts.server { function createNormalizedPathMap(): NormalizedPathMap; interface ProjectOptions { configHasExtendsProperty: boolean; + /** + * true if config file explicitly listed files + */ configHasFilesProperty: boolean; configHasIncludeProperty: boolean; configHasExcludeProperty: boolean; projectReferences: ReadonlyArray | undefined; + /** + * these fields can be present in the project file + */ files?: string[]; wildcardDirectories?: Map; compilerOptions?: CompilerOptions; @@ -12198,87 +5755,49 @@ declare namespace ts.server { function makeInferredProjectName(counter: number): string; function createSortedArray(): SortedArray; } -declare namespace ts.server { - class ThrottledOperations { - private readonly host; - private readonly pendingTimeouts; - private readonly logger?; - constructor(host: ServerHost, logger: Logger); - schedule(operationId: string, delay: number, cb: () => void): void; - private static run; - } - class GcTimer { - private readonly host; - private readonly delay; - private readonly logger; - private timerId; - constructor(host: ServerHost, delay: number, logger: Logger); - scheduleCollect(): void; - private static run; - } - function getBaseConfigFileName(configFilePath: NormalizedPath): "tsconfig.json" | "jsconfig.json" | undefined; - function removeSorted(array: SortedArray, remove: T, compare: Comparer): void; - function toSortedArray(arr: string[]): SortedArray; - function toSortedArray(arr: T[], comparer: Comparer): SortedArray; - function toDeduplicatedSortedArray(arr: string[]): SortedArray; - function indent(str: string): string; - function stringifyIndented(json: {}): string; -} +/** + * Declaration module describing the TypeScript Server protocol + */ declare namespace ts.server.protocol { enum CommandTypes { JsxClosingTag = "jsxClosingTag", Brace = "brace", - BraceFull = "brace-full", BraceCompletion = "braceCompletion", GetSpanOfEnclosingComment = "getSpanOfEnclosingComment", Change = "change", Close = "close", + /** @deprecated Prefer CompletionInfo -- see comment on CompletionsResponse */ Completions = "completions", CompletionInfo = "completionInfo", - CompletionsFull = "completions-full", CompletionDetails = "completionEntryDetails", - CompletionDetailsFull = "completionEntryDetails-full", CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList", CompileOnSaveEmitFile = "compileOnSaveEmitFile", Configure = "configure", Definition = "definition", - DefinitionFull = "definition-full", DefinitionAndBoundSpan = "definitionAndBoundSpan", - DefinitionAndBoundSpanFull = "definitionAndBoundSpan-full", Implementation = "implementation", - ImplementationFull = "implementation-full", Exit = "exit", Format = "format", Formatonkey = "formatonkey", - FormatFull = "format-full", - FormatonkeyFull = "formatonkey-full", - FormatRangeFull = "formatRange-full", Geterr = "geterr", GeterrForProject = "geterrForProject", SemanticDiagnosticsSync = "semanticDiagnosticsSync", SyntacticDiagnosticsSync = "syntacticDiagnosticsSync", SuggestionDiagnosticsSync = "suggestionDiagnosticsSync", NavBar = "navbar", - NavBarFull = "navbar-full", Navto = "navto", - NavtoFull = "navto-full", NavTree = "navtree", NavTreeFull = "navtree-full", + /** @deprecated */ Occurrences = "occurrences", DocumentHighlights = "documentHighlights", - DocumentHighlightsFull = "documentHighlights-full", Open = "open", Quickinfo = "quickinfo", - QuickinfoFull = "quickinfo-full", References = "references", - ReferencesFull = "references-full", Reload = "reload", Rename = "rename", - RenameInfoFull = "rename-full", - RenameLocationsFull = "renameLocations-full", Saveto = "saveto", SignatureHelp = "signatureHelp", - SignatureHelpFull = "signatureHelp-full", Status = "status", TypeDefinition = "typeDefinition", ProjectInfo = "projectInfo", @@ -12287,59 +5806,101 @@ declare namespace ts.server.protocol { OpenExternalProject = "openExternalProject", OpenExternalProjects = "openExternalProjects", CloseExternalProject = "closeExternalProject", - SynchronizeProjectList = "synchronizeProjectList", - ApplyChangedToOpenFiles = "applyChangedToOpenFiles", - EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full", - Cleanup = "cleanup", GetOutliningSpans = "getOutliningSpans", - GetOutliningSpansFull = "outliningSpans", TodoComments = "todoComments", Indentation = "indentation", DocCommentTemplate = "docCommentTemplate", - CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full", - NameOrDottedNameSpan = "nameOrDottedNameSpan", - BreakpointStatement = "breakpointStatement", CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects", GetCodeFixes = "getCodeFixes", - GetCodeFixesFull = "getCodeFixes-full", GetCombinedCodeFix = "getCombinedCodeFix", - GetCombinedCodeFixFull = "getCombinedCodeFix-full", ApplyCodeActionCommand = "applyCodeActionCommand", GetSupportedCodeFixes = "getSupportedCodeFixes", GetApplicableRefactors = "getApplicableRefactors", GetEditsForRefactor = "getEditsForRefactor", - GetEditsForRefactorFull = "getEditsForRefactor-full", OrganizeImports = "organizeImports", - OrganizeImportsFull = "organizeImports-full", - GetEditsForFileRename = "getEditsForFileRename", - GetEditsForFileRenameFull = "getEditsForFileRename-full" + GetEditsForFileRename = "getEditsForFileRename" } + /** + * A TypeScript Server message + */ interface Message { + /** + * Sequence number of the message + */ seq: number; + /** + * One of "request", "response", or "event" + */ type: "request" | "response" | "event"; } + /** + * Client-initiated request message + */ interface Request extends Message { type: "request"; + /** + * The command to execute + */ command: string; + /** + * Object containing arguments for the command + */ arguments?: any; } + /** + * Request to reload the project structure for all the opened files + */ interface ReloadProjectsRequest extends Message { command: CommandTypes.ReloadProjects; } + /** + * Server-initiated event message + */ interface Event extends Message { type: "event"; + /** + * Name of event + */ event: string; + /** + * Event-specific information + */ body?: any; } + /** + * Response by server to client request message. + */ interface Response extends Message { type: "response"; + /** + * Sequence number of the request message. + */ request_seq: number; + /** + * Outcome of the request. + */ success: boolean; + /** + * The command requested. + */ command: string; + /** + * If success === false, this should always be provided. + * Otherwise, may (or may not) contain a success message. + */ message?: string; + /** + * Contains message body if success === true. + */ body?: any; } + /** + * Arguments for FileRequest messages. + */ interface FileRequestArgs { + /** + * The file for the request (absolute pathname required). + */ file: string; projectFileName?: string; } @@ -12347,85 +5908,183 @@ declare namespace ts.server.protocol { command: CommandTypes.Status; } interface StatusResponseBody { + /** + * The TypeScript version (`ts.version`). + */ version: string; } + /** + * Response to StatusRequest + */ interface StatusResponse extends Response { body: StatusResponseBody; } + /** + * Requests a JS Doc comment template for a given position + */ interface DocCommentTemplateRequest extends FileLocationRequest { command: CommandTypes.DocCommentTemplate; } + /** + * Response to DocCommentTemplateRequest + */ interface DocCommandTemplateResponse extends Response { body?: TextInsertion; } + /** + * A request to get TODO comments from the file + */ interface TodoCommentRequest extends FileRequest { command: CommandTypes.TodoComments; arguments: TodoCommentRequestArgs; } + /** + * Arguments for TodoCommentRequest request. + */ interface TodoCommentRequestArgs extends FileRequestArgs { + /** + * Array of target TodoCommentDescriptors that describes TODO comments to be found + */ descriptors: TodoCommentDescriptor[]; } + /** + * Response for TodoCommentRequest request. + */ interface TodoCommentsResponse extends Response { body?: TodoComment[]; } + /** + * A request to determine if the caret is inside a comment. + */ interface SpanOfEnclosingCommentRequest extends FileLocationRequest { command: CommandTypes.GetSpanOfEnclosingComment; arguments: SpanOfEnclosingCommentRequestArgs; } interface SpanOfEnclosingCommentRequestArgs extends FileLocationRequestArgs { + /** + * Requires that the enclosing span be a multi-line comment, or else the request returns undefined. + */ onlyMultiLine: boolean; } + /** + * Request to obtain outlining spans in file. + */ interface OutliningSpansRequest extends FileRequest { command: CommandTypes.GetOutliningSpans; } interface OutliningSpan { + /** The span of the document to actually collapse. */ textSpan: TextSpan; + /** The span of the document to display when the user hovers over the collapsed span. */ hintSpan: TextSpan; + /** The text to display in the editor for the collapsed region. */ bannerText: string; + /** + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ autoCollapse: boolean; + /** + * Classification of the contents of the span + */ kind: OutliningSpanKind; } + /** + * Response to OutliningSpansRequest request. + */ interface OutliningSpansResponse extends Response { body?: OutliningSpan[]; } - interface OutliningSpansRequestFull extends FileRequest { - command: CommandTypes.GetOutliningSpansFull; - } - interface OutliningSpansResponseFull extends Response { - body?: ts.OutliningSpan[]; - } + /** + * A request to get indentation for a location in file + */ interface IndentationRequest extends FileLocationRequest { command: CommandTypes.Indentation; arguments: IndentationRequestArgs; } + /** + * Response for IndentationRequest request. + */ interface IndentationResponse extends Response { body?: IndentationResult; } + /** + * Indentation result representing where indentation should be placed + */ interface IndentationResult { + /** + * The base position in the document that the indent should be relative to + */ position: number; + /** + * The number of columns the indent should be at relative to the position's column. + */ indentation: number; } + /** + * Arguments for IndentationRequest request. + */ interface IndentationRequestArgs extends FileLocationRequestArgs { + /** + * An optional set of settings to be used when computing indentation. + * If argument is omitted - then it will use settings for file that were previously set via 'configure' request or global settings. + */ options?: EditorSettings; } + /** + * Arguments for ProjectInfoRequest request. + */ interface ProjectInfoRequestArgs extends FileRequestArgs { + /** + * Indicate if the file name list of the project is needed + */ needFileNameList: boolean; } + /** + * A request to get the project information of the current file. + */ interface ProjectInfoRequest extends Request { command: CommandTypes.ProjectInfo; arguments: ProjectInfoRequestArgs; } + /** + * A request to retrieve compiler options diagnostics for a project + */ interface CompilerOptionsDiagnosticsRequest extends Request { arguments: CompilerOptionsDiagnosticsRequestArgs; } + /** + * Arguments for CompilerOptionsDiagnosticsRequest request. + */ interface CompilerOptionsDiagnosticsRequestArgs { + /** + * Name of the project to retrieve compiler options diagnostics. + */ projectFileName: string; } + /** + * Response message body for "projectInfo" request + */ interface ProjectInfo { + /** + * For configured project, this is the normalized path of the 'tsconfig.json' file + * For inferred project, this is undefined + */ configFileName: string; + /** + * The list of normalized file name in the project, including 'lib.d.ts' + */ fileNames?: string[]; + /** + * Indicates if the project has a active language service instance + */ languageServiceDisabled?: boolean; } + /** + * Represents diagnostic info that includes location of diagnostic in two forms + * - start position and length of the error span + * - startLocation and endLocation - a pair of Location objects that store start/end line and offset of the error span. + */ interface DiagnosticWithLinePosition { message: string; start: number; @@ -12434,43 +6093,99 @@ declare namespace ts.server.protocol { endLocation: Location; category: string; code: number; + /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ reportsUnnecessary?: {}; relatedInformation?: DiagnosticRelatedInformation[]; } + /** + * Response message for "projectInfo" request + */ interface ProjectInfoResponse extends Response { body?: ProjectInfo; } + /** + * Request whose sole parameter is a file name. + */ interface FileRequest extends Request { arguments: FileRequestArgs; } + /** + * Instances of this interface specify a location in a source file: + * (file, line, character offset), where line and character offset are 1-based. + */ interface FileLocationRequestArgs extends FileRequestArgs { + /** + * The line number for the request (1-based). + */ line: number; + /** + * The character offset (on the line) for the request (1-based). + */ offset: number; - position?: number; } type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs; + /** + * Request refactorings at a given position or selection area. + */ interface GetApplicableRefactorsRequest extends Request { command: CommandTypes.GetApplicableRefactors; arguments: GetApplicableRefactorsRequestArgs; } type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs; + /** + * Response is a list of available refactorings. + * Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring + */ interface GetApplicableRefactorsResponse extends Response { body?: ApplicableRefactorInfo[]; } + /** + * A set of one or more available refactoring actions, grouped under a parent refactoring. + */ interface ApplicableRefactorInfo { + /** + * The programmatic name of the refactoring + */ name: string; + /** + * A description of this refactoring category to show to the user. + * If the refactoring gets inlined (see below), this text will not be visible. + */ description: string; + /** + * Inlineable refactorings can have their actions hoisted out to the top level + * of a context menu. Non-inlineanable refactorings should always be shown inside + * their parent grouping. + * + * If not specified, this value is assumed to be 'true' + */ inlineable?: boolean; actions: RefactorActionInfo[]; } + /** + * Represents a single refactoring action - for example, the "Extract Method..." refactor might + * offer several actions, each corresponding to a surround class or closure to extract into. + */ interface RefactorActionInfo { + /** + * The programmatic name of the refactoring action + */ name: string; + /** + * A description of this refactoring action to show to the user. + * If the parent refactoring is inlined away, this will be the only text shown, + * so this description should make sense by itself if the parent is inlineable=true + */ description: string; } interface GetEditsForRefactorRequest extends Request { command: CommandTypes.GetEditsForRefactor; arguments: GetEditsForRefactorRequestArgs; } + /** + * Request the edits that a particular refactoring action produces. + * Callers must specify the name of the refactor and the name of the action. + */ type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & { refactor: string; action: string; @@ -12480,9 +6195,19 @@ declare namespace ts.server.protocol { } interface RefactorEditInfo { edits: FileCodeEdits[]; + /** + * An optional location where the editor should start a rename operation once + * the refactoring edits have been applied + */ renameLocation?: Location; renameFilename?: string; } + /** + * Organize imports by: + * 1) Removing unused imports + * 2) Coalescing imports from the same module + * 3) Sorting imports + */ interface OrganizeImportsRequest extends Request { command: CommandTypes.OrganizeImports; arguments: OrganizeImportsRequestArgs; @@ -12498,6 +6223,7 @@ declare namespace ts.server.protocol { command: CommandTypes.GetEditsForFileRename; arguments: GetEditsForFileRenameRequestArgs; } + /** Note: Paths may also be directories. */ interface GetEditsForFileRenameRequestArgs { readonly oldFilePath: string; readonly newFilePath: string; @@ -12505,6 +6231,9 @@ declare namespace ts.server.protocol { interface GetEditsForFileRenameResponse extends Response { body: ReadonlyArray; } + /** + * Request for the available codefixes at a specific position. + */ interface CodeFixRequest extends Request { command: CommandTypes.GetCodeFixes; arguments: CodeFixRequestArgs; @@ -12523,14 +6252,30 @@ declare namespace ts.server.protocol { interface ApplyCodeActionCommandResponse extends Response { } interface FileRangeRequestArgs extends FileRequestArgs { + /** + * The line number for the request (1-based). + */ startLine: number; + /** + * The character offset (on the line) for the request (1-based). + */ startOffset: number; - startPosition?: number; + /** + * The line number for the request (1-based). + */ endLine: number; + /** + * The character offset (on the line) for the request (1-based). + */ endOffset: number; - endPosition?: number; } + /** + * Instances of this interface specify errorcodes on a specific location in a sourcefile. + */ interface CodeFixRequestArgs extends FileRangeRequestArgs { + /** + * Errorcodes we want to get the fixes for. + */ errorCodes?: ReadonlyArray; } interface GetCombinedCodeFixRequestArgs { @@ -12542,71 +6287,151 @@ declare namespace ts.server.protocol { args: FileRequestArgs; } interface ApplyCodeActionCommandRequestArgs { + /** May also be an array of commands. */ command: {}; } + /** + * Response for GetCodeFixes request. + */ interface GetCodeFixesResponse extends Response { body?: CodeAction[]; } + /** + * A request whose arguments specify a file location (file, line, col). + */ interface FileLocationRequest extends FileRequest { arguments: FileLocationRequestArgs; } + /** + * A request to get codes of supported code fixes. + */ interface GetSupportedCodeFixesRequest extends Request { command: CommandTypes.GetSupportedCodeFixes; } + /** + * A response for GetSupportedCodeFixesRequest request. + */ interface GetSupportedCodeFixesResponse extends Response { + /** + * List of error codes supported by the server. + */ body?: string[]; } - interface EncodedSemanticClassificationsRequest extends FileRequest { - arguments: EncodedSemanticClassificationsRequestArgs; - } + /** + * Arguments for EncodedSemanticClassificationsRequest request. + */ interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs { + /** + * Start position of the span. + */ start: number; + /** + * Length of the span. + */ length: number; } + /** + * Arguments in document highlight request; include: filesToSearch, file, + * line, offset. + */ interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { + /** + * List of files to search for document highlights. + */ filesToSearch: string[]; } + /** + * Go to definition request; value of command field is + * "definition". Return response giving the file locations that + * define the symbol found in file at location line, col. + */ interface DefinitionRequest extends FileLocationRequest { command: CommandTypes.Definition; } + /** + * Go to type request; value of command field is + * "typeDefinition". Return response giving the file locations that + * define the type for the symbol found in file at location line, col. + */ interface TypeDefinitionRequest extends FileLocationRequest { command: CommandTypes.TypeDefinition; } + /** + * Go to implementation request; value of command field is + * "implementation". Return response giving the file locations that + * implement the symbol found in file at location line, col. + */ interface ImplementationRequest extends FileLocationRequest { command: CommandTypes.Implementation; } + /** + * Location in source code expressed as (one-based) line and (one-based) column offset. + */ interface Location { line: number; offset: number; } + /** + * Object found in response messages defining a span of text in source code. + */ interface TextSpan { + /** + * First character of the definition. + */ start: Location; + /** + * One character past last character of the definition. + */ end: Location; } + /** + * Object found in response messages defining a span of text in a specific source file. + */ interface FileSpan extends TextSpan { + /** + * File containing text span. + */ file: string; } interface DefinitionInfoAndBoundSpan { definitions: ReadonlyArray; textSpan: TextSpan; } + /** + * Definition response message. Gives text range for definition. + */ interface DefinitionResponse extends Response { body?: FileSpan[]; } interface DefinitionInfoAndBoundSpanReponse extends Response { body?: DefinitionInfoAndBoundSpan; } + /** + * Definition response message. Gives text range for definition. + */ interface TypeDefinitionResponse extends Response { body?: FileSpan[]; } + /** + * Implementation response message. Gives text range for implementations. + */ interface ImplementationResponse extends Response { body?: FileSpan[]; } + /** + * Request to get brace completion for a location in the file. + */ interface BraceCompletionRequest extends FileLocationRequest { command: CommandTypes.BraceCompletion; arguments: BraceCompletionRequestArgs; } + /** + * Argument for BraceCompletionRequest request. + */ interface BraceCompletionRequestArgs extends FileLocationRequestArgs { + /** + * Kind of opening brace + */ openingBrace: string; } interface JsxClosingTagRequest extends FileLocationRequest { @@ -12618,240 +6443,596 @@ declare namespace ts.server.protocol { interface JsxClosingTagResponse extends Response { readonly body: TextInsertion; } + /** + * @deprecated + * Get occurrences request; value of command field is + * "occurrences". Return response giving spans that are relevant + * in the file at a given line and column. + */ interface OccurrencesRequest extends FileLocationRequest { command: CommandTypes.Occurrences; } + /** @deprecated */ interface OccurrencesResponseItem extends FileSpan { + /** + * True if the occurrence is a write location, false otherwise. + */ isWriteAccess: boolean; + /** + * True if the occurrence is in a string, undefined otherwise; + */ isInString?: true; } + /** @deprecated */ interface OccurrencesResponse extends Response { body?: OccurrencesResponseItem[]; } + /** + * Get document highlights request; value of command field is + * "documentHighlights". Return response giving spans that are relevant + * in the file at a given line and column. + */ interface DocumentHighlightsRequest extends FileLocationRequest { command: CommandTypes.DocumentHighlights; arguments: DocumentHighlightsRequestArgs; } + /** + * Span augmented with extra information that denotes the kind of the highlighting to be used for span. + */ interface HighlightSpan extends TextSpan { kind: HighlightSpanKind; } + /** + * Represents a set of highligh spans for a give name + */ interface DocumentHighlightsItem { + /** + * File containing highlight spans. + */ file: string; + /** + * Spans to highlight in file. + */ highlightSpans: HighlightSpan[]; } + /** + * Response for a DocumentHighlightsRequest request. + */ interface DocumentHighlightsResponse extends Response { body?: DocumentHighlightsItem[]; } + /** + * Find references request; value of command field is + * "references". Return response giving the file locations that + * reference the symbol found in file at location line, col. + */ interface ReferencesRequest extends FileLocationRequest { command: CommandTypes.References; } interface ReferencesResponseItem extends FileSpan { + /** Text of line containing the reference. Including this + * with the response avoids latency of editor loading files + * to show text of reference line (the server already has + * loaded the referencing files). + */ lineText: string; + /** + * True if reference is a write location, false otherwise. + */ isWriteAccess: boolean; + /** + * True if reference is a definition, false otherwise. + */ isDefinition: boolean; } + /** + * The body of a "references" response message. + */ interface ReferencesResponseBody { + /** + * The file locations referencing the symbol. + */ refs: ReferencesResponseItem[]; + /** + * The name of the symbol. + */ symbolName: string; + /** + * The start character offset of the symbol (on the line provided by the references request). + */ symbolStartOffset: number; + /** + * The full display name of the symbol. + */ symbolDisplayString: string; } + /** + * Response to "references" request. + */ interface ReferencesResponse extends Response { body?: ReferencesResponseBody; } + /** + * Argument for RenameRequest request. + */ interface RenameRequestArgs extends FileLocationRequestArgs { + /** + * Should text at specified location be found/changed in comments? + */ findInComments?: boolean; + /** + * Should text at specified location be found/changed in strings? + */ findInStrings?: boolean; } + /** + * Rename request; value of command field is "rename". Return + * response giving the file locations that reference the symbol + * found in file at location line, col. Also return full display + * name of the symbol so that client can print it unambiguously. + */ interface RenameRequest extends FileLocationRequest { command: CommandTypes.Rename; arguments: RenameRequestArgs; } + /** + * Information about the item to be renamed. + */ interface RenameInfo { + /** + * True if item can be renamed. + */ canRename: boolean; + /** + * Error message if item can not be renamed. + */ localizedErrorMessage?: string; + /** + * Display name of the item to be renamed. + */ displayName: string; + /** + * Full display name of item to be renamed. + */ fullDisplayName: string; + /** + * The items's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: ScriptElementKind; + /** + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; } + /** + * A group of text spans, all in 'file'. + */ interface SpanGroup { + /** The file to which the spans apply */ file: string; + /** The text spans in this group */ locs: TextSpan[]; } interface RenameResponseBody { + /** + * Information about the item to be renamed. + */ info: RenameInfo; + /** + * An array of span groups (one per file) that refer to the item to be renamed. + */ locs: ReadonlyArray; } + /** + * Rename response message. + */ interface RenameResponse extends Response { body?: RenameResponseBody; } + /** + * Represents a file in external project. + * External project is project whose set of files, compilation options and open\close state + * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio). + * External project will exist even if all files in it are closed and should be closed explicitly. + * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will + * create configured project for every config file but will maintain a link that these projects were created + * as a result of opening external project so they should be removed once external project is closed. + */ interface ExternalFile { + /** + * Name of file file + */ fileName: string; + /** + * Script kind of the file + */ scriptKind?: ScriptKindName | ts.ScriptKind; + /** + * Whether file has mixed content (i.e. .cshtml file that combines html markup with C#/JavaScript) + */ hasMixedContent?: boolean; + /** + * Content of the file + */ content?: string; } + /** + * Represent an external project + */ interface ExternalProject { + /** + * Project name + */ projectFileName: string; + /** + * List of root files in project + */ rootFiles: ExternalFile[]; + /** + * Compiler options for the project + */ options: ExternalProjectCompilerOptions; + /** + * @deprecated typingOptions. Use typeAcquisition instead + */ typingOptions?: TypeAcquisition; + /** + * Explicitly specified type acquisition for the project + */ typeAcquisition?: TypeAcquisition; } interface CompileOnSaveMixin { + /** + * If compile on save is enabled for the project + */ compileOnSave?: boolean; } + /** + * For external projects, some of the project settings are sent together with + * compiler settings. + */ type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin; - interface ProjectVersionInfo { - projectName: string; - isInferred: boolean; - version: number; - options: ts.CompilerOptions; - languageServiceDisabled: boolean; - lastFileExceededProgramSize?: string; - } + /** + * Represents a set of changes that happen in project + */ interface ProjectChanges { + /** + * List of added files + */ added: string[]; + /** + * List of removed files + */ removed: string[]; + /** + * List of updated files + */ updated: string[]; } - interface ProjectFiles { - info?: ProjectVersionInfo; - files?: string[]; - changes?: ProjectChanges; - } - interface ProjectFilesWithDiagnostics extends ProjectFiles { - projectErrors: DiagnosticWithLinePosition[]; - } - interface ChangedOpenFile { - fileName: string; - changes: ts.TextChange[]; - } + /** + * Information found in a configure request. + */ interface ConfigureRequestArguments { + /** + * Information about the host, for example 'Emacs 24.4' or + * 'Sublime Text version 3075' + */ hostInfo?: string; + /** + * If present, tab settings apply only to this file. + */ file?: string; + /** + * The format options to use during formatting and other code editing features. + */ formatOptions?: FormatCodeSettings; preferences?: UserPreferences; + /** + * The host's additional supported .js file extensions + */ extraFileExtensions?: FileExtensionInfo[]; } + /** + * Configure request; value of command field is "configure". Specifies + * host information, such as host type, tab size, and indent size. + */ interface ConfigureRequest extends Request { command: CommandTypes.Configure; arguments: ConfigureRequestArguments; } + /** + * Response to "configure" request. This is just an acknowledgement, so + * no body field is required. + */ interface ConfigureResponse extends Response { } + /** + * Information found in an "open" request. + */ interface OpenRequestArgs extends FileRequestArgs { + /** + * Used when a version of the file content is known to be more up to date than the one on disk. + * Then the known content will be used upon opening instead of the disk copy + */ fileContent?: string; + /** + * Used to specify the script kind of the file explicitly. It could be one of the following: + * "TS", "JS", "TSX", "JSX" + */ scriptKindName?: ScriptKindName; + /** + * Used to limit the searching for project config file. If given the searching will stop at this + * root path; otherwise it will go all the way up to the dist root path. + */ projectRootPath?: string; } type ScriptKindName = "TS" | "JS" | "TSX" | "JSX"; + /** + * Open request; value of command field is "open". Notify the + * server that the client has file open. The server will not + * monitor the filesystem for changes in this file and will assume + * that the client is updating the server (using the change and/or + * reload messages) when the file changes. Server does not currently + * send a response to an open request. + */ interface OpenRequest extends Request { command: CommandTypes.Open; arguments: OpenRequestArgs; } + /** + * Request to open or update external project + */ interface OpenExternalProjectRequest extends Request { command: CommandTypes.OpenExternalProject; arguments: OpenExternalProjectArgs; } + /** + * Arguments to OpenExternalProjectRequest request + */ type OpenExternalProjectArgs = ExternalProject; + /** + * Request to open multiple external projects + */ interface OpenExternalProjectsRequest extends Request { command: CommandTypes.OpenExternalProjects; arguments: OpenExternalProjectsArgs; } + /** + * Arguments to OpenExternalProjectsRequest + */ interface OpenExternalProjectsArgs { + /** + * List of external projects to open or update + */ projects: ExternalProject[]; } + /** + * Response to OpenExternalProjectRequest request. This is just an acknowledgement, so + * no body field is required. + */ interface OpenExternalProjectResponse extends Response { } + /** + * Response to OpenExternalProjectsRequest request. This is just an acknowledgement, so + * no body field is required. + */ interface OpenExternalProjectsResponse extends Response { } + /** + * Request to close external project. + */ interface CloseExternalProjectRequest extends Request { command: CommandTypes.CloseExternalProject; arguments: CloseExternalProjectRequestArgs; } + /** + * Arguments to CloseExternalProjectRequest request + */ interface CloseExternalProjectRequestArgs { + /** + * Name of the project to close + */ projectFileName: string; } + /** + * Response to CloseExternalProjectRequest request. This is just an acknowledgement, so + * no body field is required. + */ interface CloseExternalProjectResponse extends Response { } - interface SynchronizeProjectListRequest extends Request { - arguments: SynchronizeProjectListRequestArgs; - } - interface SynchronizeProjectListRequestArgs { - knownProjects: protocol.ProjectVersionInfo[]; - } - interface ApplyChangedToOpenFilesRequest extends Request { - arguments: ApplyChangedToOpenFilesRequestArgs; - } - interface ApplyChangedToOpenFilesRequestArgs { - openFiles?: ExternalFile[]; - changedFiles?: ChangedOpenFile[]; - closedFiles?: string[]; - } + /** + * Request to set compiler options for inferred projects. + * External projects are opened / closed explicitly. + * Configured projects are opened when user opens loose file that has 'tsconfig.json' or 'jsconfig.json' anywhere in one of containing folders. + * This configuration file will be used to obtain a list of files and configuration settings for the project. + * Inferred projects are created when user opens a loose file that is not the part of external project + * or configured project and will contain only open file and transitive closure of referenced files if 'useOneInferredProject' is false, + * or all open loose files and its transitive closure of referenced files if 'useOneInferredProject' is true. + */ interface SetCompilerOptionsForInferredProjectsRequest extends Request { command: CommandTypes.CompilerOptionsForInferredProjects; arguments: SetCompilerOptionsForInferredProjectsArgs; } + /** + * Argument for SetCompilerOptionsForInferredProjectsRequest request. + */ interface SetCompilerOptionsForInferredProjectsArgs { + /** + * Compiler options to be used with inferred projects. + */ options: ExternalProjectCompilerOptions; + /** + * Specifies the project root path used to scope compiler options. + * It is an error to provide this property if the server has not been started with + * `useInferredProjectPerProjectRoot` enabled. + */ projectRootPath?: string; } + /** + * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so + * no body field is required. + */ interface SetCompilerOptionsForInferredProjectsResponse extends Response { } + /** + * Exit request; value of command field is "exit". Ask the server process + * to exit. + */ interface ExitRequest extends Request { command: CommandTypes.Exit; } + /** + * Close request; value of command field is "close". Notify the + * server that the client has closed a previously open file. If + * file is still referenced by open files, the server will resume + * monitoring the filesystem for changes to file. Server does not + * currently send a response to a close request. + */ interface CloseRequest extends FileRequest { command: CommandTypes.Close; } + /** + * Request to obtain the list of files that should be regenerated if target file is recompiled. + * NOTE: this us query-only operation and does not generate any output on disk. + */ interface CompileOnSaveAffectedFileListRequest extends FileRequest { command: CommandTypes.CompileOnSaveAffectedFileList; } + /** + * Contains a list of files that should be regenerated in a project + */ interface CompileOnSaveAffectedFileListSingleProject { + /** + * Project name + */ projectFileName: string; + /** + * List of files names that should be recompiled + */ fileNames: string[]; + /** + * true if project uses outFile or out compiler option + */ projectUsesOutFile: boolean; } + /** + * Response for CompileOnSaveAffectedFileListRequest request; + */ interface CompileOnSaveAffectedFileListResponse extends Response { body: CompileOnSaveAffectedFileListSingleProject[]; } + /** + * Request to recompile the file. All generated outputs (.js, .d.ts or .js.map files) is written on disk. + */ interface CompileOnSaveEmitFileRequest extends FileRequest { command: CommandTypes.CompileOnSaveEmitFile; arguments: CompileOnSaveEmitFileRequestArgs; } + /** + * Arguments for CompileOnSaveEmitFileRequest + */ interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs { + /** + * if true - then file should be recompiled even if it does not have any changes. + */ forced?: boolean; } + /** + * Quickinfo request; value of command field is + * "quickinfo". Return response giving a quick type and + * documentation string for the symbol found in file at location + * line, col. + */ interface QuickInfoRequest extends FileLocationRequest { command: CommandTypes.Quickinfo; } + /** + * Body of QuickInfoResponse. + */ interface QuickInfoResponseBody { + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: ScriptElementKind; + /** + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; + /** + * Starting file location of symbol. + */ start: Location; + /** + * One past last character of symbol. + */ end: Location; + /** + * Type and kind of symbol. + */ displayString: string; + /** + * Documentation associated with symbol. + */ documentation: string; + /** + * JSDoc tags associated with symbol. + */ tags: JSDocTagInfo[]; } + /** + * Quickinfo response message. + */ interface QuickInfoResponse extends Response { body?: QuickInfoResponseBody; } + /** + * Arguments for format messages. + */ interface FormatRequestArgs extends FileLocationRequestArgs { + /** + * Last line of range for which to format text in file. + */ endLine: number; + /** + * Character offset on last line of range for which to format text in file. + */ endOffset: number; - endPosition?: number; + /** + * Format options to be used. + */ options?: FormatCodeSettings; } + /** + * Format request; value of command field is "format". Return + * response giving zero or more edit instructions. The edit + * instructions will be sorted in file order. Applying the edit + * instructions in reverse to file will result in correctly + * reformatted text. + */ interface FormatRequest extends FileLocationRequest { command: CommandTypes.Format; arguments: FormatRequestArgs; } + /** + * Object found in response messages defining an editing + * instruction for a span of text in source code. The effect of + * this instruction is to replace the text starting at start and + * ending one character before end with newText. For an insertion, + * the text span is empty. For a deletion, newText is empty. + */ interface CodeEdit { + /** + * First character of the text span to edit. + */ start: Location; + /** + * One character past last character of the text span to edit. + */ end: Location; + /** + * Replace the span defined above with this string (may be + * the empty string). + */ newText: string; } interface FileCodeEdits { @@ -12859,11 +7040,15 @@ declare namespace ts.server.protocol { textChanges: CodeEdit[]; } interface CodeFixResponse extends Response { + /** The code actions that are available */ body?: CodeFixAction[]; } interface CodeAction { + /** Description of the code action to display in the UI of the editor */ description: string; + /** Text changes to apply to each file as part of the code action */ changes: FileCodeEdits[]; + /** A command is an opaque object that should be passed to `ApplyCodeActionCommandRequestArgs` without modification. */ commands?: {}[]; } interface CombinedCodeActions { @@ -12871,68 +7056,196 @@ declare namespace ts.server.protocol { commands?: ReadonlyArray<{}>; } interface CodeFixAction extends CodeAction { + /** Short name to identify the fix, for use by telemetry. */ fixName: string; + /** + * If present, one may call 'getCombinedCodeFix' with this fixId. + * This may be omitted to indicate that the code fix can't be applied in a group. + */ fixId?: {}; + /** Should be present if and only if 'fixId' is. */ fixAllDescription?: string; } + /** + * Format and format on key response message. + */ interface FormatResponse extends Response { body?: CodeEdit[]; } + /** + * Arguments for format on key messages. + */ interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { + /** + * Key pressed (';', '\n', or '}'). + */ key: string; options?: FormatCodeSettings; } + /** + * Format on key request; value of command field is + * "formatonkey". Given file location and key typed (as string), + * return response giving zero or more edit instructions. The + * edit instructions will be sorted in file order. Applying the + * edit instructions in reverse to file will result in correctly + * reformatted text. + */ interface FormatOnKeyRequest extends FileLocationRequest { command: CommandTypes.Formatonkey; arguments: FormatOnKeyRequestArgs; } type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<"; + /** + * Arguments for completions messages. + */ interface CompletionsRequestArgs extends FileLocationRequestArgs { + /** + * Optional prefix to apply to possible completions. + */ prefix?: string; triggerCharacter?: CompletionsTriggerCharacter; + /** + * @deprecated Use UserPreferences.includeCompletionsForModuleExports + */ includeExternalModuleExports?: boolean; + /** + * @deprecated Use UserPreferences.includeCompletionsWithInsertText + */ includeInsertTextCompletions?: boolean; } + /** + * Completions request; value of command field is "completions". + * Given a file location (file, line, col) and a prefix (which may + * be the empty string), return the possible completions that + * begin with prefix. + */ interface CompletionsRequest extends FileLocationRequest { command: CommandTypes.Completions; arguments: CompletionsRequestArgs; } + /** + * Arguments for completion details request. + */ interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { + /** + * Names of one or more entries for which to obtain details. + */ entryNames: (string | CompletionEntryIdentifier)[]; } interface CompletionEntryIdentifier { name: string; source?: string; } + /** + * Completion entry details request; value of command field is + * "completionEntryDetails". Given a file location (file, line, + * col) and an array of completion entry names return more + * detailed information for each completion entry. + */ interface CompletionDetailsRequest extends FileLocationRequest { command: CommandTypes.CompletionDetails; arguments: CompletionDetailsRequestArgs; } + /** + * Part of a symbol description. + */ interface SymbolDisplayPart { + /** + * Text of an item describing the symbol. + */ text: string; + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: string; } + /** + * An item found in a completion response. + */ interface CompletionEntry { + /** + * The symbol's name. + */ name: string; + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: ScriptElementKind; + /** + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers?: string; + /** + * A string that is used for comparing completion items so that they can be ordered. This + * is often the same as the name but may be different in certain circumstances. + */ sortText: string; + /** + * Text to insert instead of `name`. + * This is used to support bracketed completions; If `name` might be "a-b" but `insertText` would be `["a-b"]`, + * coupled with `replacementSpan` to replace a dotted access with a bracket access. + */ insertText?: string; + /** + * An optional span that indicates the text to be replaced by this completion item. + * If present, this span should be used instead of the default one. + * It will be set if the required span differs from the one generated by the default replacement behavior. + */ replacementSpan?: TextSpan; + /** + * Indicates whether commiting this completion entry will require additional code actions to be + * made to avoid errors. The CompletionEntryDetails will have these actions. + */ hasAction?: true; + /** + * Identifier (not necessarily human-readable) identifying where this completion came from. + */ source?: string; + /** + * If true, this completion should be highlighted as recommended. There will only be one of these. + * This will be set when we know the user should write an expression with a certain type and that type is an enum or constructable class. + * Then either that enum/class or a namespace containing it will be the recommended symbol. + */ isRecommended?: true; } + /** + * Additional completion entry details, available on demand + */ interface CompletionEntryDetails { + /** + * The symbol's name. + */ name: string; + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: ScriptElementKind; + /** + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; + /** + * Display parts of the symbol (similar to quick info). + */ displayParts: SymbolDisplayPart[]; + /** + * Documentation strings for the symbol. + */ documentation?: SymbolDisplayPart[]; + /** + * JSDoc tags for the symbol. + */ tags?: JSDocTagInfo[]; + /** + * The associated code actions for this entry + */ codeActions?: CodeAction[]; + /** + * Human-readable description of the `source` from the CompletionEntry. + */ source?: SymbolDisplayPart[]; } + /** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */ interface CompletionsResponse extends Response { body?: CompletionEntry[]; } @@ -12948,37 +7261,108 @@ declare namespace ts.server.protocol { interface CompletionDetailsResponse extends Response { body?: CompletionEntryDetails[]; } + /** + * Signature help information for a single parameter + */ interface SignatureHelpParameter { + /** + * The parameter's name + */ name: string; + /** + * Documentation of the parameter. + */ documentation: SymbolDisplayPart[]; + /** + * Display parts of the parameter. + */ displayParts: SymbolDisplayPart[]; + /** + * Whether the parameter is optional or not. + */ isOptional: boolean; } + /** + * Represents a single signature to show in signature help. + */ interface SignatureHelpItem { + /** + * Whether the signature accepts a variable number of arguments. + */ isVariadic: boolean; + /** + * The prefix display parts. + */ prefixDisplayParts: SymbolDisplayPart[]; + /** + * The suffix display parts. + */ suffixDisplayParts: SymbolDisplayPart[]; + /** + * The separator display parts. + */ separatorDisplayParts: SymbolDisplayPart[]; + /** + * The signature helps items for the parameters. + */ parameters: SignatureHelpParameter[]; + /** + * The signature's documentation + */ documentation: SymbolDisplayPart[]; + /** + * The signature's JSDoc tags + */ tags: JSDocTagInfo[]; } + /** + * Signature help items found in the response of a signature help request. + */ interface SignatureHelpItems { + /** + * The signature help items. + */ items: SignatureHelpItem[]; + /** + * The span for which signature help should appear on a signature + */ applicableSpan: TextSpan; + /** + * The item selected in the set of available help items. + */ selectedItemIndex: number; + /** + * The argument selected in the set of parameters. + */ argumentIndex: number; + /** + * The argument count + */ argumentCount: number; } + /** + * Arguments of a signature help request. + */ interface SignatureHelpRequestArgs extends FileLocationRequestArgs { } + /** + * Signature help request; value of command field is "signatureHelp". + * Given a file location (file, line, col), return the signature + * help. + */ interface SignatureHelpRequest extends FileLocationRequest { command: CommandTypes.SignatureHelp; arguments: SignatureHelpRequestArgs; } + /** + * Response object for a SignatureHelpRequest. + */ interface SignatureHelpResponse extends Response { body?: SignatureHelpItems; } + /** + * Synchronous request for semantic diagnostics of one file. + */ interface SemanticDiagnosticsSyncRequest extends FileRequest { command: CommandTypes.SemanticDiagnosticsSync; arguments: SemanticDiagnosticsSyncRequestArgs; @@ -12986,6 +7370,9 @@ declare namespace ts.server.protocol { interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs { includeLinePosition?: boolean; } + /** + * Response object for synchronous sematic diagnostics request. + */ interface SemanticDiagnosticsSyncResponse extends Response { body?: Diagnostic[] | DiagnosticWithLinePosition[]; } @@ -12995,6 +7382,9 @@ declare namespace ts.server.protocol { } type SuggestionDiagnosticsSyncRequestArgs = SemanticDiagnosticsSyncRequestArgs; type SuggestionDiagnosticsSyncResponse = SemanticDiagnosticsSyncResponse; + /** + * Synchronous request for syntactic diagnostics of one file. + */ interface SyntacticDiagnosticsSyncRequest extends FileRequest { command: CommandTypes.SyntacticDiagnosticsSync; arguments: SyntacticDiagnosticsSyncRequestArgs; @@ -13002,26 +7392,68 @@ declare namespace ts.server.protocol { interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs { includeLinePosition?: boolean; } + /** + * Response object for synchronous syntactic diagnostics request. + */ interface SyntacticDiagnosticsSyncResponse extends Response { body?: Diagnostic[] | DiagnosticWithLinePosition[]; } + /** + * Arguments for GeterrForProject request. + */ interface GeterrForProjectRequestArgs { + /** + * the file requesting project error list + */ file: string; + /** + * Delay in milliseconds to wait before starting to compute + * errors for the files in the file list + */ delay: number; } + /** + * GeterrForProjectRequest request; value of command field is + * "geterrForProject". It works similarly with 'Geterr', only + * it request for every file in this project. + */ interface GeterrForProjectRequest extends Request { command: CommandTypes.GeterrForProject; arguments: GeterrForProjectRequestArgs; } + /** + * Arguments for geterr messages. + */ interface GeterrRequestArgs { + /** + * List of file names for which to compute compiler errors. + * The files will be checked in list order. + */ files: string[]; + /** + * Delay in milliseconds to wait before starting to compute + * errors for the files in the file list + */ delay: number; } + /** + * Geterr request; value of command field is "geterr". Wait for + * delay milliseconds and then, if during the wait no change or + * reload messages have arrived for the first file in the files + * list, get the syntactic errors for the file, field requests, + * and then get the semantic errors for the file. Repeat with a + * smaller delay for each subsequent file on the files list. Best + * practice for an editor is to send a file list containing each + * file that is currently visible, in most-recently-used order. + */ interface GeterrRequest extends Request { command: CommandTypes.Geterr; arguments: GeterrRequestArgs; } type RequestCompletedEventName = "requestCompleted"; + /** + * Event that is sent when server have finished processing request with specified id. + */ interface RequestCompletedEvent extends Event { event: RequestCompletedEventName; body: RequestCompletedEventBody; @@ -13029,36 +7461,98 @@ declare namespace ts.server.protocol { interface RequestCompletedEventBody { request_seq: number; } + /** + * Item of diagnostic information found in a DiagnosticEvent message. + */ interface Diagnostic { + /** + * Starting file location at which text applies. + */ start: Location; + /** + * The last file location at which the text applies. + */ end: Location; + /** + * Text of diagnostic message. + */ text: string; + /** + * The category of the diagnostic message, e.g. "error", "warning", or "suggestion". + */ category: string; reportsUnnecessary?: {}; + /** + * Any related spans the diagnostic may have, such as other locations relevant to an error, such as declarartion sites + */ relatedInformation?: DiagnosticRelatedInformation[]; + /** + * The error code of the diagnostic message. + */ code?: number; + /** + * The name of the plugin reporting the message. + */ source?: string; } interface DiagnosticWithFileName extends Diagnostic { + /** + * Name of the file the diagnostic is in + */ fileName: string; } + /** + * Represents additional spans returned with a diagnostic which are relevant to it + * Like DiagnosticWithLinePosition, this is provided in two forms: + * - start and length of the span + * - startLocation and endLocation a pair of Location objects storing the start/end line offset of the span + */ interface DiagnosticRelatedInformation { + /** + * Text of related or additional information. + */ message: string; + /** + * Associated location + */ span?: FileSpan; } interface DiagnosticEventBody { + /** + * The file for which diagnostic information is reported. + */ file: string; + /** + * An array of diagnostic information items. + */ diagnostics: Diagnostic[]; } type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag"; + /** + * Event message for DiagnosticEventKind event types. + * These events provide syntactic and semantic errors for a file. + */ interface DiagnosticEvent extends Event { body?: DiagnosticEventBody; } interface ConfigFileDiagnosticEventBody { + /** + * The file which trigged the searching and error-checking of the config file + */ triggerFile: string; + /** + * The name of the found config file. + */ configFile: string; + /** + * An arry of diagnostic information items for the found config file. + */ diagnostics: DiagnosticWithFileName[]; } + /** + * Event message for "configFileDiag" event type. + * This event provides errors for a found config file. + */ interface ConfigFileDiagnosticEvent extends Event { body?: ConfigFileDiagnosticEventBody; event: "configFileDiag"; @@ -13069,7 +7563,17 @@ declare namespace ts.server.protocol { body?: ProjectLanguageServiceStateEventBody; } interface ProjectLanguageServiceStateEventBody { + /** + * Project name that has changes in the state of language service. + * For configured projects this will be the config file path. + * For external projects this will be the name of the projects specified when project was open. + * For inferred projects this event is not raised. + */ projectName: string; + /** + * True if language service state switched from disabled to enabled + * and false otherwise. + */ languageServiceEnabled: boolean; } type ProjectsUpdatedInBackgroundEventName = "projectsUpdatedInBackground"; @@ -13078,76 +7582,215 @@ declare namespace ts.server.protocol { body: ProjectsUpdatedInBackgroundEventBody; } interface ProjectsUpdatedInBackgroundEventBody { + /** + * Current set of open files + */ openFiles: string[]; } + /** + * Arguments for reload request. + */ interface ReloadRequestArgs extends FileRequestArgs { + /** + * Name of temporary file from which to reload file + * contents. May be same as file. + */ tmpfile: string; } + /** + * Reload request message; value of command field is "reload". + * Reload contents of file with name given by the 'file' argument + * from temporary file with name given by the 'tmpfile' argument. + * The two names can be identical. + */ interface ReloadRequest extends FileRequest { command: CommandTypes.Reload; arguments: ReloadRequestArgs; } + /** + * Response to "reload" request. This is just an acknowledgement, so + * no body field is required. + */ interface ReloadResponse extends Response { } + /** + * Arguments for saveto request. + */ interface SavetoRequestArgs extends FileRequestArgs { + /** + * Name of temporary file into which to save server's view of + * file contents. + */ tmpfile: string; } + /** + * Saveto request message; value of command field is "saveto". + * For debugging purposes, save to a temporaryfile (named by + * argument 'tmpfile') the contents of file named by argument + * 'file'. The server does not currently send a response to a + * "saveto" request. + */ interface SavetoRequest extends FileRequest { command: CommandTypes.Saveto; arguments: SavetoRequestArgs; } + /** + * Arguments for navto request message. + */ interface NavtoRequestArgs extends FileRequestArgs { + /** + * Search term to navigate to from current location; term can + * be '.*' or an identifier prefix. + */ searchValue: string; + /** + * Optional limit on the number of items to return. + */ maxResultCount?: number; + /** + * Optional flag to indicate we want results for just the current file + * or the entire project. + */ currentFileOnly?: boolean; projectFileName?: string; } + /** + * Navto request message; value of command field is "navto". + * Return list of objects giving file locations and symbols that + * match the search term given in argument 'searchTerm'. The + * context for the search is given by the named file. + */ interface NavtoRequest extends FileRequest { command: CommandTypes.Navto; arguments: NavtoRequestArgs; } + /** + * An item found in a navto response. + */ interface NavtoItem { + /** + * The symbol's name. + */ name: string; + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: ScriptElementKind; + /** + * exact, substring, or prefix. + */ matchKind?: string; + /** + * If this was a case sensitive or insensitive match. + */ isCaseSensitive?: boolean; + /** + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers?: string; + /** + * The file in which the symbol is found. + */ file: string; + /** + * The location within file at which the symbol is found. + */ start: Location; + /** + * One past the last character of the symbol. + */ end: Location; + /** + * Name of symbol's container symbol (if any); for example, + * the class name if symbol is a class member. + */ containerName?: string; + /** + * Kind of symbol's container symbol (if any). + */ containerKind?: ScriptElementKind; } + /** + * Navto response message. Body is an array of navto items. Each + * item gives a symbol that matched the search term. + */ interface NavtoResponse extends Response { body?: NavtoItem[]; } + /** + * Arguments for change request message. + */ interface ChangeRequestArgs extends FormatRequestArgs { + /** + * Optional string to insert at location (file, line, offset). + */ insertString?: string; } + /** + * Change request message; value of command field is "change". + * Update the server's view of the file named by argument 'file'. + * Server does not currently send a response to a change request. + */ interface ChangeRequest extends FileLocationRequest { command: CommandTypes.Change; arguments: ChangeRequestArgs; } + /** + * Response to "brace" request. + */ interface BraceResponse extends Response { body?: TextSpan[]; } + /** + * Brace matching request; value of command field is "brace". + * Return response giving the file locations of matching braces + * found in file at location line, offset. + */ interface BraceRequest extends FileLocationRequest { command: CommandTypes.Brace; } + /** + * NavBar items request; value of command field is "navbar". + * Return response giving the list of navigation bar entries + * extracted from the requested file. + */ interface NavBarRequest extends FileRequest { command: CommandTypes.NavBar; } + /** + * NavTree request; value of command field is "navtree". + * Return response giving the navigation tree of the requested file. + */ interface NavTreeRequest extends FileRequest { command: CommandTypes.NavTree; } interface NavigationBarItem { + /** + * The item's display text. + */ text: string; + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: ScriptElementKind; + /** + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers?: string; + /** + * The definition locations of the item. + */ spans: TextSpan[]; + /** + * Optional children. + */ childItems?: NavigationBarItem[]; + /** + * Number of levels deep this item should appear. + */ indent: number; } + /** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */ interface NavigationTree { text: string; kind: ScriptElementKind; @@ -13179,8 +7822,17 @@ declare namespace ts.server.protocol { payload: TypingsInstalledTelemetryEventPayload; } interface TypingsInstalledTelemetryEventPayload { + /** + * Comma separated list of installed typing packages + */ installedPackages: string; + /** + * true if install request succeeded, otherwise - false + */ installSuccess: boolean; + /** + * version of typings installer + */ typingsInstallerVersion: string; } type BeginInstallTypesEventName = "beginInstallTypes"; @@ -13194,12 +7846,21 @@ declare namespace ts.server.protocol { body: EndInstallTypesEventBody; } interface InstallTypesEventBody { + /** + * correlation id to match begin and end events + */ eventId: number; + /** + * list of packages to install + */ packages: ReadonlyArray; } interface BeginInstallTypesEventBody extends InstallTypesEventBody { } interface EndInstallTypesEventBody extends InstallTypesEventBody { + /** + * true if installation succeeded, otherwise false + */ success: boolean; } interface NavBarResponse extends Response { @@ -13242,7 +7903,15 @@ declare namespace ts.server.protocol { interface UserPreferences { readonly disableSuggestions?: boolean; readonly quotePreference?: "double" | "single"; + /** + * If enabled, TypeScript will search through all external modules' exports and add them to the completions list. + * This affects lone identifier completions but not completions on the right hand side of `obj.`. + */ readonly includeCompletionsForModuleExports?: boolean; + /** + * If enabled, the completion list will include completions with invalid identifier names. + * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`. + */ readonly includeCompletionsWithInsertText?: boolean; readonly importModuleSpecifierPreference?: "relative" | "non-relative"; readonly allowTextChangesInNewFiles?: boolean; @@ -13314,6 +7983,7 @@ declare namespace ts.server.protocol { traceResolution?: boolean; resolveJsonModule?: boolean; types?: string[]; + /** Paths used to used to compute primary types search locations */ typeRoots?: string[]; [option: string]: CompilerOptionsValue | undefined; } @@ -13352,65 +8022,25 @@ declare namespace ts.server.protocol { } } declare namespace ts.server { - class TextStorage { - private readonly host; - private readonly fileName; - private svc; - private svcVersion; - private text; - private lineMap; - private textVersion; - isOpen: boolean; - private ownFileText; - private pendingReloadFromDisk; - constructor(host: ServerHost, fileName: NormalizedPath); - getVersion(): string; - hasScriptVersionCache_TestOnly(): boolean; - useScriptVersionCache_TestOnly(): void; - useText(newText?: string): void; - edit(start: number, end: number, newText: string): void; - reload(newText: string): true | undefined; - reloadWithFileText(tempFileName?: string): true | undefined; - reloadFromDisk(): boolean | undefined; - delayReloadFromFileIntoText(): void; - getSnapshot(): IScriptSnapshot; - getLineInfo(line: number): AbsolutePositionAndLineText; - lineToTextSpan(line: number): TextSpan; - lineOffsetToPosition(line: number, offset: number): number; - positionToLineOffset(position: number): protocol.Location; - private getFileText; - private switchToScriptVersionCache; - private useScriptVersionCacheIfValidOrOpen; - private getOrLoadText; - private getLineMap; - } - function isDynamicFileName(fileName: NormalizedPath): boolean; - interface DocumentRegistrySourceFileCache { - key: DocumentRegistryBucketKey; - sourceFile: SourceFile; - } class ScriptInfo { private readonly host; readonly fileName: NormalizedPath; readonly scriptKind: ScriptKind; readonly hasMixedContent: boolean; readonly path: Path; + /** + * All projects that include this file + */ readonly containingProjects: Project[]; private formatSettings; private preferences; - fileWatcher: FileWatcher | undefined; private textStorage; - readonly isDynamic: boolean; - private realpath; - cacheSourceFile: DocumentRegistrySourceFileCache; constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent: boolean, path: Path); - isDynamicOrHasMixedContent(): boolean; isScriptOpen(): boolean; open(newText: string): void; close(fileExists?: boolean): void; getSnapshot(): IScriptSnapshot; private ensureRealPath; - getRealpathIfDifferent(): Path | undefined; getFormatCodeSettings(): FormatCodeSettings | undefined; getPreferences(): UserPreferences | undefined; attachToProject(project: Project): boolean; @@ -13422,13 +8052,18 @@ declare namespace ts.server { setOptions(formatSettings: FormatCodeSettings, preferences: UserPreferences | undefined): void; getLatestVersion(): string; saveTo(fileName: string): void; - delayReloadNonMixedContentFile(): void; reloadFromFile(tempFileName?: NormalizedPath): void; - getLineInfo(line: number): AbsolutePositionAndLineText; editContent(start: number, end: number, newText: string): void; markContainingProjectsAsDirty(): void; isOrphan(): boolean; + /** + * @param line 1 based index + */ lineToTextSpan(line: number): TextSpan; + /** + * @param line 1 based index + * @param offset 1 based index + */ lineOffsetToPosition(line: number, offset: number): number; positionToLineOffset(position: number): protocol.Location; isJavaScript(): boolean; @@ -13448,16 +8083,6 @@ declare namespace ts.server { readonly globalTypingsCacheLocation: string | undefined; } const nullTypingsInstaller: ITypingsInstaller; - class TypingsCache { - private readonly installer; - private readonly perProjectCache; - constructor(installer: ITypingsInstaller); - isKnownTypesPackageName(name: string): boolean; - installPackage(options: InstallPackageOptionsWithProject): Promise; - enqueueInstallTypingsForProject(project: Project, unresolvedImports: SortedReadonlyArray | undefined, forceRefresh: boolean): void; - updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, newTypings: string[]): SortedReadonlyArray | SortedArray; - onProjectClosed(project: Project): void; - } } declare namespace ts.server { enum ProjectKind { @@ -13465,16 +8090,8 @@ declare namespace ts.server { Configured = 1, External = 2 } - type Mutable = { - -readonly [K in keyof T]: T[K]; - }; - function countEachFileTypes(infos: ScriptInfo[]): FileStats; function allRootFilesAreJsOrDts(project: Project): boolean; function allFilesAreJsOrDts(project: Project): boolean; - function hasNoTypeScriptSource(fileNames: string[]): boolean; - interface ProjectFilesWithTSDiagnostics extends protocol.ProjectFiles { - projectErrors: ReadonlyArray; - } interface PluginCreateInfo { project: Project; languageService: LanguageService; @@ -13489,8 +8106,11 @@ declare namespace ts.server { type PluginModuleFactory = (mod: { typescript: typeof ts; }) => PluginModule; + /** + * The project root can be script info - if root is present, + * or it could be just normalized path if root wasnt present on the host(only for non inferred project) + */ type ProjectRoot = ScriptInfo | NormalizedPath; - function isScriptInfo(value: ProjectRoot): value is ScriptInfo; abstract class Project implements LanguageServiceHost, ModuleResolutionHost { readonly projectName: string; readonly projectKind: ProjectKind; @@ -13504,33 +8124,40 @@ declare namespace ts.server { private externalFiles; private missingFilesMap; private plugins; - cachedUnresolvedImportsPerFile: Map>; - lastCachedUnresolvedImportsList: SortedReadonlyArray | undefined; - private hasAddedorRemovedFiles; private lastFileExceededProgramSize; protected languageService: LanguageService; languageServiceEnabled: boolean; readonly trace?: (s: string) => void; readonly realpath?: (path: string) => string; - hasInvalidatedResolution: HasInvalidatedResolution; - resolutionCache: ResolutionCache; private builderState; + /** + * Set of files names that were updated since the last call to getChangesSinceVersion. + */ private updatedFileNames; + /** + * Set of files that was returned from the last call to getChangesSinceVersion. + */ private lastReportedFileNames; + /** + * Last version that was reported. + */ private lastReportedVersion; + /** + * Current project's program version. (incremented everytime new program is created that is not complete reuse from the old one) + * This property is changed in 'updateGraph' based on the set of files in program + */ private projectProgramVersion; + /** + * Current version of the project state. It is changed when: + * - new root file was added/removed + * - edit happen in some file that is currently included in the project. + * This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project + */ private projectStateVersion; - dirty: boolean; - hasChangedAutomaticTypeDirectiveNames: boolean; - typingFiles: SortedReadonlyArray; private readonly cancellationToken; isNonTsProject(): boolean; isJsOnlyProject(): boolean; static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} | undefined; - readonly currentDirectory: string; - directoryStructureHost: DirectoryStructureHost; - readonly getCanonicalFileName: GetCanonicalFileName; - constructor(projectName: string, projectKind: ProjectKind, projectService: ProjectService, documentRegistry: DocumentRegistry, hasExplicitListOfFiles: boolean, lastFileExceededProgramSize: string | undefined, compilerOptions: CompilerOptions, compileOnSaveEnabled: boolean, directoryStructureHost: DirectoryStructureHost, currentDirectory: string | undefined); isKnownTypesPackageName(name: string): boolean; installPackage(options: InstallPackageOptions): Promise; private readonly typingsCache; @@ -13556,22 +8183,20 @@ declare namespace ts.server { resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; directoryExists(path: string): boolean; getDirectories(path: string): string[]; - getCachedDirectoryStructureHost(): CachedDirectoryStructureHost; - toPath(fileName: string): Path; - watchDirectoryOfFailedLookupLocation(directory: string, cb: DirectoryWatcherCallback, flags: WatchDirectoryFlags): FileWatcher; - onInvalidatedResolution(): void; - watchTypeRootsDirectory(directory: string, cb: DirectoryWatcherCallback, flags: WatchDirectoryFlags): FileWatcher; - onChangedAutomaticTypeDirectiveNames(): void; - getGlobalCache(): string | undefined; - writeLog(s: string): void; log(s: string): void; error(s: string): void; private setInternalCompilerOptionsForEmittingJsFiles; + /** + * Get the errors that dont have any file name associated + */ getGlobalProjectErrors(): ReadonlyArray; getAllProjectErrors(): ReadonlyArray; getLanguageService(ensureSynchronized?: boolean): LanguageService; private shouldEmitFile; getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[]; + /** + * Returns true if emit was conducted + */ emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): boolean; enableLanguageService(): void; disableLanguageService(lastFileExceededProgramSize?: string): void; @@ -13580,14 +8205,11 @@ declare namespace ts.server { protected removeLocalTypingsFromTypeAcquisition(newTypeAcquisition: TypeAcquisition): TypeAcquisition; getExternalFiles(): SortedReadonlyArray; getSourceFile(path: Path): SourceFile | undefined; - getSourceFileOrConfigFile(path: Path): SourceFile | undefined; close(): void; private detachScriptInfoIfNotRoot; isClosed(): boolean; hasRoots(): boolean; - isOrphan(): boolean; getRootFiles(): NormalizedPath[]; - getRootFilesMap(): Map; getRootScriptInfos(): ScriptInfo[]; getScriptInfos(): ScriptInfo[]; getExcludedFiles(): ReadonlyArray; @@ -13601,11 +8223,11 @@ declare namespace ts.server { removeFile(info: ScriptInfo, fileExists: boolean, detachFromProject: boolean): void; registerFileUpdate(fileName: string): void; markAsDirty(): void; - private extractUnresolvedImportsFromSourceFile; - onFileAddedOrRemoved(): void; + /** + * Updates set of files that contribute to this project + * @returns: true if set of files in the project stays the same and false - otherwise. + */ updateGraph(): boolean; - updateTypingFiles(typingFiles: SortedReadonlyArray): void; - getCurrentProgram(): Program; protected removeExistingTypings(include: string[]): string[]; private updateGraphWorker; private detachScriptInfoFromProject; @@ -13615,66 +8237,76 @@ declare namespace ts.server { getScriptInfo(uncheckedFileName: string): ScriptInfo | undefined; filesToString(writeProjectFileNames: boolean): string; setCompilerOptions(compilerOptions: CompilerOptions): void; - getChangesSinceVersion(lastKnownVersion?: number): ProjectFilesWithTSDiagnostics; protected removeRoot(info: ScriptInfo): void; protected enableGlobalPlugins(): void; protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[]): void; + /** Starts a new check for diagnostics. Call this if some file has updated that would cause diagnostics to be changed. */ refreshDiagnostics(): void; private enableProxy; } + /** + * If a file is opened and no tsconfig (or jsconfig) is found, + * the file and its imports/references are put into an InferredProject. + */ class InferredProject extends Project { private static readonly newName; private _isJsInferredProject; toggleJsInferredProject(isJsInferredProject: boolean): void; setCompilerOptions(options?: CompilerOptions): void; + /** this is canonical project root path */ readonly projectRootPath: string | undefined; - readonly canonicalCurrentDirectory: string | undefined; - constructor(projectService: ProjectService, documentRegistry: DocumentRegistry, compilerOptions: CompilerOptions, projectRootPath: NormalizedPath | undefined, currentDirectory: string | undefined); addRoot(info: ScriptInfo): void; removeRoot(info: ScriptInfo): void; - isOrphan(): boolean; isProjectWithSingleRoot(): boolean; close(): void; getTypeAcquisition(): TypeAcquisition; } + /** + * If a file is opened, the server will look for a tsconfig (or jsconfig) + * and if successfull create a ConfiguredProject for it. + * Otherwise it will create an InferredProject. + */ class ConfiguredProject extends Project { compileOnSaveEnabled: boolean; private projectReferences; private typeAcquisition; - configFileWatcher: FileWatcher | undefined; private directoriesWatchedForWildcards; readonly canonicalConfigFilePath: NormalizedPath; - pendingReload: ConfigFileProgramReloadLevel; - configFileSpecs: ConfigFileSpecs | undefined; + /** Ref count to the project when opened from external project */ private externalProjectRefCount; private projectErrors; - constructor(configFileName: NormalizedPath, projectService: ProjectService, documentRegistry: DocumentRegistry, hasExplicitListOfFiles: boolean, compilerOptions: CompilerOptions, lastFileExceededProgramSize: string | undefined, compileOnSaveEnabled: boolean, cachedDirectoryStructureHost: CachedDirectoryStructureHost, projectReferences: ReadonlyArray | undefined); + /** + * If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph + * @returns: true if set of files in the project stays the same and false - otherwise. + */ updateGraph(): boolean; - getCachedDirectoryStructureHost(): CachedDirectoryStructureHost; getConfigFilePath(): NormalizedPath; getProjectReferences(): ReadonlyArray | undefined; updateReferences(refs: ReadonlyArray | undefined): void; enablePlugins(): void; + /** + * Get the errors that dont have any file name associated + */ getGlobalProjectErrors(): ReadonlyArray; + /** + * Get all the project errors + */ getAllProjectErrors(): ReadonlyArray; setProjectErrors(projectErrors: Diagnostic[]): void; setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; getTypeAcquisition(): TypeAcquisition; - watchWildcards(wildcardDirectories: Map): void; - stopWatchingWildCards(): void; close(): void; - addExternalProjectReference(): void; - deleteExternalProjectReference(): void; - hasOpenRef(): boolean; getEffectiveTypeRoots(): string[]; - updateErrorOnNoInputFiles(hasFileNames: boolean): void; } + /** + * Project whose configuration is handled externally, such as in a '.csproj'. + * These are created only if a host explicitly calls `openExternalProject`. + */ class ExternalProject extends Project { externalProjectName: string; compileOnSaveEnabled: boolean; excludedFiles: ReadonlyArray; private typeAcquisition; - constructor(externalProjectName: string, projectService: ProjectService, documentRegistry: DocumentRegistry, compilerOptions: CompilerOptions, lastFileExceededProgramSize: string | undefined, compileOnSaveEnabled: boolean, projectFilePath?: string); getExcludedFiles(): ReadonlyArray; getTypeAcquisition(): TypeAcquisition; setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; @@ -13708,13 +8340,20 @@ declare namespace ts.server { languageServiceEnabled: boolean; }; } + /** This will be converted to the payload of a protocol.TelemetryEvent in session.defaultEventHandler. */ interface ProjectInfoTelemetryEvent { readonly eventName: typeof ProjectInfoTelemetryEvent; readonly data: ProjectInfoTelemetryEventData; } interface ProjectInfoTelemetryEventData { + /** Cryptographically secure hash of project file location. */ readonly projectId: string; + /** Count of file extensions seen in the project. */ readonly fileStats: FileStats; + /** + * Any compiler options that might contain paths will be taken out. + * Enum compiler options will be converted to strings. + */ readonly compilerOptions: CompilerOptions; readonly extends: boolean | undefined; readonly files: boolean | undefined; @@ -13725,8 +8364,14 @@ declare namespace ts.server { readonly configFileName: "tsconfig.json" | "jsconfig.json" | "other"; readonly projectType: "external" | "configured"; readonly languageServiceEnabled: boolean; + /** TypeScript version used by the server. */ readonly version: string; } + /** + * Info that we may send about a file that was just opened. + * Info about a file will only be sent once per session, even if the file changes in ways that might affect the info. + * Currently this is only sent for '.js' files. + */ interface OpenFileInfoTelemetryEvent { readonly eventName: typeof OpenFileInfoTelemetryEvent; readonly data: OpenFileInfoTelemetryEventData; @@ -13779,20 +8424,6 @@ declare namespace ts.server { configFileName?: NormalizedPath; configFileErrors?: ReadonlyArray; } - enum WatchType { - ConfigFilePath = "Config file for the program", - MissingFilePath = "Missing file from program", - WildcardDirectories = "Wild card directory", - ClosedScriptInfo = "Closed Script info", - ConfigFileForInferredRoot = "Config file for the inferred project root", - FailedLookupLocation = "Directory of Failed lookup locations in module resolution", - TypeRoots = "Type root directory" - } - interface ConfigFileExistenceInfo { - exists: boolean; - openFilesImpactedByConfigFile: Map; - configFileWatcherForRootOfInferredProject?: FileWatcher; - } interface ProjectServiceOptions { host: ServerHost; logger: Logger; @@ -13810,27 +8441,54 @@ declare namespace ts.server { syntaxOnly?: boolean; } class ProjectService { - readonly typingsCache: TypingsCache; - readonly documentRegistry: DocumentRegistry; + /** + * Container of all known scripts + */ private readonly filenameToScriptInfo; private readonly allJsFilesForOpenFileTelemetry; - readonly realpathToScriptInfos: MultiMap | undefined; + /** + * maps external project file name to list of config files that were the part of this project + */ private readonly externalProjectToConfiguredProjectMap; + /** + * external projects (configuration and list of root files is not controlled by tsserver) + */ readonly externalProjects: ExternalProject[]; + /** + * projects built from openFileRoots + */ readonly inferredProjects: InferredProject[]; + /** + * projects specified by a tsconfig.json file + */ readonly configuredProjects: Map; + /** + * Open files: with value being project root path, and key being Path of the file that is open + */ readonly openFiles: Map; + /** + * Map of open files that are opened without complete path but have projectRoot as current directory + */ private readonly openFilesWithNonRootedDiskPath; private compilerOptionsForInferredProjects; private compilerOptionsForInferredProjectsPerProjectRoot; + /** + * Project size for configured or external projects + */ private readonly projectToSizeMap; + /** + * This is a map of config file paths existance that doesnt need query to disk + * - The entry can be present because there is inferred project that needs to watch addition of config file to directory + * In this case the exists could be true/false based on config file is present or not + * - Or it is present if we have configured project open with config file at that location + * In this case the exists property is always true + */ private readonly configFileExistenceInfoCache; private readonly throttledOperations; private readonly hostConfiguration; private safelist; private legacySafelist; private pendingProjectUpdates; - pendingEnsureProjectForOpenFiles: boolean; readonly currentDirectory: NormalizedPath; readonly toCanonicalFileName: (f: string) => string; readonly host: ServerHost; @@ -13848,34 +8506,27 @@ declare namespace ts.server { readonly allowLocalPluginLoads: boolean; readonly typesMapLocation: string | undefined; readonly syntaxOnly?: boolean; + /** Tracks projects that we have already sent telemetry for. */ private readonly seenProjects; - readonly watchFactory: WatchFactory; constructor(opts: ProjectServiceOptions); toPath(fileName: string): Path; - getExecutingFilePath(): string; - getNormalizedAbsolutePath(fileName: string): string; - setDocument(key: DocumentRegistryBucketKey, path: Path, sourceFile: SourceFile): void; - getDocument(key: DocumentRegistryBucketKey, path: Path): SourceFile | undefined; - ensureInferredProjectsUpToDate_TestOnly(): void; - getCompilerOptionsForInferredProjects(): CompilerOptions; - onUpdateLanguageServiceStateForProject(project: Project, languageServiceEnabled: boolean): void; private loadTypesMap; updateTypingsForProject(response: SetTypings | InvalidateCachedTypings | PackageInstalledResponse): void; - updateTypingsForProject(response: SetTypings | InvalidateCachedTypings | PackageInstalledResponse | BeginInstallTypes | EndInstallTypes): void; private delayEnsureProjectForOpenFiles; private delayUpdateProjectGraph; - hasPendingProjectUpdate(project: Project): boolean; - sendProjectsUpdatedInBackgroundEvent(): void; - delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project: Project): void; private delayUpdateProjectGraphs; setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.ExternalProjectCompilerOptions, projectRootPath?: string): void; findProject(projectName: string): Project | undefined; - forEachProject(cb: (project: Project) => void): void; getDefaultProjectForFile(fileName: NormalizedPath, ensureProject: boolean): Project | undefined; - tryGetDefaultProjectForFile(fileName: NormalizedPath): Project | undefined; - ensureDefaultProjectForFile(fileName: NormalizedPath): Project; private doEnsureDefaultProjectForFile; getScriptInfoEnsuringProjectsUptoDate(uncheckedFileName: string): ScriptInfo | undefined; + /** + * Ensures the project structures are upto date + * This means, + * - we go through all the projects and update them if they are dirty + * - if updates reflect some change in structure or there was pending request to ensure projects for open files + * ensure that each open script info has project + */ private ensureProjectStructuresUptoDate; getFormatCodeOptions(file: NormalizedPath): FormatCodeSettings; getPreferences(file: NormalizedPath): UserPreferences; @@ -13883,31 +8534,65 @@ declare namespace ts.server { getHostPreferences(): UserPreferences; private onSourceFileChanged; private handleDeletedFile; - watchWildcardDirectory(directory: Path, flags: WatchDirectoryFlags, project: ConfiguredProject): FileWatcher; - getConfigFileExistenceInfo(project: ConfiguredProject): ConfigFileExistenceInfo; private onConfigChangedForConfiguredProject; + /** + * This is the callback function for the config file add/remove/change at any location + * that matters to open script info but doesnt have configured project open + * for the config file + */ private onConfigFileChangeForOpenScriptInfo; private removeProject; - assignOrphanScriptInfoToInferredProject(info: ScriptInfo, projectRootPath: NormalizedPath | undefined): InferredProject; + /** + * Remove this file from the set of open, non-configured files. + * @param info The file that has been closed or newly configured + */ private closeOpenFile; private deleteScriptInfo; private configFileExists; private setConfigFileExistenceByNewConfiguredProject; + /** + * Returns true if the configFileExistenceInfo is needed/impacted by open files that are root of inferred project + */ private configFileExistenceImpactsRootOfInferredProject; private setConfigFileExistenceInfoByClosedConfiguredProject; private logConfigFileWatchUpdate; + /** + * Create the watcher for the configFileExistenceInfo + */ private createConfigFileWatcherOfConfigFileExistence; + /** + * Close the config file watcher in the cached ConfigFileExistenceInfo + * if there arent any open files that are root of inferred project + */ private closeConfigFileWatcherOfConfigFileExistenceInfo; + /** + * This is called on file close, so that we stop watching the config file for this script info + */ private stopWatchingConfigFilesForClosedScriptInfo; - startWatchingConfigFilesForInferredProjectRoot(info: ScriptInfo): void; - stopWatchingConfigFilesForInferredProjectRoot(info: ScriptInfo): void; + /** + * This function tries to search for a tsconfig.json for the given file. + * This is different from the method the compiler uses because + * the compiler can assume it will always start searching in the + * current directory (the directory in which tsc was invoked). + * The server must start searching from the directory containing + * the newly opened file. + */ private forEachConfigFileLocation; + /** + * This function tries to search for a tsconfig.json for the given file. + * This is different from the method the compiler uses because + * the compiler can assume it will always start searching in the + * current directory (the directory in which tsc was invoked). + * The server must start searching from the directory containing + * the newly opened file. + */ private getConfigFileNameForFile; private printProjects; private findConfiguredProjectByProjectName; private getConfiguredProjectByCanonicalConfigFilePath; private findExternalProjectByProjectName; private convertConfigFileContentToProjectOptions; + /** Get a filename if the language service exceeds the maximum allowed program size; otherwise returns undefined. */ private getFilenameForExceededTotalSizeLimitForNonTsFiles; private createExternalProject; private sendProjectTelemetry; @@ -13915,45 +8600,70 @@ declare namespace ts.server { private createConfiguredProject; private updateNonInferredProjectFiles; private updateNonInferredProject; - reloadFileNamesOfConfiguredProject(project: ConfiguredProject): boolean; - reloadConfiguredProject(project: ConfiguredProject): void; private sendConfigFileDiagEvent; private getOrCreateInferredProjectForProjectRootPathIfEnabled; private getOrCreateSingleInferredProjectIfEnabled; private getOrCreateSingleInferredWithoutProjectRoot; private createInferredProject; - getOrCreateScriptInfoNotOpenedByClient(uncheckedFileName: string, currentDirectory: string, hostToQueryFileExistsOn: DirectoryStructureHost): ScriptInfo | undefined; getScriptInfo(uncheckedFileName: string): ScriptInfo | undefined; - getSymlinkedProjects(info: ScriptInfo): MultiMap | undefined; private watchClosedScriptInfo; private stopWatchingScriptInfo; - getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(fileName: NormalizedPath, currentDirectory: string, scriptKind: ScriptKind | undefined, hasMixedContent: boolean | undefined, hostToQueryFileExistsOn: DirectoryStructureHost | undefined): ScriptInfo | undefined; - getOrCreateScriptInfoOpenedByClientForNormalizedPath(fileName: NormalizedPath, currentDirectory: string, fileContent: string | undefined, scriptKind: ScriptKind | undefined, hasMixedContent: boolean | undefined): ScriptInfo | undefined; getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: { fileExists(path: string): boolean; }): ScriptInfo | undefined; private getOrCreateScriptInfoWorker; + /** + * This gets the script info for the normalized path. If the path is not rooted disk path then the open script info with project root context is preferred + */ getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined; getScriptInfoForPath(fileName: Path): ScriptInfo | undefined; setHostConfiguration(args: protocol.ConfigureRequestArguments): void; closeLog(): void; + /** + * This function rebuilds the project for every file opened by the client + * This does not reload contents of open files from disk. But we could do that if needed + */ reloadProjects(): void; private delayReloadConfiguredProjectForFiles; + /** + * This function goes through all the openFiles and tries to file the config file for them. + * If the config file is found and it refers to existing project, it reloads it either immediately + * or schedules it for reload depending on delayReload option + * If the there is no existing project it just opens the configured project for the config file + * reloadForInfo provides a way to filter out files to reload configured project for + */ private reloadConfiguredProjectForFiles; + /** + * Remove the root of inferred project if script info is part of another project + */ private removeRootOfInferredProjectIfNowPartOfOtherProject; + /** + * This function is to update the project structure for every inferred project. + * It is called on the premise that all the configured projects are + * up to date. + * This will go through open files and assign them to inferred project if open file is not part of any other project + * After that all the inferred project graphs are updated + */ private ensureProjectForOpenFiles; + /** + * Open file whose contents is managed by the client + * @param filename is absolute pathname + * @param fileContent is a known version of the file content that is more up to date than the one on disk + */ openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind, projectRootPath?: string): OpenConfiguredProjectResult; private findExternalProjectContainingOpenScriptInfo; openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult; private telemetryOnOpenFile; + /** + * Close file whose contents is managed by the client + * @param filename is absolute pathname + */ closeClientFile(uncheckedFileName: string): void; private collectChanges; - synchronizeProjectList(knownProjects: protocol.ProjectVersionInfo[]): ProjectFilesWithTSDiagnostics[]; - applyChangesInOpenFiles(openFiles: protocol.ExternalFile[] | undefined, changedFiles: protocol.ChangedOpenFile[] | undefined, closedFiles: string[] | undefined): void; - applyChangesToFile(scriptInfo: ScriptInfo, changes: TextChange[]): void; private closeConfiguredProjectReferencedFromExternalProject; closeExternalProject(uncheckedFileName: string): void; openExternalProjects(projects: protocol.ExternalProject[]): void; + /** Makes a filename safe to insert in a RegExp */ private static readonly filenameEscapeRegexp; private static escapeFilenameForRegex; resetSafeList(): void; @@ -13979,7 +8689,6 @@ declare namespace ts.server { interface EventSender { event: Event; } - function toEvent(eventName: string, body: object): protocol.Event; interface SessionOptions { host: ServerHost; cancellationToken: ServerCancellationToken; @@ -13989,8 +8698,12 @@ declare namespace ts.server { byteLength: (buf: string, encoding?: string) => number; hrtime: (start?: number[]) => number[]; logger: Logger; + /** + * If falsy, all events are suppressed. + */ canUseEvents: boolean; eventHandler?: ProjectServiceEventHandler; + /** Has no effect if eventHandler is also specified. */ suppressDiagnosticEvents?: boolean; syntaxOnly?: boolean; throttleWaitMilliseconds?: number; @@ -14022,12 +8735,14 @@ declare namespace ts.server { logError(err: Error, cmd: string): void; send(msg: protocol.Message): void; event(body: T, eventName: string): void; + /** @deprecated */ output(info: any, cmdName: string, reqSeq?: number, errorMsg?: string): void; private doOutput; private semanticCheck; private syntacticCheck; private suggestionCheck; private sendDiagnosticsEvent; + /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */ private updateErrorCheck; private cleanProjects; private cleanup; @@ -14060,6 +8775,10 @@ declare namespace ts.server { private getDefaultProject; private getRenameLocations; private getReferences; + /** + * @param fileName is the name of the file to be opened + * @param fileContent is a version of the file content that is known to be more up to date than the one on disk + */ private openClientFile; private getPosition; private getPositionInFile; @@ -14135,110 +8854,7 @@ declare namespace ts.server { response?: {}; responseRequired?: boolean; } - function getLocationInNewDocument(oldText: string, renameFilename: string, renameLocation: number, edits: ReadonlyArray): protocol.Location; -} -declare namespace ts.server { - interface LineCollection { - charCount(): number; - lineCount(): number; - isLeaf(): this is LineLeaf; - walk(rangeStart: number, rangeLength: number, walkFns: LineIndexWalker): void; - } - interface AbsolutePositionAndLineText { - absolutePosition: number; - lineText: string | undefined; - } - enum CharRangeSection { - PreStart = 0, - Start = 1, - Entire = 2, - Mid = 3, - End = 4, - PostEnd = 5 - } - interface LineIndexWalker { - goSubtree: boolean; - done: boolean; - leaf(relativeStart: number, relativeLength: number, lineCollection: LineLeaf): void; - pre?(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineNode, nodeType: CharRangeSection): void; - post?(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineNode, nodeType: CharRangeSection): void; - } - class ScriptVersionCache { - private changes; - private readonly versions; - private minVersion; - private currentVersion; - private static readonly changeNumberThreshold; - private static readonly changeLengthThreshold; - private static readonly maxVersions; - private versionToIndex; - private currentVersionToIndex; - edit(pos: number, deleteLen: number, insertedText?: string): void; - getSnapshot(): IScriptSnapshot; - private _getSnapshot; - getSnapshotVersion(): number; - getLineInfo(line: number): AbsolutePositionAndLineText; - lineOffsetToPosition(line: number, column: number): number; - positionToLineOffset(position: number): protocol.Location; - lineToTextSpan(line: number): TextSpan; - getTextChangesBetweenVersions(oldVersion: number, newVersion: number): TextChangeRange | undefined; - static fromString(script: string): ScriptVersionCache; - } - class LineIndex { - root: LineNode; - checkEdits: boolean; - absolutePositionOfStartOfLine(oneBasedLine: number): number; - positionToLineOffset(position: number): protocol.Location; - private positionToColumnAndLineText; - lineNumberToInfo(oneBasedLine: number): AbsolutePositionAndLineText; - load(lines: string[]): void; - walk(rangeStart: number, rangeLength: number, walkFns: LineIndexWalker): void; - getText(rangeStart: number, rangeLength: number): string; - getLength(): number; - every(f: (ll: LineLeaf, s: number, len: number) => boolean, rangeStart: number, rangeEnd?: number): boolean; - edit(pos: number, deleteLength: number, newText?: string): LineIndex; - private static buildTreeFromBottom; - static linesFromText(text: string): { - lines: string[]; - lineMap: number[]; - }; - } - class LineNode implements LineCollection { - private readonly children; - totalChars: number; - totalLines: number; - constructor(children?: LineCollection[]); - isLeaf(): boolean; - updateCounts(): void; - private execWalk; - private skipChild; - walk(rangeStart: number, rangeLength: number, walkFns: LineIndexWalker): void; - charOffsetToLineInfo(lineNumberAccumulator: number, relativePosition: number): { - oneBasedLine: number; - zeroBasedColumn: number; - lineText: string | undefined; - }; - lineNumberToInfo(relativeOneBasedLine: number, positionAccumulator: number): { - position: number; - leaf: LineLeaf | undefined; - }; - private splitAfter; - remove(child: LineCollection): void; - private findChildIndex; - insertAt(child: LineCollection, nodes: LineCollection[]): LineNode[]; - add(collection: LineCollection): void; - charCount(): number; - lineCount(): number; - } - class LineLeaf implements LineCollection { - text: string; - constructor(text: string); - isLeaf(): boolean; - walk(rangeStart: number, rangeLength: number, walkFns: LineIndexWalker): void; - charCount(): number; - lineCount(): number; - } } -//# sourceMappingURL=server.d.ts.map +//# sourceMappingURL=tsserverlibrary.d.ts.map export = ts; export as namespace ts; \ No newline at end of file diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 273e0cad00e45..dea292370b89c 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1,21 +1,29 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + declare namespace ts { const versionMajorMinor = "3.0"; - /** The version of the TypeScript compiler release */ const version: string; } declare namespace ts { - /** - * Type of objects whose values are all of the same type. - * The `in` and `for-in` operators can *not* be safely used, - * since `Object.prototype` may be modified by outside code. - */ interface MapLike { [index: string]: T; } interface SortedArray extends Array { " __sortedArrayBrand": any; } - /** ES6 Map interface, only read methods included. */ interface ReadonlyMap { get(key: string): T | undefined; has(key: string): boolean; @@ -25,13 +33,11 @@ declare namespace ts { values(): Iterator; entries(): Iterator<[string, T]>; } - /** ES6 Map interface. */ interface Map extends ReadonlyMap { set(key: string, value: T): this; delete(key: string): boolean; clear(): void; } - /** ES6 Iterator type. */ interface Iterator { next(): { value: T; @@ -41,7 +47,6 @@ declare namespace ts { done: true; }; } - /** Array that is only intended to be pushed to, never read. */ interface Push { push(...values: T[]): void; } @@ -449,9 +454,7 @@ declare namespace ts { } enum JsxFlags { None = 0, - /** An element from a named property of the JSX.IntrinsicElements interface */ IntrinsicNamedElement = 1, - /** An element inferred from the string index signature of the JSX.IntrinsicElements interface */ IntrinsicIndexedElement = 2, IntrinsicElement = 3 } @@ -491,10 +494,6 @@ declare namespace ts { type ModifiersArray = NodeArray; interface Identifier extends PrimaryExpression, Declaration { kind: SyntaxKind.Identifier; - /** - * Prefer to use `id.unescapedText`. (Note: This is available only in services, not internally to the TypeScript compiler.) - * Text of identifier, but if the identifier begins with two underscores, this will begin with three. - */ escapedText: __String; originalKeywordKind?: SyntaxKind; isInJSDocNamespace?: boolean; @@ -638,14 +637,6 @@ declare namespace ts { } type BindingPattern = ObjectBindingPattern | ArrayBindingPattern; type ArrayBindingElement = BindingElement | OmittedExpression; - /** - * Several node kinds share function-like features such as a signature, - * a name, and a body. These nodes should extend FunctionLikeDeclarationBase. - * Examples: - * - FunctionDeclaration - * - MethodDeclaration - * - AccessorDeclaration - */ interface FunctionLikeDeclarationBase extends SignatureDeclarationBase { _functionLikeDeclarationBrand: any; asteriskToken?: AsteriskToken; @@ -653,7 +644,6 @@ declare namespace ts { body?: Block | Expression; } type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration | FunctionExpression | ArrowFunction; - /** @deprecated Use SignatureDeclaration */ type FunctionLike = SignatureDeclaration; interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement { kind: SyntaxKind.FunctionDeclaration; @@ -676,7 +666,6 @@ declare namespace ts { parent: ClassLikeDeclaration; body?: FunctionBody; } - /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */ interface SemicolonClassElement extends ClassElement { kind: SyntaxKind.SemicolonClassElement; parent: ClassLikeDeclaration; @@ -824,7 +813,6 @@ declare namespace ts { interface UnaryExpression extends Expression { _unaryExpressionBrand: any; } - /** Deprecated, please use UpdateExpression */ type IncrementExpression = UpdateExpression; interface UpdateExpression extends UnaryExpression { _updateExpressionBrand: any; @@ -1011,12 +999,6 @@ declare namespace ts { parent: ArrayLiteralExpression | CallExpression | NewExpression; expression: Expression; } - /** - * This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to - * ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be - * JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type - * ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.) - */ interface ObjectLiteralExpressionBase extends PrimaryExpression, Declaration { properties: NodeArray; } @@ -1033,7 +1015,6 @@ declare namespace ts { interface SuperPropertyAccessExpression extends PropertyAccessExpression { expression: SuperExpression; } - /** Brand for a PropertyAccessExpression which, like a QualifiedName, consists of a sequence of identifiers separated by dots. */ interface PropertyAccessEntityNameExpression extends PropertyAccessExpression { _propertyAccessExpressionLikeQualifiedNameBrand?: any; expression: EntityNameExpression; @@ -1170,9 +1151,6 @@ declare namespace ts { interface NotEmittedStatement extends Statement { kind: SyntaxKind.NotEmittedStatement; } - /** - * A list of comma-separated expressions. This node is only created by transformations. - */ interface CommaListExpression extends Expression { kind: SyntaxKind.CommaListExpression; elements: NodeArray; @@ -1309,7 +1287,6 @@ declare namespace ts { } interface ClassDeclaration extends ClassLikeDeclarationBase, DeclarationStatement { kind: SyntaxKind.ClassDeclaration; - /** May be undefined in `export default class { ... }`. */ name?: Identifier; } interface ClassExpression extends ClassLikeDeclarationBase, PrimaryExpression { @@ -1379,11 +1356,6 @@ declare namespace ts { statements: NodeArray; } type ModuleReference = EntityName | ExternalModuleReference; - /** - * One of: - * - import x = require("mod"); - * - import x = M.x; - */ interface ImportEqualsDeclaration extends DeclarationStatement, JSDocContainer { kind: SyntaxKind.ImportEqualsDeclaration; parent: SourceFile | ModuleBlock; @@ -1399,7 +1371,6 @@ declare namespace ts { kind: SyntaxKind.ImportDeclaration; parent: SourceFile | ModuleBlock; importClause?: ImportClause; - /** If this is not a StringLiteral it will be a grammar error. */ moduleSpecifier: Expression; } type NamedImportBindings = NamespaceImport | NamedImports; @@ -1421,9 +1392,7 @@ declare namespace ts { interface ExportDeclaration extends DeclarationStatement { kind: SyntaxKind.ExportDeclaration; parent: SourceFile | ModuleBlock; - /** Will not be assigned in the case of `export * from "foo";` */ exportClause?: NamedExports; - /** If this is not a StringLiteral it will be a grammar error. */ moduleSpecifier?: Expression; } interface NamedImports extends Node { @@ -1450,10 +1419,6 @@ declare namespace ts { name: Identifier; } type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier; - /** - * This is either an `export =` or an `export default` declaration. - * Unless `isExportEquals` is set, this node was parsed as an `export default`. - */ interface ExportAssignment extends DeclarationStatement { kind: SyntaxKind.ExportAssignment; parent: SourceFile; @@ -1524,10 +1489,6 @@ declare namespace ts { interface JSDocUnknownTag extends JSDocTag { kind: SyntaxKind.JSDocTag; } - /** - * Note that `@extends` is a synonym of `@augments`. - * Both tags are represented by this interface. - */ interface JSDocAugmentsTag extends JSDocTag { kind: SyntaxKind.JSDocAugmentsTag; class: ExpressionWithTypeArguments & { @@ -1577,7 +1538,6 @@ declare namespace ts { parent: JSDoc; name: EntityName; typeExpression?: JSDocTypeExpression; - /** Whether the property name came before the type -- non-standard for JSDoc, but Typescript-like */ isNameFirst: boolean; isBracketed: boolean; } @@ -1590,7 +1550,6 @@ declare namespace ts { interface JSDocTypeLiteral extends JSDocType { kind: SyntaxKind.JSDocTypeLiteral; jsDocPropertyTags?: ReadonlyArray; - /** If true, then this type literal represents an *array* of its type. */ isArrayType?: boolean; } enum FlowFlags { @@ -1671,14 +1630,6 @@ declare namespace ts { libReferenceDirectives: ReadonlyArray; languageVariant: LanguageVariant; isDeclarationFile: boolean; - /** - * lib.d.ts should have a reference comment like - * - * /// - * - * If any other file has this comment, it signals not to include lib.d.ts - * because this containing file is intended to act as a default library. - */ hasNoDefaultLib: boolean; languageVersion: ScriptTarget; } @@ -1725,18 +1676,9 @@ declare namespace ts { interface ParseConfigHost { useCaseSensitiveFileNames: boolean; readDirectory(rootDir: string, extensions: ReadonlyArray, excludes: ReadonlyArray | undefined, includes: ReadonlyArray, depth?: number): string[]; - /** - * Gets a value indicating whether the specified path exists and is a file. - * @param path The path to test. - */ fileExists(path: string): boolean; readFile(path: string): string | undefined; } - /** - * Branded string for keeping track of when we've turned an ambiguous path - * specified like "./blah" to an absolute path to an actual - * tsconfig file, e.g. "/root/blah/tsconfig.json" - */ type ResolvedConfigFileName = string & { _isResolvedConfigFileName: never; }; @@ -1745,39 +1687,18 @@ declare namespace ts { } interface CancellationToken { isCancellationRequested(): boolean; - /** @throws OperationCanceledException if isCancellationRequested is true */ throwIfCancellationRequested(): void; } interface Program extends ScriptReferenceHost { - /** - * Get a list of root file names that were passed to a 'createProgram' - */ getRootFileNames(): ReadonlyArray; - /** - * Get a list of files in the program - */ getSourceFiles(): ReadonlyArray; - /** - * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then - * the JavaScript and declaration files will be produced for all the files in this program. - * If targetSourceFile is specified, then only the JavaScript and declaration for that - * specific file will be generated. - * - * If writeFile is not specified then the writeFile callback from the compiler host will be - * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter - * will be invoked when writing the JavaScript and declaration files. - */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult; getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; - /** The first time this is called, it will return global diagnostics (no location). */ getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; getConfigFileParsingDiagnostics(): ReadonlyArray; - /** - * Gets a type checker that can be used to semantically analyze source files in the program. - */ getTypeChecker(): TypeChecker; isSourceFileFromExternalLibrary(file: SourceFile): boolean; getProjectReferences(): (ResolvedProjectReference | undefined)[] | undefined; @@ -1787,25 +1708,16 @@ declare namespace ts { sourceFile: SourceFile; } interface CustomTransformers { - /** Custom transformers to evaluate before built-in .js transformations. */ before?: TransformerFactory[]; - /** Custom transformers to evaluate after built-in .js transformations. */ after?: TransformerFactory[]; - /** Custom transformers to evaluate after built-in .d.ts transformations. */ afterDeclarations?: TransformerFactory[]; } interface SourceMapSpan { - /** Line number in the .js file. */ emittedLine: number; - /** Column number in the .js file. */ emittedColumn: number; - /** Line number in the .ts file. */ sourceLine: number; - /** Column number in the .ts file. */ sourceColumn: number; - /** Optional name (index into names array) associated with this span. */ nameIndex?: number; - /** .ts file (index into sources array) associated with this span */ sourceIndex: number; } interface SourceMapData { @@ -1820,7 +1732,6 @@ declare namespace ts { sourceMapMappings: string; sourceMapDecodedMappings: SourceMapSpan[]; } - /** Return code used by getEmitOutput function to indicate status of the function */ enum ExitStatus { Success = 0, DiagnosticsPresent_OutputsSkipped = 1, @@ -1828,7 +1739,6 @@ declare namespace ts { } interface EmitResult { emitSkipped: boolean; - /** Contains declaration emit diagnostics */ diagnostics: ReadonlyArray; emittedFiles?: string[]; } @@ -1846,41 +1756,21 @@ declare namespace ts { getReturnTypeOfSignature(signature: Signature): Type; getNullableType(type: Type, flags: TypeFlags): Type; getNonNullableType(type: Type): Type; - /** Note that the resulting nodes cannot be checked. */ typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode | undefined; - /** Note that the resulting nodes cannot be checked. */ signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): (SignatureDeclaration & { typeArguments?: NodeArray; }) | undefined; - /** Note that the resulting nodes cannot be checked. */ indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): IndexSignatureDeclaration | undefined; - /** Note that the resulting nodes cannot be checked. */ symbolToEntityName(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): EntityName | undefined; - /** Note that the resulting nodes cannot be checked. */ symbolToExpression(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): Expression | undefined; - /** Note that the resulting nodes cannot be checked. */ symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): NodeArray | undefined; - /** Note that the resulting nodes cannot be checked. */ symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): ParameterDeclaration | undefined; - /** Note that the resulting nodes cannot be checked. */ typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeParameterDeclaration | undefined; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol | undefined; getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; - /** - * The function returns the value (local variable) symbol of an identifier in the short-hand property assignment. - * This is necessary as an identifier in short-hand property assignment can contains two meaning: property name and property value. - */ getShorthandAssignmentValueSymbol(location: Node): Symbol | undefined; getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol | undefined; - /** - * If a symbol is a local symbol with an associated exported symbol, returns the exported symbol. - * Otherwise returns its input. - * For example, at `export type T = number;`: - * - `getSymbolAtLocation` at the location `T` will return the exported symbol for `T`. - * - But the result of `getSymbolsInScope` will contain the *local* symbol for `T`, not the exported symbol. - * - Calling `getExportSymbolOfSymbol` on that local symbol will return the exported symbol. - */ getExportSymbolOfSymbol(symbol: Symbol): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined; getTypeAtLocation(node: Node): Type | undefined; @@ -1889,20 +1779,11 @@ declare namespace ts { typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): string; typePredicateToString(predicate: TypePredicate, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; - /** - * @deprecated Use the createX factory functions or XToY typechecker methods and `createPrinter` or the `xToString` methods instead - * This will be removed in a future version. - */ getSymbolDisplayBuilder(): SymbolDisplayBuilder; getFullyQualifiedName(symbol: Symbol): string; getAugmentedPropertiesOfType(type: Type): Symbol[]; getRootSymbols(symbol: Symbol): Symbol[]; getContextualType(node: Expression): Type | undefined; - /** - * returns unknownSignature in the case of an error. - * returns undefined if the node is not valid. - * @param argumentCount Apparent number of arguments, passed in case of a possibly incomplete call. This should come from an ArgumentListInfo. See `signatureHelp.ts`. - */ getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined; getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature | undefined; isImplementationOfOverload(node: SignatureDeclaration): boolean | undefined; @@ -1911,7 +1792,6 @@ declare namespace ts { isUnknownSymbol(symbol: Symbol): boolean; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean; - /** Follow all aliases to get the original symbol. */ getAliasedSymbol(symbol: Symbol): Symbol; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; getAllAttributesTypeFromJsxOpeningLikeElement(elementNode: JsxOpeningLikeElement): Type | undefined; @@ -1925,11 +1805,6 @@ declare namespace ts { getSuggestionForNonexistentModule(node: Identifier, target: Symbol): string | undefined; getBaseConstraintOfType(type: Type): Type | undefined; getDefaultFromTypeParameter(type: Type): Type | undefined; - /** - * Depending on the operation performed, it may be appropriate to throw away the checker - * if the cancellation token is triggered. Typically, if it is used for error checking - * and the operation is cancelled, then it should be discarded, otherwise it is safe to keep. - */ runWithCancellationToken(token: CancellationToken, cb: (checker: TypeChecker) => T): T; } enum NodeBuilderFlags { @@ -1982,7 +1857,7 @@ declare namespace ts { InElementType = 2097152, InFirstTypeArgument = 4194304, InTypeAlias = 8388608, - /** @deprecated */ WriteOwnNameForAnyLike = 0, + WriteOwnNameForAnyLike = 0, NodeBuilderFlagsMask = 9469291 } enum SymbolFormatFlags { @@ -1992,25 +1867,19 @@ declare namespace ts { AllowAnyNodeKind = 4, UseAliasDefinedOutsideCurrentScope = 8 } - /** - * @deprecated - */ interface SymbolDisplayBuilder { - /** @deprecated */ buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - /** @deprecated */ buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; - /** @deprecated */ buildSignatureDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; - /** @deprecated */ buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void; - /** @deprecated */ buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - /** @deprecated */ buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - /** @deprecated */ buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - /** @deprecated */ buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - /** @deprecated */ buildDisplayForParametersAndDelimiters(thisParameter: Symbol, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - /** @deprecated */ buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - /** @deprecated */ buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - } - /** - * @deprecated Migrate to other methods of generating symbol names, ex symbolToEntityName + a printer or symbolToString - */ + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; + buildSignatureDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; + buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void; + buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForParametersAndDelimiters(thisParameter: Symbol, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + } interface SymbolWriter extends SymbolTracker { writeKeyword(text: string): void; writeOperator(text: string): void; @@ -2131,20 +2000,11 @@ declare namespace ts { ExportEquals = "export=", Default = "default" } - /** - * This represents a string whose leading underscore have been escaped by adding extra leading underscores. - * The shape of this brand is rather unique compared to others we've used. - * Instead of just an intersection of a string and an object, it is that union-ed - * with an intersection of void and an object. This makes it wholly incompatible - * with a normal string (which is good, it cannot be misused on assignment or on usage), - * while still being comparable with a normal string via === (also good) and castable from a string. - */ type __String = (string & { __escapedIdentifier: void; }) | (void & { __escapedIdentifier: void; }) | InternalSymbolName; - /** ReadonlyMap where keys are `__String`s. */ interface ReadonlyUnderscoreEscapedMap { get(key: __String): T | undefined; has(key: __String): boolean; @@ -2154,13 +2014,11 @@ declare namespace ts { values(): Iterator; entries(): Iterator<[__String, T]>; } - /** Map where keys are `__String`s. */ interface UnderscoreEscapedMap extends ReadonlyUnderscoreEscapedMap { set(key: __String, value: T): this; delete(key: __String): boolean; clear(): void; } - /** SymbolTable based on ES6 Map interface. */ type SymbolTable = UnderscoreEscapedMap; enum TypeFlags { Any = 1, @@ -2252,7 +2110,6 @@ declare namespace ts { interface ObjectType extends Type { objectFlags: ObjectFlags; } - /** Class and interface types (ObjectFlags.Class and ObjectFlags.Interface). */ interface InterfaceType extends ObjectType { typeParameters: TypeParameter[] | undefined; outerTypeParameters: TypeParameter[] | undefined; @@ -2267,16 +2124,6 @@ declare namespace ts { declaredStringIndexInfo?: IndexInfo; declaredNumberIndexInfo?: IndexInfo; } - /** - * Type references (ObjectFlags.Reference). When a class or interface has type parameters or - * a "this" type, references to the class or interface are made using type references. The - * typeArguments property specifies the types to substitute for the type parameters of the - * class or interface and optionally includes an extra element that specifies the type to - * substitute for "this" in the resulting instantiation. When no extra argument is present, - * the type reference itself is substituted for "this". The typeArguments property is undefined - * if the class or interface has no type parameters and the reference isn't specifying an - * explicit "this" argument. - */ interface TypeReference extends ObjectType { target: GenericType; typeArguments?: ReadonlyArray; @@ -2369,7 +2216,6 @@ declare namespace ts { AlwaysStrict = 64, PriorityImpliesCombination = 28 } - /** @deprecated Use FileExtensionInfo instead. */ type JsFileExtensionInfo = FileExtensionInfo; interface FileExtensionInfo { extension: string; @@ -2383,12 +2229,6 @@ declare namespace ts { message: string; reportsUnnecessary?: {}; } - /** - * A linked list of formatted diagnostic messages to be used as part of a multiline message. - * It is built from the bottom up, leaving the head to be the "main" diagnostic. - * While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage, - * the difference is that messages are all preformatted in DMC. - */ interface DiagnosticMessageChain { messageText: string; category: DiagnosticCategory; @@ -2397,7 +2237,6 @@ declare namespace ts { } interface Diagnostic extends DiagnosticRelatedInformation { category: DiagnosticCategory; - /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ reportsUnnecessary?: {}; code: number; source?: string; @@ -2428,13 +2267,9 @@ declare namespace ts { name: string; } interface ProjectReference { - /** A normalized path on disk */ path: string; - /** The path as the user originally wrote it */ originalPath?: string; - /** True if the output of this reference should be prepended to the output of this project. Only valid for --outFile compilations */ prepend?: boolean; - /** True if it is intended that this reference form a circularity */ circular?: boolean; } type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport[] | ProjectReference[] | null | undefined; @@ -2511,7 +2346,6 @@ declare namespace ts { traceResolution?: boolean; resolveJsonModule?: boolean; types?: string[]; - /** Paths used to compute primary types search locations */ typeRoots?: string[]; esModuleInterop?: boolean; [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; @@ -2543,7 +2377,6 @@ declare namespace ts { LineFeed = 1 } interface LineAndCharacter { - /** 0-based. */ line: number; character: number; } @@ -2555,10 +2388,6 @@ declare namespace ts { TSX = 4, External = 5, JSON = 6, - /** - * Used on extensions that doesn't define the ScriptKind but the content defines it. - * Deferred extensions are going to be included in all project contexts. - */ Deferred = 7 } enum ScriptTarget { @@ -2576,7 +2405,6 @@ declare namespace ts { Standard = 0, JSX = 1 } - /** Either a parsed command line or a parsed tsconfig.json */ interface ParsedCommandLine { options: CompilerOptions; typeAcquisition?: TypeAcquisition; @@ -2617,57 +2445,21 @@ declare namespace ts { readFile(fileName: string): string | undefined; trace?(s: string): void; directoryExists?(directoryName: string): boolean; - /** - * Resolve a symbolic link. - * @see https://nodejs.org/api/fs.html#fs_fs_realpathsync_path_options - */ realpath?(path: string): string; getCurrentDirectory?(): string; getDirectories?(path: string): string[]; } - /** - * Represents the result of module resolution. - * Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off. - * The Program will then filter results based on these flags. - * - * Prefer to return a `ResolvedModuleFull` so that the file type does not have to be inferred. - */ interface ResolvedModule { - /** Path of the file the module was resolved to. */ resolvedFileName: string; - /** True if `resolvedFileName` comes from `node_modules`. */ isExternalLibraryImport?: boolean; } - /** - * ResolvedModule with an explicitly provided `extension` property. - * Prefer this over `ResolvedModule`. - * If changing this, remember to change `moduleResolutionIsEqualTo`. - */ interface ResolvedModuleFull extends ResolvedModule { - /** - * Extension of resolvedFileName. This must match what's at the end of resolvedFileName. - * This is optional for backwards-compatibility, but will be added if not provided. - */ extension: Extension; packageId?: PackageId; } - /** - * Unique identifier with a package name and version. - * If changing this, remember to change `packageIdIsEqual`. - */ interface PackageId { - /** - * Name of the package. - * Should not include `@types`. - * If accessing a non-index file, this should include its name e.g. "foo/bar". - */ name: string; - /** - * Name of a submodule within this package. - * May be "". - */ subModuleName: string; - /** Version of the package, e.g. "1.2.3" */ version: string; } enum Extension { @@ -2704,9 +2496,6 @@ declare namespace ts { getNewLine(): string; readDirectory?(rootDir: string, extensions: ReadonlyArray, excludes: ReadonlyArray | undefined, includes: ReadonlyArray, depth?: number): string[]; resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[]): (ResolvedModule | undefined)[]; - /** - * This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files - */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; getEnvironmentVariable?(name: string): string | undefined; createHash?(data: string): string; @@ -2768,163 +2557,42 @@ declare namespace ts { Unspecified = 4 } interface TransformationContext { - /** Gets the compiler options supplied to the transformer. */ getCompilerOptions(): CompilerOptions; - /** Starts a new lexical environment. */ startLexicalEnvironment(): void; - /** Suspends the current lexical environment, usually after visiting a parameter list. */ suspendLexicalEnvironment(): void; - /** Resumes a suspended lexical environment, usually before visiting a function body. */ resumeLexicalEnvironment(): void; - /** Ends a lexical environment, returning any declarations. */ endLexicalEnvironment(): Statement[] | undefined; - /** Hoists a function declaration to the containing scope. */ hoistFunctionDeclaration(node: FunctionDeclaration): void; - /** Hoists a variable declaration to the containing scope. */ hoistVariableDeclaration(node: Identifier): void; - /** Records a request for a non-scoped emit helper in the current context. */ requestEmitHelper(helper: EmitHelper): void; - /** Gets and resets the requested non-scoped emit helpers. */ readEmitHelpers(): EmitHelper[] | undefined; - /** Enables expression substitutions in the pretty printer for the provided SyntaxKind. */ enableSubstitution(kind: SyntaxKind): void; - /** Determines whether expression substitutions are enabled for the provided node. */ isSubstitutionEnabled(node: Node): boolean; - /** - * Hook used by transformers to substitute expressions just before they - * are emitted by the pretty printer. - * - * NOTE: Transformation hooks should only be modified during `Transformer` initialization, - * before returning the `NodeTransformer` callback. - */ onSubstituteNode: (hint: EmitHint, node: Node) => Node; - /** - * Enables before/after emit notifications in the pretty printer for the provided - * SyntaxKind. - */ enableEmitNotification(kind: SyntaxKind): void; - /** - * Determines whether before/after emit notifications should be raised in the pretty - * printer when it emits a node. - */ isEmitNotificationEnabled(node: Node): boolean; - /** - * Hook used to allow transformers to capture state before or after - * the printer emits a node. - * - * NOTE: Transformation hooks should only be modified during `Transformer` initialization, - * before returning the `NodeTransformer` callback. - */ onEmitNode: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void; } interface TransformationResult { - /** Gets the transformed source files. */ transformed: T[]; - /** Gets diagnostics for the transformation. */ diagnostics?: DiagnosticWithLocation[]; - /** - * Gets a substitute for a node, if one is available; otherwise, returns the original node. - * - * @param hint A hint as to the intended usage of the node. - * @param node The node to substitute. - */ substituteNode(hint: EmitHint, node: Node): Node; - /** - * Emits a node with possible notification. - * - * @param hint A hint as to the intended usage of the node. - * @param node The node to emit. - * @param emitCallback A callback used to emit the node. - */ emitNodeWithNotification(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; - /** - * Clean up EmitNode entries on any parse-tree nodes. - */ dispose(): void; } - /** - * A function that is used to initialize and return a `Transformer` callback, which in turn - * will be used to transform one or more nodes. - */ type TransformerFactory = (context: TransformationContext) => Transformer; - /** - * A function that transforms a node. - */ type Transformer = (node: T) => T; - /** - * A function that accepts and possibly transforms a node. - */ type Visitor = (node: Node) => VisitResult; type VisitResult = T | T[] | undefined; interface Printer { - /** - * Print a node and its subtree as-is, without any emit transformations. - * @param hint A value indicating the purpose of a node. This is primarily used to - * distinguish between an `Identifier` used in an expression position, versus an - * `Identifier` used as an `IdentifierName` as part of a declaration. For most nodes you - * should just pass `Unspecified`. - * @param node The node to print. The node and its subtree are printed as-is, without any - * emit transformations. - * @param sourceFile A source file that provides context for the node. The source text of - * the file is used to emit the original source content for literals and identifiers, while - * the identifiers of the source file are used when generating unique names to avoid - * collisions. - */ printNode(hint: EmitHint, node: Node, sourceFile: SourceFile): string; - /** - * Prints a list of nodes using the given format flags - */ printList(format: ListFormat, list: NodeArray, sourceFile: SourceFile): string; - /** - * Prints a source file as-is, without any emit transformations. - */ printFile(sourceFile: SourceFile): string; - /** - * Prints a bundle of source files as-is, without any emit transformations. - */ printBundle(bundle: Bundle): string; } interface PrintHandlers { - /** - * A hook used by the Printer when generating unique names to avoid collisions with - * globally defined names that exist outside of the current source file. - */ hasGlobalName?(name: string): boolean; - /** - * A hook used by the Printer to provide notifications prior to emitting a node. A - * compatible implementation **must** invoke `emitCallback` with the provided `hint` and - * `node` values. - * @param hint A hint indicating the intended purpose of the node. - * @param node The node to emit. - * @param emitCallback A callback that, when invoked, will emit the node. - * @example - * ```ts - * var printer = createPrinter(printerOptions, { - * onEmitNode(hint, node, emitCallback) { - * // set up or track state prior to emitting the node... - * emitCallback(hint, node); - * // restore state after emitting the node... - * } - * }); - * ``` - */ onEmitNode?(hint: EmitHint, node: Node | undefined, emitCallback: (hint: EmitHint, node: Node | undefined) => void): void; - /** - * A hook used by the Printer to perform just-in-time substitution of a node. This is - * primarily used by node transformations that need to substitute one node for another, - * such as replacing `myExportedVar` with `exports.myExportedVar`. - * @param hint A hint indicating the intended purpose of the node. - * @param node The node to emit. - * @example - * ```ts - * var printer = createPrinter(printerOptions, { - * substituteNode(hint, node) { - * // perform substitution if necessary... - * return node; - * } - * }); - * ``` - */ substituteNode?(hint: EmitHint, node: Node): Node; } interface PrinterOptions { @@ -2937,7 +2605,6 @@ declare namespace ts { directoryExists?(directoryName: string): boolean; getCurrentDirectory?(): string; } - /** @deprecated See comment on SymbolWriter */ interface SymbolTracker { trackSymbol?(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; reportInaccessibleThisError?(): void; @@ -3040,10 +2707,6 @@ declare namespace ts { readFile(path: string, encoding?: string): string | undefined; getFileSize?(path: string): number; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; - /** - * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that - * use native OS file watching - */ watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher; watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; resolvePath(path: string): string; @@ -3057,11 +2720,7 @@ declare namespace ts { getModifiedTime?(path: string): Date; setModifiedTime?(path: string, time: Date): void; deleteFile?(path: string): void; - /** - * A good implementation is node.js' `crypto.createHash`. (https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm) - */ createHash?(data: string): string; - /** This must be cryptographically secure. Only implement this method using `crypto.createHash("sha256")`. */ createSHA256Hash?(data: string): string; getMemoryUsage?(): number; exit(exitCode?: number): void; @@ -3115,7 +2774,6 @@ declare namespace ts { function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number; function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter; function isWhiteSpaceLike(ch: number): boolean; - /** Does not include line breaks. For that, see isWhiteSpaceLike. */ function isWhiteSpaceSingleLine(ch: number): boolean; function isLineBreak(ch: number): boolean; function couldStartTrivia(text: string, pos: number): boolean; @@ -3127,13 +2785,11 @@ declare namespace ts { function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U | undefined; function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined; function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined; - /** Optionally, get the shebang */ function getShebang(text: string): string | undefined; function isIdentifierStart(ch: number, languageVersion: ScriptTarget | undefined): boolean; function isIdentifierPart(ch: number, languageVersion: ScriptTarget | undefined): boolean; function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, textInitial?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; } -/** Non-internal stuff goes here */ declare namespace ts { function isExternalModuleNameRelative(moduleName: string): boolean; function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray): T[]; @@ -3157,14 +2813,6 @@ declare namespace ts { function textChangeRangeIsUnchanged(range: TextChangeRange): boolean; function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange; let unchangedTextChangeRange: TextChangeRange; - /** - * Called to merge all the changes that occurred across several versions of a script snapshot - * into a single change. i.e. if a user keeps making successive edits to a script we will - * have a text change from V1 to V2, V2 to V3, ..., Vn. - * - * This function will then merge those changes into a single change range valid between V1 and - * Vn. - */ function collapseTextChangeRangesAcrossMultipleVersions(changes: ReadonlyArray): TextChangeRange; function getTypeParameterOwner(d: Declaration): Declaration | undefined; type ParameterPropertyDeclaration = ParameterDeclaration & { @@ -3176,10 +2824,6 @@ declare namespace ts { function isEmptyBindingElement(node: BindingElement): boolean; function getCombinedModifierFlags(node: Node): ModifierFlags; function getCombinedNodeFlags(node: Node): NodeFlags; - /** - * Checks to see if the locale is in the appropriate format, - * and if it is, attempts to set the appropriate language. - */ function validateLocaleAndSetLanguage(locale: string, sys: { getExecutingFilePath(): string; resolvePath(path: string): string; @@ -3190,100 +2834,26 @@ declare namespace ts { function getOriginalNode(node: Node, nodeTest: (node: Node) => node is T): T; function getOriginalNode(node: Node | undefined): Node | undefined; function getOriginalNode(node: Node | undefined, nodeTest: (node: Node | undefined) => node is T): T | undefined; - /** - * Gets a value indicating whether a node originated in the parse tree. - * - * @param node The node to test. - */ function isParseTreeNode(node: Node): boolean; - /** - * Gets the original parse tree node for a node. - * - * @param node The original node. - * @returns The original parse tree node if found; otherwise, undefined. - */ function getParseTreeNode(node: Node): Node; - /** - * Gets the original parse tree node for a node. - * - * @param node The original node. - * @param nodeTest A callback used to ensure the correct type of parse tree node is returned. - * @returns The original parse tree node if found; otherwise, undefined. - */ function getParseTreeNode(node: Node | undefined, nodeTest?: (node: Node) => node is T): T | undefined; - /** - * Remove extra underscore from escaped identifier text content. - * - * @param identifier The escaped identifier text. - * @returns The unescaped identifier text. - */ function unescapeLeadingUnderscores(identifier: __String): string; function idText(identifier: Identifier): string; function symbolName(symbol: Symbol): string; - /** - * Remove extra underscore from escaped identifier text content. - * @deprecated Use `id.text` for the unescaped text. - * @param identifier The escaped identifier text. - * @returns The unescaped identifier text. - */ function unescapeIdentifier(id: string): string; function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | undefined; function getNameOfDeclaration(declaration: Declaration | Expression): DeclarationName | undefined; - /** - * Gets the JSDoc parameter tags for the node if present. - * - * @remarks Returns any JSDoc param tag that matches the provided - * parameter, whether a param tag on a containing function - * expression, or a param tag on a variable declaration whose - * initializer is the containing function. The tags closest to the - * node are returned first, so in the previous example, the param - * tag on the containing function expression would be first. - * - * Does not return tags for binding patterns, because JSDoc matches - * parameters by name and binding patterns do not have a name. - */ function getJSDocParameterTags(param: ParameterDeclaration): ReadonlyArray; - /** - * Return true if the node has JSDoc parameter tags. - * - * @remarks Includes parameter tags that are not directly on the node, - * for example on a variable declaration whose initializer is a function expression. - */ function hasJSDocParameterTags(node: FunctionLikeDeclaration | SignatureDeclaration): boolean; - /** Gets the JSDoc augments tag for the node if present */ function getJSDocAugmentsTag(node: Node): JSDocAugmentsTag | undefined; - /** Gets the JSDoc class tag for the node if present */ function getJSDocClassTag(node: Node): JSDocClassTag | undefined; - /** Gets the JSDoc this tag for the node if present */ function getJSDocThisTag(node: Node): JSDocThisTag | undefined; - /** Gets the JSDoc return tag for the node if present */ function getJSDocReturnTag(node: Node): JSDocReturnTag | undefined; - /** Gets the JSDoc template tag for the node if present */ function getJSDocTemplateTag(node: Node): JSDocTemplateTag | undefined; - /** Gets the JSDoc type tag for the node if present and valid */ function getJSDocTypeTag(node: Node): JSDocTypeTag | undefined; - /** - * Gets the type node for the node if provided via JSDoc. - * - * @remarks The search includes any JSDoc param tag that relates - * to the provided parameter, for example a type tag on the - * parameter itself, or a param tag on a containing function - * expression, or a param tag on a variable declaration whose - * initializer is the containing function. The tags closest to the - * node are examined first, so in the previous example, the type - * tag directly on the node would be returned. - */ function getJSDocType(node: Node): TypeNode | undefined; - /** - * Gets the return type node for the node if provided via JSDoc's return tag. - * - * @remarks `getJSDocReturnTag` just gets the whole JSDoc tag. This function - * gets the type from inside the braces. - */ function getJSDocReturnType(node: Node): TypeNode | undefined; - /** Get all JSDoc tags related to a node, including those on parent nodes. */ function getJSDocTags(node: Node): ReadonlyArray; - /** Gets all JSDoc tags of a specified kind, or undefined if not present. */ function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): ReadonlyArray; } declare namespace ts { @@ -3454,11 +3024,6 @@ declare namespace ts { function isJSDocSignature(node: Node): node is JSDocSignature; } declare namespace ts { - /** - * True if node is of some token syntax kind. - * For example, this is true for an IfKeyword but not for an IfStatement. - * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. - */ function isToken(n: Node): boolean; function isLiteralExpression(node: Node): node is LiteralExpression; type TemplateLiteralToken = NoSubstitutionTemplateLiteral | TemplateHead | TemplateMiddle | TemplateTail; @@ -3476,11 +3041,6 @@ declare namespace ts { function isTypeElement(node: Node): node is TypeElement; function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement; function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike; - /** - * Node test that determines whether a node is a valid type node. - * This differs from the `isPartOfTypeNode` function which determines whether a node is *part* - * of a TypeNode. - */ function isTypeNode(node: Node): node is TypeNode; function isFunctionOrConstructorTypeNode(node: Node): node is FunctionTypeNode | ConstructorTypeNode; function isPropertyAccessOrQualifiedName(node: Node): node is PropertyAccessExpression | QualifiedName; @@ -3492,7 +3052,6 @@ declare namespace ts { function isIterationStatement(node: Node, lookInLabeledStatements: boolean): node is IterationStatement | LabeledStatement; function isJsxOpeningLikeElement(node: Node): node is JsxOpeningLikeElement; function isCaseOrDefaultClause(node: Node): node is CaseOrDefaultClause; - /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node: Node): boolean; function isSetAccessor(node: Node): node is SetAccessorDeclaration; function isGetAccessor(node: Node): node is GetAccessorDeclaration; @@ -3501,27 +3060,9 @@ declare namespace ts { } declare namespace ts { function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; - /** - * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes - * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, - * embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns - * a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned. - * - * @param node a given node to visit its children - * @param cbNode a callback to be invoked for all child nodes - * @param cbNodes a callback to be invoked for embedded array - * - * @remarks `forEachChild` must visit the children of a node in the order - * that they appear in the source code. The language service depends on this property to locate nodes by position. - */ function forEachChild(node: Node, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined; function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile; function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName | undefined; - /** - * Parse json text into SyntaxTree and return node and parse errors if any - * @param fileName - * @param sourceText - */ function parseJsonText(fileName: string, sourceText: string): JsonSourceFile; function isExternalModule(file: SourceFile): boolean; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; @@ -3529,66 +3070,24 @@ declare namespace ts { declare namespace ts { function parseCommandLine(commandLine: ReadonlyArray, readFile?: (path: string) => string | undefined): ParsedCommandLine; type DiagnosticReporter = (diagnostic: Diagnostic) => void; - /** - * Reports config file diagnostics - */ interface ConfigFileDiagnosticsReporter { - /** - * Reports unrecoverable error when parsing config file - */ onUnRecoverableConfigFileDiagnostic: DiagnosticReporter; } - /** - * Interface extending ParseConfigHost to support ParseConfigFile that reads config file and reports errors - */ interface ParseConfigFileHost extends ParseConfigHost, ConfigFileDiagnosticsReporter { getCurrentDirectory(): string; } - /** - * Reads the config file, reports errors if any and exits if the config file cannot be found - */ function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost): ParsedCommandLine | undefined; - /** - * Read tsconfig.json file - * @param fileName The path to the config file - */ function readConfigFile(fileName: string, readFile: (path: string) => string | undefined): { config?: any; error?: Diagnostic; }; - /** - * Parse the text of the tsconfig.json file - * @param fileName The path to the config file - * @param jsonText The text of the config file - */ function parseConfigFileTextToJson(fileName: string, jsonText: string): { config?: any; error?: Diagnostic; }; - /** - * Read tsconfig.json file - * @param fileName The path to the config file - */ function readJsonConfigFile(fileName: string, readFile: (path: string) => string | undefined): TsConfigSourceFile; - /** - * Convert the json syntax tree into the json value - */ function convertToObject(sourceFile: JsonSourceFile, errors: Push): any; - /** - * Parse the contents of a config file (tsconfig.json). - * @param json The contents of the config file to parse - * @param host Instance of ParseConfigHost used to enumerate files in folder. - * @param basePath A root directory to resolve relative path entries in the config - * file to. e.g. outDir - */ function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; - /** - * Parse the contents of a config file (tsconfig.json). - * @param jsonNode The contents of the config file to parse - * @param host Instance of ParseConfigHost used to enumerate files in folder. - * @param basePath A root directory to resolve relative path entries in the config - * file to. e.g. outDir - */ function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; @@ -3601,32 +3100,11 @@ declare namespace ts { } declare namespace ts { function getEffectiveTypeRoots(options: CompilerOptions, host: GetEffectiveTypeRootsHost): string[] | undefined; - /** - * @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown. - * This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups - * is assumed to be the same as root directory of the project. - */ function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; - /** - * Given a set of options, returns the set of type directive names - * that should be included for this program automatically. - * This list could either come from the config file, - * or from enumerating the types root + initial secondary types lookup location. - * More type directives might appear in the program later as a result of loading actual source files; - * this list is only the set of defaults that are implicitly included. - */ function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[]; - /** - * Cached module resolutions per containing directory. - * This assumes that any module id will have the same resolution for sibling files located in the same folder. - */ interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache { getOrCreateCacheForDirectory(directoryName: string): Map; } - /** - * Stored map from non-relative module name to a table: directory -> result of module lookup in this directory - * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive. - */ interface NonRelativeModuleNameResolutionCache { getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache; } @@ -3642,7 +3120,6 @@ declare namespace ts { } declare namespace ts { function createNodeArray(elements?: ReadonlyArray, hasTrailingComma?: boolean): NodeArray; - /** If a node is passed, creates a string literal whose source text is read from a source node during emit. */ function createLiteral(value: string | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier): StringLiteral; function createLiteral(value: number): NumericLiteral; function createLiteral(value: boolean): BooleanLiteral; @@ -3652,17 +3129,11 @@ declare namespace ts { function createRegularExpressionLiteral(text: string): RegularExpressionLiteral; function createIdentifier(text: string): Identifier; function updateIdentifier(node: Identifier): Identifier; - /** Create a unique temporary variable. */ function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined): Identifier; - /** Create a unique temporary variable for use in a loop. */ function createLoopVariable(): Identifier; - /** Create a unique name based on the supplied text. */ function createUniqueName(text: string): Identifier; - /** Create a unique name based on the supplied text. */ function createOptimisticUniqueName(text: string): Identifier; - /** Create a unique name based on the supplied text. This does not consider names injected by the transformer. */ function createFileLevelUniqueName(text: string): Identifier; - /** Create a unique name generated for a node. */ function getGeneratedNameForNode(node: Node | undefined): Identifier; function createToken(token: TKind): Token; function createSuper(): SuperExpression; @@ -3935,25 +3406,8 @@ declare namespace ts { function createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember; function updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember; function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"], hasNoDefaultLib?: boolean, libReferences?: SourceFile["libReferenceDirectives"]): SourceFile; - /** - * Creates a shallow, memberwise clone of a node for mutation. - */ function getMutableClone(node: T): T; - /** - * Creates a synthetic statement to act as a placeholder for a not-emitted statement in - * order to preserve comments. - * - * @param original The original statement. - */ function createNotEmittedStatement(original: Node): NotEmittedStatement; - /** - * Creates a synthetic expression to act as a placeholder for a not-emitted expression in - * order to preserve comments or sourcemap positions. - * - * @param expression The inner expression to emit. - * @param original The original outer expression. - * @param location The location for the expression. Defaults to the positions from "original" if provided. - */ function createPartiallyEmittedExpression(expression: Expression, original?: Node): PartiallyEmittedExpression; function updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression; function createCommaList(elements: ReadonlyArray): CommaListExpression; @@ -3983,43 +3437,15 @@ declare namespace ts { function createVoidZero(): VoidExpression; function createExportDefault(expression: Expression): ExportAssignment; function createExternalModuleExport(exportName: Identifier): ExportDeclaration; - /** - * Clears any EmitNode entries from parse-tree nodes. - * @param sourceFile A source file. - */ function disposeEmitNodes(sourceFile: SourceFile): void; function setTextRange(range: T, location: TextRange | undefined): T; - /** - * Sets flags that control emit behavior of a node. - */ function setEmitFlags(node: T, emitFlags: EmitFlags): T; - /** - * Gets a custom text range to use when emitting source maps. - */ function getSourceMapRange(node: Node): SourceMapRange; - /** - * Sets a custom text range to use when emitting source maps. - */ function setSourceMapRange(node: T, range: SourceMapRange | undefined): T; - /** - * Create an external source map source file reference - */ function createSourceMapSource(fileName: string, text: string, skipTrivia?: (pos: number) => number): SourceMapSource; - /** - * Gets the TextRange to use for source maps for a token of a node. - */ function getTokenSourceMapRange(node: Node, token: SyntaxKind): SourceMapRange | undefined; - /** - * Sets the TextRange to use for source maps for a token of a node. - */ function setTokenSourceMapRange(node: T, token: SyntaxKind, range: SourceMapRange | undefined): T; - /** - * Gets a custom text range to use when emitting comments. - */ function getCommentRange(node: Node): TextRange; - /** - * Sets a custom text range to use when emitting comments. - */ function setCommentRange(node: T, range: TextRange): T; function getSyntheticLeadingComments(node: Node): SynthesizedComment[] | undefined; function setSyntheticLeadingComments(node: T, comments: SynthesizedComment[] | undefined): T; @@ -4028,115 +3454,26 @@ declare namespace ts { function setSyntheticTrailingComments(node: T, comments: SynthesizedComment[] | undefined): T; function addSyntheticTrailingComment(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T; function moveSyntheticComments(node: T, original: Node): T; - /** - * Gets the constant value to emit for an expression. - */ function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): string | number | undefined; - /** - * Sets the constant value to emit for an expression. - */ function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: string | number): PropertyAccessExpression | ElementAccessExpression; - /** - * Adds an EmitHelper to a node. - */ function addEmitHelper(node: T, helper: EmitHelper): T; - /** - * Add EmitHelpers to a node. - */ function addEmitHelpers(node: T, helpers: EmitHelper[] | undefined): T; - /** - * Removes an EmitHelper from a node. - */ function removeEmitHelper(node: Node, helper: EmitHelper): boolean; - /** - * Gets the EmitHelpers of a node. - */ function getEmitHelpers(node: Node): EmitHelper[] | undefined; - /** - * Moves matching emit helpers from a source node to a target node. - */ function moveEmitHelpers(source: Node, target: Node, predicate: (helper: EmitHelper) => boolean): void; function setOriginalNode(node: T, original: Node | undefined): T; } declare namespace ts { - /** - * Visits a Node using the supplied visitor, possibly returning a new Node in its place. - * - * @param node The Node to visit. - * @param visitor The callback used to visit the Node. - * @param test A callback to execute to verify the Node is valid. - * @param lift An optional callback to execute to lift a NodeArray into a valid Node. - */ function visitNode(node: T | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: NodeArray) => T): T; - /** - * Visits a Node using the supplied visitor, possibly returning a new Node in its place. - * - * @param node The Node to visit. - * @param visitor The callback used to visit the Node. - * @param test A callback to execute to verify the Node is valid. - * @param lift An optional callback to execute to lift a NodeArray into a valid Node. - */ function visitNode(node: T | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: NodeArray) => T): T | undefined; - /** - * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. - * - * @param nodes The NodeArray to visit. - * @param visitor The callback used to visit a Node. - * @param test A node test to execute for each node. - * @param start An optional value indicating the starting offset at which to start visiting. - * @param count An optional value indicating the maximum number of nodes to visit. - */ function visitNodes(nodes: NodeArray | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; - /** - * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. - * - * @param nodes The NodeArray to visit. - * @param visitor The callback used to visit a Node. - * @param test A node test to execute for each node. - * @param start An optional value indicating the starting offset at which to start visiting. - * @param count An optional value indicating the maximum number of nodes to visit. - */ function visitNodes(nodes: NodeArray | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; - /** - * Starts a new lexical environment and visits a statement list, ending the lexical environment - * and merging hoisted declarations upon completion. - */ function visitLexicalEnvironment(statements: NodeArray, visitor: Visitor, context: TransformationContext, start?: number, ensureUseStrict?: boolean): NodeArray; - /** - * Starts a new lexical environment and visits a parameter list, suspending the lexical - * environment upon completion. - */ function visitParameterList(nodes: NodeArray | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes): NodeArray; - /** - * Resumes a suspended lexical environment and visits a function body, ending the lexical - * environment and merging hoisted declarations upon completion. - */ function visitFunctionBody(node: FunctionBody, visitor: Visitor, context: TransformationContext): FunctionBody; - /** - * Resumes a suspended lexical environment and visits a function body, ending the lexical - * environment and merging hoisted declarations upon completion. - */ function visitFunctionBody(node: FunctionBody | undefined, visitor: Visitor, context: TransformationContext): FunctionBody | undefined; - /** - * Resumes a suspended lexical environment and visits a concise body, ending the lexical - * environment and merging hoisted declarations upon completion. - */ function visitFunctionBody(node: ConciseBody, visitor: Visitor, context: TransformationContext): ConciseBody; - /** - * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. - * - * @param node The Node whose children will be visited. - * @param visitor The callback used to visit each child. - * @param context A lexical environment context for the visitor. - */ function visitEachChild(node: T, visitor: Visitor, context: TransformationContext): T; - /** - * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. - * - * @param node The Node whose children will be visited. - * @param visitor The callback used to visit each child. - * @param context A lexical environment context for the visitor. - */ function visitEachChild(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined; } declare namespace ts { @@ -4157,35 +3494,8 @@ declare namespace ts { function formatDiagnosticsWithColorAndContext(diagnostics: ReadonlyArray, host: FormatDiagnosticsHost): string; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain | undefined, newLine: string): string; function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): ReadonlyArray; - /** - * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' - * that represent a compilation unit. - * - * Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and - * triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in. - * - * @param createProgramOptions - The options for creating a program. - * @returns A 'Program' object. - */ function createProgram(createProgramOptions: CreateProgramOptions): Program; - /** - * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' - * that represent a compilation unit. - * - * Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and - * triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in. - * - * @param rootNames - A set of root files. - * @param options - The compiler options which should be used. - * @param host - The host interacts with the underlying file system. - * @param oldProgram - Reuses an old program structure. - * @param configFileParsingDiagnostics - error during config file parsing - * @returns A 'Program' object. - */ function createProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: ReadonlyArray): Program; - /** - * Returns the target config filename of a project reference - */ function resolveProjectReferencePath(host: CompilerHost | UpToDateHost, ref: ProjectReference): ResolvedConfigFileName; } declare namespace ts { @@ -4205,137 +3515,43 @@ declare namespace ts { affected: SourceFile | Program; } | undefined; interface BuilderProgramHost { - /** - * return true if file names are treated with case sensitivity - */ useCaseSensitiveFileNames(): boolean; - /** - * If provided this would be used this hash instead of actual file shape text for detecting changes - */ createHash?: (data: string) => string; - /** - * When emit or emitNextAffectedFile are called without writeFile, - * this callback if present would be used to write files - */ writeFile?: WriteFileCallback; } - /** - * Builder to manage the program state changes - */ interface BuilderProgram { - /** - * Returns current program - */ getProgram(): Program; - /** - * Get compiler options of the program - */ getCompilerOptions(): CompilerOptions; - /** - * Get the source file in the program with file name - */ getSourceFile(fileName: string): SourceFile | undefined; - /** - * Get a list of files in the program - */ getSourceFiles(): ReadonlyArray; - /** - * Get the diagnostics for compiler options - */ getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; - /** - * Get the diagnostics that dont belong to any file - */ getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; - /** - * Get the diagnostics from config file parsing - */ getConfigFileParsingDiagnostics(): ReadonlyArray; - /** - * Get the syntax diagnostics, for all source files if source file is not supplied - */ getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; - /** - * Get all the dependencies of the file - */ getAllDependencies(sourceFile: SourceFile): ReadonlyArray; - /** - * Gets the semantic diagnostics from the program corresponding to this state of file (if provided) or whole program - * The semantic diagnostics are cached and managed here - * Note that it is assumed that when asked about semantic diagnostics through this API, - * the file has been taken out of affected files so it is safe to use cache or get from program and cache the diagnostics - * In case of SemanticDiagnosticsBuilderProgram if the source file is not provided, - * it will iterate through all the affected files, to ensure that cache stays valid and yet provide a way to get all semantic diagnostics - */ getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; - /** - * Emits the JavaScript and declaration files. - * When targetSource file is specified, emits the files corresponding to that source file, - * otherwise for the whole program. - * In case of EmitAndSemanticDiagnosticsBuilderProgram, when targetSourceFile is specified, - * it is assumed that that file is handled from affected file list. If targetSourceFile is not specified, - * it will only emit all the affected files instead of whole program - * - * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host - * in that order would be used to write the files - */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult; - /** - * Get the current directory of the program - */ getCurrentDirectory(): string; } - /** - * The builder that caches the semantic diagnostics for the program and handles the changed files and affected files - */ interface SemanticDiagnosticsBuilderProgram extends BuilderProgram { - /** - * Gets the semantic diagnostics from the program for the next affected file and caches it - * Returns undefined if the iteration is complete - */ getSemanticDiagnosticsOfNextAffectedFile(cancellationToken?: CancellationToken, ignoreSourceFile?: (sourceFile: SourceFile) => boolean): AffectedFileResult>; } - /** - * The builder that can handle the changes in program and iterate through changed file to emit the files - * The semantic diagnostics are cached per file and managed by clearing for the changed/affected files - */ interface EmitAndSemanticDiagnosticsBuilderProgram extends BuilderProgram { - /** - * Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete - * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host - * in that order would be used to write the files - */ emitNextAffectedFile(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): AffectedFileResult; } - /** - * Create the builder to manage semantic diagnostics and cache them - */ function createSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): SemanticDiagnosticsBuilderProgram; function createSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): SemanticDiagnosticsBuilderProgram; - /** - * Create the builder that can handle the changes in program and iterate through changed files - * to emit the those files and manage semantic diagnostics cache as well - */ function createEmitAndSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): EmitAndSemanticDiagnosticsBuilderProgram; function createEmitAndSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): EmitAndSemanticDiagnosticsBuilderProgram; - /** - * Creates a builder thats just abstraction over program and can be used with watch - */ function createAbstractBuilder(newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderProgram; function createAbstractBuilder(rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderProgram; } declare namespace ts { type WatchStatusReporter = (diagnostic: Diagnostic, newLine: string, options: CompilerOptions) => void; - /** Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program */ type CreateProgram = (rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: T, configFileParsingDiagnostics?: ReadonlyArray) => T; interface WatchCompilerHost { - /** - * Used to create the program when need for program creation or recreation detected - */ createProgram: CreateProgram; - /** If provided, callback to invoke after every new program creation */ afterProgramCreate?(program: T): void; - /** If provided, called with Diagnostic message that informs about change in watch status */ onWatchStatusChange?(diagnostic: Diagnostic, newLine: string, options: CompilerOptions): void; useCaseSensitiveFileNames(): boolean; getNewLine(): string; @@ -4343,92 +3559,41 @@ declare namespace ts { getDefaultLibFileName(options: CompilerOptions): string; getDefaultLibLocation?(): string; createHash?(data: string): string; - /** - * Use to check file presence for source files and - * if resolveModuleNames is not provided (complier is in charge of module resolution) then module files as well - */ fileExists(path: string): boolean; - /** - * Use to read file text for source files and - * if resolveModuleNames is not provided (complier is in charge of module resolution) then module files as well - */ readFile(path: string, encoding?: string): string | undefined; - /** If provided, used for module resolution as well as to handle directory structure */ directoryExists?(path: string): boolean; - /** If provided, used in resolutions as well as handling directory structure */ getDirectories?(path: string): string[]; - /** If provided, used to cache and handle directory structure modifications */ readDirectory?(path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray, depth?: number): string[]; - /** Symbol links resolution */ realpath?(path: string): string; - /** If provided would be used to write log about compilation */ trace?(s: string): void; - /** If provided is used to get the environment variable */ getEnvironmentVariable?(name: string): string | undefined; - /** If provided, used to resolve the module names, otherwise typescript's default module resolution */ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[]): ResolvedModule[]; - /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; - /** Used to watch changes in source files, missing files needed to update the program or config file */ watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher; - /** Used to watch resolved module's failed lookup locations, config file specs, type roots where auto type reference directives are added */ watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; - /** If provided, will be used to set delayed compilation, so that multiple changes in short span are compiled together */ setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; - /** If provided, will be used to reset existing delayed compilation */ clearTimeout?(timeoutId: any): void; } - /** - * Host to create watch with root files and options - */ interface WatchCompilerHostOfFilesAndCompilerOptions extends WatchCompilerHost { - /** root files to use to generate program */ rootFiles: string[]; - /** Compiler options */ options: CompilerOptions; } - /** - * Host to create watch with config file - */ interface WatchCompilerHostOfConfigFile extends WatchCompilerHost, ConfigFileDiagnosticsReporter { - /** Name of the config file to compile */ configFileName: string; - /** Options to extend */ optionsToExtend?: CompilerOptions; - /** - * Used to generate source file names from the config file and its include, exclude, files rules - * and also to cache the directory stucture - */ readDirectory(path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray, depth?: number): string[]; } interface Watch { - /** Synchronize with host and get updated program */ getProgram(): T; } - /** - * Creates the watch what generates program using the config file - */ interface WatchOfConfigFile extends Watch { } - /** - * Creates the watch that generates program using the root files and compiler options - */ interface WatchOfFilesAndCompilerOptions extends Watch { - /** Updates the root files in the program, only if this is not config file compilation */ updateRootFileNames(fileNames: string[]): void; } - /** - * Create the watch compiler host for either configFile or fileNames and its options - */ function createWatchCompilerHost(rootFiles: string[], options: CompilerOptions, system: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): WatchCompilerHostOfFilesAndCompilerOptions; function createWatchCompilerHost(configFileName: string, optionsToExtend: CompilerOptions | undefined, system: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): WatchCompilerHostOfConfigFile; - /** - * Creates the watch from the host for root files and compiler options - */ function createWatchProgram(host: WatchCompilerHostOfFilesAndCompilerOptions): WatchOfFilesAndCompilerOptions; - /** - * Creates the watch from the host for config file - */ function createWatchProgram(host: WatchCompilerHostOfConfigFile): WatchOfConfigFile; } declare namespace ts { @@ -4438,28 +3603,9 @@ declare namespace ts { errorDiagnostic(diag: Diagnostic): void; message(diag: DiagnosticMessage, ...args: string[]): void; } - /** - * A BuildContext tracks what's going on during the course of a build. - * - * Callers may invoke any number of build requests within the same context; - * until the context is reset, each project will only be built at most once. - * - * Example: In a standard setup where project B depends on project A, and both are out of date, - * a failed build of A will result in A remaining out of date. When we try to build - * B, we should immediately bail instead of recomputing A's up-to-date status again. - * - * This also matters for performing fast (i.e. fake) downstream builds of projects - * when their upstream .d.ts files haven't changed content (but have newer timestamps) - */ interface BuildContext { options: BuildOptions; - /** - * Map from output file name to its pre-build timestamp - */ unchangedOutputs: FileMap; - /** - * Map from config file name to up-to-date status - */ projectStatus: FileMap; invalidatedProjects: FileMap; queuedProjects: FileMap; @@ -4478,42 +3624,23 @@ declare namespace ts { enum UpToDateStatusType { Unbuildable = 0, UpToDate = 1, - /** - * The project appears out of date because its upstream inputs are newer than its outputs, - * but all of its outputs are actually newer than the previous identical outputs of its (.d.ts) inputs. - * This means we can Pseudo-build (just touch timestamps), as if we had actually built this project. - */ UpToDateWithUpstreamTypes = 2, OutputMissing = 3, OutOfDateWithSelf = 4, OutOfDateWithUpstream = 5, UpstreamOutOfDate = 6, UpstreamBlocked = 7, - /** - * Projects with no outputs (i.e. "solution" files) - */ ContainerOnly = 8 } type UpToDateStatus = Status.Unbuildable | Status.UpToDate | Status.OutputMissing | Status.OutOfDateWithSelf | Status.OutOfDateWithUpstream | Status.UpstreamOutOfDate | Status.UpstreamBlocked | Status.ContainerOnly; namespace Status { - /** - * The project can't be built at all in its current state. For example, - * its config file cannot be parsed, or it has a syntax error or missing file - */ interface Unbuildable { type: UpToDateStatusType.Unbuildable; reason: string; } - /** - * This project doesn't have any outputs, so "is it up to date" is a meaningless question. - */ interface ContainerOnly { type: UpToDateStatusType.ContainerOnly; } - /** - * The project is up to date with respect to its inputs. - * We track what the newest input file is. - */ interface UpToDate { type: UpToDateStatusType.UpToDate | UpToDateStatusType.UpToDateWithUpstreamTypes; newestInputFileTime: Date; @@ -4523,42 +3650,23 @@ declare namespace ts { newestOutputFileName: string; oldestOutputFileName: string; } - /** - * One or more of the outputs of the project does not exist. - */ interface OutputMissing { type: UpToDateStatusType.OutputMissing; - /** - * The name of the first output file that didn't exist - */ missingOutputFileName: string; } - /** - * One or more of the project's outputs is older than its newest input. - */ interface OutOfDateWithSelf { type: UpToDateStatusType.OutOfDateWithSelf; outOfDateOutputFileName: string; newerInputFileName: string; } - /** - * This project depends on an out-of-date project, so shouldn't be built yet - */ interface UpstreamOutOfDate { type: UpToDateStatusType.UpstreamOutOfDate; upstreamProjectName: string; } - /** - * This project depends an upstream project with build errors - */ interface UpstreamBlocked { type: UpToDateStatusType.UpstreamBlocked; upstreamProjectName: string; } - /** - * One or more of the project's outputs is older than the newest output of - * an upstream project. - */ interface OutOfDateWithUpstream { type: UpToDateStatusType.OutOfDateWithUpstream; outOfDateOutputFileName: string; @@ -4581,10 +3689,6 @@ declare namespace ts { }; function createBuildContext(options: BuildOptions): BuildContext; function performBuild(args: string[], compilerHost: CompilerHost, buildHost: BuildHost, system?: System): number | undefined; - /** - * A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but - * can dynamically add/remove other projects based on changes on the rootNames' references - */ function createSolutionBuilder(compilerHost: CompilerHost, buildHost: BuildHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions, system?: System): { buildAllProjects: () => ExitStatus; getUpToDateStatus: (project: ParsedCommandLine | undefined) => UpToDateStatus; @@ -4598,13 +3702,84 @@ declare namespace ts { resolveProjectName: (name: string) => ResolvedConfigFileName | undefined; startWatching: () => void; }; - /** - * Gets the UpToDateStatus for a project - */ function getUpToDateStatus(host: UpToDateHost, project: ParsedCommandLine | undefined): UpToDateStatus; function getAllProjectOutputs(project: ParsedCommandLine): ReadonlyArray; function formatUpToDateStatus(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T): T | undefined; } +declare namespace ts.server { + type ActionSet = "action::set"; + type ActionInvalidate = "action::invalidate"; + type ActionPackageInstalled = "action::packageInstalled"; + type EventTypesRegistry = "event::typesRegistry"; + type EventBeginInstallTypes = "event::beginInstallTypes"; + type EventEndInstallTypes = "event::endInstallTypes"; + type EventInitializationFailed = "event::initializationFailed"; + interface SortedReadonlyArray extends ReadonlyArray { + " __sortedArrayBrand": any; + } + interface TypingInstallerResponse { + readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed; + } + interface TypingInstallerRequestWithProjectName { + readonly projectName: string; + } + interface DiscoverTypings extends TypingInstallerRequestWithProjectName { + readonly fileNames: string[]; + readonly projectRootPath: Path; + readonly compilerOptions: CompilerOptions; + readonly typeAcquisition: TypeAcquisition; + readonly unresolvedImports: SortedReadonlyArray; + readonly cachePath?: string; + readonly kind: "discover"; + } + interface CloseProject extends TypingInstallerRequestWithProjectName { + readonly kind: "closeProject"; + } + interface TypesRegistryRequest { + readonly kind: "typesRegistry"; + } + interface InstallPackageRequest extends TypingInstallerRequestWithProjectName { + readonly kind: "installPackage"; + readonly fileName: Path; + readonly packageName: string; + readonly projectRootPath: Path; + } + interface PackageInstalledResponse extends ProjectResponse { + readonly kind: ActionPackageInstalled; + readonly success: boolean; + readonly message: string; + } + interface InitializationFailedResponse extends TypingInstallerResponse { + readonly kind: EventInitializationFailed; + readonly message: string; + } + interface ProjectResponse extends TypingInstallerResponse { + readonly projectName: string; + } + interface InvalidateCachedTypings extends ProjectResponse { + readonly kind: ActionInvalidate; + } + interface InstallTypes extends ProjectResponse { + readonly kind: EventBeginInstallTypes | EventEndInstallTypes; + readonly eventId: number; + readonly typingsInstallerVersion: string; + readonly packagesToInstall: ReadonlyArray; + } + interface BeginInstallTypes extends InstallTypes { + readonly kind: EventBeginInstallTypes; + } + interface EndInstallTypes extends InstallTypes { + readonly kind: EventEndInstallTypes; + readonly installSuccess: boolean; + } + interface SetTypings extends ProjectResponse { + readonly typeAcquisition: TypeAcquisition; + readonly compilerOptions: CompilerOptions; + readonly typings: string[]; + readonly unresolvedImports: SortedReadonlyArray; + readonly kind: ActionSet; + } +} declare namespace ts { interface Node { getSourceFile(): SourceFile; @@ -4680,25 +3855,10 @@ declare namespace ts { interface SourceMapSource { getLineAndCharacterOfPosition(pos: number): LineAndCharacter; } - /** - * Represents an immutable snapshot of a script at a specified time.Once acquired, the - * snapshot is observably immutable. i.e. the same calls with the same parameters will return - * the same values. - */ interface IScriptSnapshot { - /** Gets a portion of the script snapshot specified by [start, end). */ getText(start: number, end: number): string; - /** Gets the length of this script snapshot. */ getLength(): number; - /** - * Gets the TextChangeRange that describe how the text changed between this text and - * an older version. This information is used by the incremental parser to determine - * what sections of the script need to be re-parsed. 'undefined' can be returned if the - * change range cannot be determined. However, in that case, incremental parsing will - * not happen and the entire document will be re - parsed. - */ getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined; - /** Releases all resources held by this script snapshot */ dispose?(): void; } namespace ScriptSnapshot { @@ -4745,9 +3905,6 @@ declare namespace ts { getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined; resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; getDirectories?(directoryName: string): string[]; - /** - * Gets a set of custom transformers to use during emit. - */ getCustomTransformers?(): CustomTransformers | undefined; isKnownTypesPackageName?(name: string): boolean; installPackage?(options: InstallPackageOptions): Promise; @@ -4763,17 +3920,10 @@ declare namespace ts { interface LanguageService { cleanupSemanticCache(): void; getSyntacticDiagnostics(fileName: string): DiagnosticWithLocation[]; - /** The first time this is called, it will return global diagnostics (no location). */ getSemanticDiagnostics(fileName: string): Diagnostic[]; getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[]; getCompilerOptionsDiagnostics(): Diagnostic[]; - /** - * @deprecated Use getEncodedSyntacticClassifications instead. - */ getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; - /** - * @deprecated Use getEncodedSemanticClassifications instead. - */ getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications; getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; @@ -4793,7 +3943,6 @@ declare namespace ts { getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] | undefined; findReferences(fileName: string, position: number): ReferencedSymbol[] | undefined; getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[] | undefined; - /** @deprecated */ getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] | undefined; getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles?: boolean): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; @@ -4807,10 +3956,6 @@ declare namespace ts { getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion | undefined; isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; - /** - * This will return a defined result if the position is after the `>` of the opening tag, or somewhere in the text, of a JSXElement with no closing tag. - * Editors should call this after `>` is typed. - */ getJsxClosingTagAtPosition(fileName: string, position: number): JsxClosingTagInfo | undefined; getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan | undefined; toLineColumnOffset?(fileName: string, position: number): LineAndCharacter; @@ -4819,11 +3964,8 @@ declare namespace ts { applyCodeActionCommand(action: CodeActionCommand): Promise; applyCodeActionCommand(action: CodeActionCommand[]): Promise; applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[]): Promise; - /** @deprecated `fileName` will be ignored */ applyCodeActionCommand(fileName: string, action: CodeActionCommand): Promise; - /** @deprecated `fileName` will be ignored */ applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise; - /** @deprecated `fileName` will be ignored */ applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise; getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined): ApplicableRefactorInfo[]; getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined; @@ -4843,11 +3985,8 @@ declare namespace ts { type OrganizeImportsScope = CombinedCodeFixScope; type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<"; interface GetCompletionsAtPositionOptions extends UserPreferences { - /** If the editor is asking for completions because a certain character was typed, and not because the user explicitly requested them, this should be set. */ triggerCharacter?: CompletionsTriggerCharacter; - /** @deprecated Use includeCompletionsForModuleExports */ includeExternalModuleExports?: boolean; - /** @deprecated Use includeCompletionsWithInsertText */ includeInsertTextCompletions?: boolean; } interface ApplyCodeActionCommandResult { @@ -4861,12 +4000,6 @@ declare namespace ts { textSpan: TextSpan; classificationType: ClassificationTypeNames; } - /** - * Navigation bar interface designed for visual studio's dual-column layout. - * This does not form a proper tree. - * The navbar is returned as a list of top-level items, each of which has a list of child items. - * Child items always have an empty array for their `childItems`. - */ interface NavigationBarItem { text: string; kind: ScriptElementKind; @@ -4877,23 +4010,12 @@ declare namespace ts { bolded: boolean; grayed: boolean; } - /** - * Node in a tree of nested declarations in a file. - * The top node is always a script or module node. - */ interface NavigationTree { - /** Name of the declaration, or a short description, e.g. "". */ text: string; kind: ScriptElementKind; - /** ScriptElementKindModifier separated by commas, e.g. "public,abstract" */ kindModifiers: string; - /** - * Spans of the nodes that generated this declaration. - * There will be more than one if this is the result of merging. - */ spans: TextSpan[]; nameSpan: TextSpan | undefined; - /** Present if non-empty */ childItems?: NavigationTree[]; } interface TodoCommentDescriptor { @@ -4915,23 +4037,12 @@ declare namespace ts { isNewFile?: boolean; } interface CodeAction { - /** Description of the code action to display in the UI of the editor */ description: string; - /** Text changes to apply to each file as part of the code action */ changes: FileTextChanges[]; - /** - * If the user accepts the code fix, the editor should send the action back in a `applyAction` request. - * This allows the language service to have side effects (e.g. installing dependencies) upon a code fix. - */ commands?: CodeActionCommand[]; } interface CodeFixAction extends CodeAction { - /** Short name to identify the fix, for use by telemetry. */ fixName: string; - /** - * If present, one may call 'getCombinedCodeFix' with this fixId. - * This may be omitted to indicate that the code fix can't be applied in a group. - */ fixId?: {}; fixAllDescription?: string; } @@ -4942,49 +4053,16 @@ declare namespace ts { type CodeActionCommand = InstallPackageAction; interface InstallPackageAction { } - /** - * A set of one or more available refactoring actions, grouped under a parent refactoring. - */ interface ApplicableRefactorInfo { - /** - * The programmatic name of the refactoring - */ name: string; - /** - * A description of this refactoring category to show to the user. - * If the refactoring gets inlined (see below), this text will not be visible. - */ description: string; - /** - * Inlineable refactorings can have their actions hoisted out to the top level - * of a context menu. Non-inlineanable refactorings should always be shown inside - * their parent grouping. - * - * If not specified, this value is assumed to be 'true' - */ inlineable?: boolean; actions: RefactorActionInfo[]; } - /** - * Represents a single refactoring action - for example, the "Extract Method..." refactor might - * offer several actions, each corresponding to a surround class or closure to extract into. - */ interface RefactorActionInfo { - /** - * The programmatic name of the refactoring action - */ name: string; - /** - * A description of this refactoring action to show to the user. - * If the parent refactoring is inlined away, this will be the only text shown, - * so this description should make sense by itself if the parent is inlineable=true - */ description: string; } - /** - * A set of edits to make in response to a refactor action, plus an optional - * location where renaming should be invoked from - */ interface RefactorEditInfo { edits: FileTextChanges[]; renameFilename?: string; @@ -4993,16 +4071,11 @@ declare namespace ts { } interface TextInsertion { newText: string; - /** The position in newText the caret should point to after the insertion. */ caretOffset: number; } interface DocumentSpan { textSpan: TextSpan; fileName: string; - /** - * If the span represents a location that was remapped (e.g. via a .d.ts.map file), - * then the original filename and span will be specified here - */ originalTextSpan?: TextSpan; originalFileName?: string; } @@ -5174,13 +4247,6 @@ declare namespace ts { displayParts: SymbolDisplayPart[]; isOptional: boolean; } - /** - * Represents a single signature to show in signature help. - * The id is used for subsequent calls into the language service to ask questions about the - * signature help item in the context of any documents that have been updated. i.e. after - * an edit has happened, while signature help is still active, the host can ask important - * questions like 'what parameter is the user currently contained within?'. - */ interface SignatureHelpItem { isVariadic: boolean; prefixDisplayParts: SymbolDisplayPart[]; @@ -5190,9 +4256,6 @@ declare namespace ts { documentation: SymbolDisplayPart[]; tags: JSDocTagInfo[]; } - /** - * Represents a set of signature help items, and the preferred item that should be selected. - */ interface SignatureHelpItems { items: SignatureHelpItem[]; applicableSpan: TextSpan; @@ -5201,12 +4264,8 @@ declare namespace ts { argumentCount: number; } interface CompletionInfo { - /** Not true for all glboal completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. */ isGlobalCompletion: boolean; isMemberCompletion: boolean; - /** - * true when the current location also allows for a new identifier - */ isNewIdentifierLocation: boolean; entries: CompletionEntry[]; } @@ -5216,11 +4275,6 @@ declare namespace ts { kindModifiers?: string; sortText: string; insertText?: string; - /** - * An optional span that indicates the text to be replaced by this completion item. - * If present, this span should be used instead of the default one. - * It will be set if the required span differs from the one generated by the default replacement behavior. - */ replacementSpan?: TextSpan; hasAction?: true; source?: string; @@ -5237,30 +4291,16 @@ declare namespace ts { source?: SymbolDisplayPart[]; } interface OutliningSpan { - /** The span of the document to actually collapse. */ textSpan: TextSpan; - /** The span of the document to display when the user hovers over the collapsed span. */ hintSpan: TextSpan; - /** The text to display in the editor for the collapsed region. */ bannerText: string; - /** - * Whether or not this region should be automatically collapsed when - * the 'Collapse to Definitions' command is invoked. - */ autoCollapse: boolean; - /** - * Classification of the contents of the span - */ kind: OutliningSpanKind; } enum OutliningSpanKind { - /** Single or multi-line comments */ Comment = "comment", - /** Sections marked by '// #region' and '// #endregion' comments */ Region = "region", - /** Declarations and expressions */ Code = "code", - /** Contiguous blocks of import declarations */ Imports = "imports" } enum OutputFileType { @@ -5297,82 +4337,33 @@ declare namespace ts { classification: TokenClass; } interface Classifier { - /** - * Gives lexical classifications of tokens on a line without any syntactic context. - * For instance, a token consisting of the text 'string' can be either an identifier - * named 'string' or the keyword 'string', however, because this classifier is not aware, - * it relies on certain heuristics to give acceptable results. For classifications where - * speed trumps accuracy, this function is preferable; however, for true accuracy, the - * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the - * lexical, syntactic, and semantic classifiers may issue the best user experience. - * - * @param text The text of a line to classify. - * @param lexState The state of the lexical classifier at the end of the previous line. - * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. - * If there is no syntactic classifier (syntacticClassifierAbsent=true), - * certain heuristics may be used in its place; however, if there is a - * syntactic classifier (syntacticClassifierAbsent=false), certain - * classifications which may be incorrectly categorized will be given - * back as Identifiers in order to allow the syntactic classifier to - * subsume the classification. - * @deprecated Use getLexicalClassifications instead. - */ getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications; } enum ScriptElementKind { unknown = "", warning = "warning", - /** predefined type (void) or keyword (class) */ keyword = "keyword", - /** top level script node */ scriptElement = "script", - /** module foo {} */ moduleElement = "module", - /** class X {} */ classElement = "class", - /** var x = class X {} */ localClassElement = "local class", - /** interface Y {} */ interfaceElement = "interface", - /** type T = ... */ typeElement = "type", - /** enum E */ enumElement = "enum", enumMemberElement = "enum member", - /** - * Inside module and script only - * const v = .. - */ variableElement = "var", - /** Inside function */ localVariableElement = "local var", - /** - * Inside module and script only - * function f() { } - */ functionElement = "function", - /** Inside function */ localFunctionElement = "local function", - /** class X { [public|private]* foo() {} } */ memberFunctionElement = "method", - /** class X { [public|private]* [get|set] foo:number; } */ memberGetAccessorElement = "getter", memberSetAccessorElement = "setter", - /** - * class X { [public|private]* foo:number; } - * interface Y { foo:number; } - */ memberVariableElement = "property", - /** class X { constructor() { } } */ constructorImplementationElement = "constructor", - /** interface Y { ():number; } */ callSignatureElement = "call", - /** interface Y { []:number; } */ indexSignatureElement = "index", - /** interface Y { new():Y; } */ constructSignatureElement = "construct", - /** function foo(*Y*: string) */ parameterElement = "parameter", typeParameterElement = "type parameter", primitiveType = "primitive type", @@ -5382,11 +4373,7 @@ declare namespace ts { letElement = "let", directory = "directory", externalModuleName = "external module name", - /** - * - */ jsxAttribute = "JSX attribute", - /** String literal */ string = "string" } enum ScriptElementKindModifier { @@ -5456,62 +4443,12 @@ declare namespace ts { function createClassifier(): Classifier; } declare namespace ts { - /** - * The document registry represents a store of SourceFile objects that can be shared between - * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) - * of files in the context. - * SourceFile objects account for most of the memory usage by the language service. Sharing - * the same DocumentRegistry instance between different instances of LanguageService allow - * for more efficient memory utilization since all projects will share at least the library - * file (lib.d.ts). - * - * A more advanced use of the document registry is to serialize sourceFile objects to disk - * and re-hydrate them when needed. - * - * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it - * to all subsequent createLanguageService calls. - */ interface DocumentRegistry { - /** - * Request a stored SourceFile with a given fileName and compilationSettings. - * The first call to acquire will call createLanguageServiceSourceFile to generate - * the SourceFile if was not found in the registry. - * - * @param fileName The name of the file requested - * @param compilationSettings Some compilation settings like target affects the - * shape of a the resulting SourceFile. This allows the DocumentRegistry to store - * multiple copies of the same file for different compilation settings. - * @param scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @param version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - */ acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; - /** - * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile - * to get an updated SourceFile. - * - * @param fileName The name of the file requested - * @param compilationSettings Some compilation settings like target affects the - * shape of a the resulting SourceFile. This allows the DocumentRegistry to store - * multiple copies of the same file for different compilation settings. - * @param scriptSnapshot Text of the file. - * @param version Current version of the file. - */ updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey; - /** - * Informs the DocumentRegistry that a file is not needed any longer. - * - * Note: It is not allowed to call release on a SourceFile that was not acquired from - * this registry originally. - * - * @param fileName The name of the file to be released - * @param compilationSettings The compilation settings used to acquire the file - */ releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; reportStats(): string; @@ -5542,7 +4479,6 @@ declare namespace ts { function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; } declare namespace ts { - /** The version of the language service API */ const servicesVersion = "0.8"; function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings; function displayPartsToString(displayParts: SymbolDisplayPart[] | undefined): string; @@ -5552,21 +4488,10 @@ declare namespace ts { let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange | undefined, aggressiveChecks?: boolean): SourceFile; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry, syntaxOnly?: boolean): LanguageService; - /** - * Get the path of the default library files (lib.d.ts) as distributed with the typescript - * node package. - * The functionality is not supported if the ts module is consumed outside of a node module. - */ function getDefaultLibFilePath(options: CompilerOptions): string; } declare namespace ts { - /** - * Transform one or more nodes using the supplied transformers. - * @param source A single `Node` or an array of `Node` objects. - * @param transformers An array of `TransformerFactory` callbacks used to process the transformation. - * @param compilerOptions Optional compiler options. - */ function transform(source: T | T[], transformers: TransformerFactory[], compilerOptions?: CompilerOptions): TransformationResult; } //# sourceMappingURL=typescriptServices.d.ts.map -export = ts \ No newline at end of file +export = ts; \ No newline at end of file From 95a2055a7db46348184adbb9933e5f60e4d62fc4 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 3 Jul 2018 12:22:00 -0700 Subject: [PATCH 02/10] Extract semicolon-omitting writer from printer --- src/compiler/checker.ts | 5 ++- src/compiler/emitter.ts | 69 +++++++++++++++++------------------- src/compiler/types.ts | 1 + src/compiler/utilities.ts | 70 ++++++++++++++++++++++++++++++++++++- src/services/textChanges.ts | 4 +++ src/services/utilities.ts | 1 + 6 files changed, 111 insertions(+), 39 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e3a0fee79b3e7..445c485f30edd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -763,6 +763,9 @@ namespace ts { writePunctuation(text) { return underlying.writePunctuation(text); }, + writeTrailingSemicolon(text) { + return underlying.writePunctuation(text); + }, writeSpace(text) { return underlying.writeSpace(text); }, @@ -3025,7 +3028,7 @@ namespace ts { const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.WriteTypeParametersInQualifiedName); const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true }); const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration); - printer.writeNode(EmitHint.Unspecified, sig!, /*sourceFile*/ sourceFile, writer); // TODO: GH#18217 + printer.writeNode(EmitHint.Unspecified, sig!, /*sourceFile*/ sourceFile, getTrailingSemicolonOmittingWriter(writer)); // TODO: GH#18217 return writer; } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 641c9a0953f30..102b6cf1a0ea8 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -159,8 +159,19 @@ namespace ts { // Transform the source files const transform = transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], transformers!, /*allowDtsFiles*/ false); + const printerOptions: PrinterOptions = { + removeComments: compilerOptions.removeComments, + newLine: compilerOptions.newLine, + noEmitHelpers: compilerOptions.noEmitHelpers, + module: compilerOptions.module, + target: compilerOptions.target, + sourceMap: compilerOptions.sourceMap, + inlineSourceMap: compilerOptions.inlineSourceMap, + extendedDiagnostics: compilerOptions.extendedDiagnostics, + }; + // Create a printer to print the nodes - const printer = createPrinter({ ...compilerOptions, noEmitHelpers: compilerOptions.noEmitHelpers } as PrinterOptions, { + const printer = createPrinter(printerOptions, { // resolver hooks hasGlobalName: resolver.hasGlobalName, @@ -203,7 +214,20 @@ namespace ts { emitterDiagnostics.add(diagnostic); } } - const declarationPrinter = createPrinter({ ...compilerOptions, onlyPrintJsDocStyle: true, noEmitHelpers: true } as PrinterOptions, { + + const printerOptions: PrinterOptions = { + removeComments: compilerOptions.removeComments, + newLine: compilerOptions.newLine, + noEmitHelpers: true, + module: compilerOptions.module, + target: compilerOptions.target, + sourceMap: compilerOptions.sourceMap, + inlineSourceMap: compilerOptions.inlineSourceMap, + extendedDiagnostics: compilerOptions.extendedDiagnostics, + onlyPrintJsDocStyle: true, + }; + + const declarationPrinter = createPrinter(printerOptions, { // resolver hooks hasGlobalName: resolver.hasGlobalName, @@ -333,13 +357,6 @@ namespace ts { let writer: EmitTextWriter; let ownWriter: EmitTextWriter; let write = writeBase; - let commitPendingSemicolon: typeof commitPendingSemicolonInternal = noop; - let writeSemicolon: typeof writeSemicolonInternal = writeSemicolonInternal; - let pendingSemicolon = false; - if (printerOptions.omitTrailingSemicolon) { - commitPendingSemicolon = commitPendingSemicolonInternal; - writeSemicolon = deferWriteSemicolon; - } const syntheticParent: TextRange = { pos: -1, end: -1 }; const moduleKind = getEmitModuleKind(printerOptions); const bundledHelpers = createMap(); @@ -497,6 +514,9 @@ namespace ts { } function setWriter(output: EmitTextWriter | undefined) { + if (output && printerOptions.omitTrailingSemicolon) { + output = getTrailingSemicolonOmittingWriter(output); + } writer = output!; // TODO: GH#18217 comments.setWriter(output!); } @@ -2413,8 +2433,7 @@ namespace ts { } function emitJsxText(node: JsxText) { - commitPendingSemicolon(); - writer.writeLiteral(getTextOfNode(node, /*includeTrivia*/ true)); + writeLiteral(getTextOfNode(node, /*includeTrivia*/ true)); } function emitJsxClosingElementOrFragment(node: JsxClosingElement | JsxClosingFragment) { @@ -3014,83 +3033,59 @@ namespace ts { } } - function commitPendingSemicolonInternal() { - if (pendingSemicolon) { - writeSemicolonInternal(); - pendingSemicolon = false; - } - } - function writeLiteral(s: string) { - commitPendingSemicolon(); writer.writeLiteral(s); } function writeStringLiteral(s: string) { - commitPendingSemicolon(); writer.writeStringLiteral(s); } function writeBase(s: string) { - commitPendingSemicolon(); writer.write(s); } function writeSymbol(s: string, sym: Symbol) { - commitPendingSemicolon(); writer.writeSymbol(s, sym); } function writePunctuation(s: string) { - commitPendingSemicolon(); writer.writePunctuation(s); } - function deferWriteSemicolon() { - pendingSemicolon = true; - } - - function writeSemicolonInternal() { - writer.writePunctuation(";"); + function writeSemicolon() { + writer.writeTrailingSemicolon(";"); } function writeKeyword(s: string) { - commitPendingSemicolon(); writer.writeKeyword(s); } function writeOperator(s: string) { - commitPendingSemicolon(); writer.writeOperator(s); } function writeParameter(s: string) { - commitPendingSemicolon(); writer.writeParameter(s); } function writeSpace() { - commitPendingSemicolon(); writer.writeSpace(" "); } function writeProperty(s: string) { - commitPendingSemicolon(); writer.writeProperty(s); } function writeLine() { - commitPendingSemicolon(); writer.writeLine(); } function increaseIndent() { - commitPendingSemicolon(); writer.increaseIndent(); } function decreaseIndent() { - commitPendingSemicolon(); writer.decreaseIndent(); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 55e2b1d24adee..b5519bb4d8489 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5296,6 +5296,7 @@ namespace ts { export interface EmitTextWriter extends SymbolWriter { write(s: string): void; writeTextOfNode(text: string, node: Node): void; + writeTrailingSemicolon(text: string): void; getText(): string; rawWrite(s: string): void; writeLiteral(s: string): void; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9c933b44d0155..546ed2f6261b4 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -73,6 +73,7 @@ namespace ts { writeParameter: writeText, writeProperty: writeText, writeSymbol: writeText, + writeTrailingSemicolon: writeText, getTextPos: () => str.length, getLine: () => 0, getColumn: () => 0, @@ -3117,7 +3118,74 @@ namespace ts { writePunctuation: write, writeSpace: write, writeStringLiteral: write, - writeSymbol: write + writeSymbol: write, + writeTrailingSemicolon: write + }; + } + + export function getTrailingSemicolonOmittingWriter(writer: EmitTextWriter): EmitTextWriter { + let pendingTrailingSemicolon = false; + + function commitPendingTrailingSemicolon() { + if (pendingTrailingSemicolon) { + writer.writeTrailingSemicolon(";"); + pendingTrailingSemicolon = false; + } + } + + return { + ...writer, + writeTrailingSemicolon() { + pendingTrailingSemicolon = true; + }, + writeLiteral(s) { + commitPendingTrailingSemicolon(); + writer.writeLiteral(s); + }, + writeStringLiteral(s) { + commitPendingTrailingSemicolon(); + writer.writeStringLiteral(s); + }, + writeSymbol(s, sym) { + commitPendingTrailingSemicolon(); + writer.writeSymbol(s, sym); + }, + writePunctuation(s) { + commitPendingTrailingSemicolon(); + writer.writePunctuation(s); + }, + writeKeyword(s) { + commitPendingTrailingSemicolon(); + writer.writeKeyword(s); + }, + writeOperator(s) { + commitPendingTrailingSemicolon(); + writer.writeOperator(s); + }, + writeParameter(s) { + commitPendingTrailingSemicolon(); + writer.writeParameter(s); + }, + writeSpace(s) { + commitPendingTrailingSemicolon(); + writer.writeSpace(s); + }, + writeProperty(s) { + commitPendingTrailingSemicolon(); + writer.writeProperty(s); + }, + writeLine() { + commitPendingTrailingSemicolon(); + writer.writeLine(); + }, + increaseIndent() { + commitPendingTrailingSemicolon(); + writer.increaseIndent(); + }, + decreaseIndent() { + commitPendingTrailingSemicolon(); + writer.decreaseIndent(); + } }; } diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 3001f5cf44e3d..cd6810e5dd34f 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -907,6 +907,10 @@ namespace ts.textChanges { this.writer.writePunctuation(s); this.setLastNonTriviaPosition(s, /*force*/ false); } + writeTrailingSemicolon(s: string): void { + this.writer.writeTrailingSemicolon(s); + this.setLastNonTriviaPosition(s, /*force*/ false); + } writeParameter(s: string): void { this.writer.writeParameter(s); this.setLastNonTriviaPosition(s, /*force*/ false); diff --git a/src/services/utilities.ts b/src/services/utilities.ts index eb710b28dc67e..058bd397b7726 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1424,6 +1424,7 @@ namespace ts { writeKeyword: text => writeKind(text, SymbolDisplayPartKind.keyword), writeOperator: text => writeKind(text, SymbolDisplayPartKind.operator), writePunctuation: text => writeKind(text, SymbolDisplayPartKind.punctuation), + writeTrailingSemicolon: text => writeKind(text, SymbolDisplayPartKind.punctuation), writeSpace: text => writeKind(text, SymbolDisplayPartKind.space), writeStringLiteral: text => writeKind(text, SymbolDisplayPartKind.stringLiteral), writeParameter: text => writeKind(text, SymbolDisplayPartKind.parameterName), From 7df8091a849844c0143e5623d32136ac1922e516 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 5 Jul 2018 18:35:58 -0700 Subject: [PATCH 03/10] Add whitespace-removing text writer --- Jakefile.js | 2 +- src/compiler/checker.ts | 3 +- src/compiler/commandLineParser.ts | 6 + src/compiler/comments.ts | 10 +- src/compiler/core.ts | 4 +- src/compiler/diagnosticMessages.json | 6 + src/compiler/emitter.ts | 182 +- src/compiler/performance.ts | 31 + src/compiler/scanner.ts | 3 +- src/compiler/sourcemap.ts | 612 +++--- src/compiler/types.ts | 76 +- src/compiler/utilities.ts | 330 ++- src/harness/sourceMapRecorder.ts | 11 +- src/services/textChanges.ts | 9 +- src/services/utilities.ts | 3 +- src/testRunner/unittests/customTransforms.ts | 2 +- .../reference/api/tsserverlibrary.d.ts | 4 +- tests/baselines/reference/api/typescript.d.ts | 4 +- .../reference/removeWhitespace.outDir.js | 223 ++ .../reference/removeWhitespace.outDir.js.map | 10 + .../removeWhitespace.outDir.sourcemap.txt | 1855 +++++++++++++++++ .../reference/removeWhitespace.outDir.symbols | 398 ++++ .../reference/removeWhitespace.outDir.types | 582 ++++++ .../removeWhitespace.outFile.errors.txt | 16 + .../reference/removeWhitespace.outFile.js | 18 + .../reference/removeWhitespace.outFile.js.map | 2 + .../removeWhitespace.outFile.sourcemap.txt | 76 + .../removeWhitespace.outFile.symbols | 16 + .../reference/removeWhitespace.outFile.types | 18 + .../removeWhitespaceAndComments.outDir.js | 198 ++ .../removeWhitespaceAndComments.outDir.js.map | 8 + ...WhitespaceAndComments.outDir.sourcemap.txt | 1652 +++++++++++++++ ...removeWhitespaceAndComments.outDir.symbols | 392 ++++ .../removeWhitespaceAndComments.outDir.types | 575 +++++ .../removeWhitespace.outDir.ts | 191 ++ .../removeWhitespace.outFile.ts | 16 + .../removeWhitespaceAndComments.outDir.ts | 186 ++ 37 files changed, 7366 insertions(+), 364 deletions(-) create mode 100644 tests/baselines/reference/removeWhitespace.outDir.js create mode 100644 tests/baselines/reference/removeWhitespace.outDir.js.map create mode 100644 tests/baselines/reference/removeWhitespace.outDir.sourcemap.txt create mode 100644 tests/baselines/reference/removeWhitespace.outDir.symbols create mode 100644 tests/baselines/reference/removeWhitespace.outDir.types create mode 100644 tests/baselines/reference/removeWhitespace.outFile.errors.txt create mode 100644 tests/baselines/reference/removeWhitespace.outFile.js create mode 100644 tests/baselines/reference/removeWhitespace.outFile.js.map create mode 100644 tests/baselines/reference/removeWhitespace.outFile.sourcemap.txt create mode 100644 tests/baselines/reference/removeWhitespace.outFile.symbols create mode 100644 tests/baselines/reference/removeWhitespace.outFile.types create mode 100644 tests/baselines/reference/removeWhitespaceAndComments.outDir.js create mode 100644 tests/baselines/reference/removeWhitespaceAndComments.outDir.js.map create mode 100644 tests/baselines/reference/removeWhitespaceAndComments.outDir.sourcemap.txt create mode 100644 tests/baselines/reference/removeWhitespaceAndComments.outDir.symbols create mode 100644 tests/baselines/reference/removeWhitespaceAndComments.outDir.types create mode 100644 tests/cases/conformance/removeWhitespace/removeWhitespace.outDir.ts create mode 100644 tests/cases/conformance/removeWhitespace/removeWhitespace.outFile.ts create mode 100644 tests/cases/conformance/removeWhitespace/removeWhitespaceAndComments.outDir.ts diff --git a/Jakefile.js b/Jakefile.js index 3553600bf01ad..ce6dd559f3e50 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -365,7 +365,7 @@ file(Paths.servicesDefinitionFile, [TaskNames.coreBuild], function() { const servicesContent = readFileSync(Paths.servicesDefinitionFile); const servicesContentWithoutConstEnums = removeConstModifierFromEnumDeclarations(servicesContent); fs.writeFileSync(Paths.servicesDefinitionFile, servicesContentWithoutConstEnums); - + // Also build typescript.js, typescript.js.map, and typescript.d.ts jake.cpR(Paths.servicesFile, Paths.typescriptFile); if (fs.existsSync(Paths.servicesFile + ".map")) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 445c485f30edd..7983f0fb64444 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -720,8 +720,9 @@ namespace ts { function emitTextWriterWrapper(underlying: SymbolWriter): EmitTextWriter { return { write: noop, - writeTextOfNode: noop, + writeComment: noop, writeLine: noop, + flush: noop, increaseIndent() { return underlying.increaseIndent(); }, diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 98cbaca5e6f2c..ae913163a156c 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -533,6 +533,12 @@ namespace ts { category: Diagnostics.Advanced_Options, description: Diagnostics.Show_verbose_diagnostic_information }, + { + name: "removeWhitespace", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Do_not_emit_insignificant_whitespace_or_insignificant_trailing_semicolons_to_output + }, { name: "traceResolution", type: "boolean", diff --git a/src/compiler/comments.ts b/src/compiler/comments.ts index 989935a5edbf3..d9b09524111f5 100644 --- a/src/compiler/comments.ts +++ b/src/compiler/comments.ts @@ -153,13 +153,13 @@ namespace ts { writer.writeLine(); } else { - writer.write(" "); + writer.writeSpace(" "); } } function emitTrailingSynthesizedComment(comment: SynthesizedComment) { if (!writer.isAtStartOfLine()) { - writer.write(" "); + writer.writeSpace(" "); } writeSynthesizedComment(comment); if (comment.hasTrailingNewLine) { @@ -281,7 +281,7 @@ namespace ts { writer.writeLine(); } else if (kind === SyntaxKind.MultiLineCommentTrivia) { - writer.write(" "); + writer.writeSpace(" "); } } @@ -301,7 +301,7 @@ namespace ts { if (!shouldWriteComment(currentText, commentPos)) return; // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/ if (!writer.isAtStartOfLine()) { - writer.write(" "); + writer.writeSpace(" "); } if (emitPos) emitPos(commentPos); @@ -340,7 +340,7 @@ namespace ts { writer.writeLine(); } else { - writer.write(" "); + writer.writeSpace(" "); } } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index ff905db8dbf54..5c2e030d17357 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -428,8 +428,8 @@ namespace ts { array.length = outIndex; } - export function clear(array: {}[]): void { - array.length = 0; + export function clear(array: {}[] | undefined): void { + if (array) array.length = 0; } export function map(array: ReadonlyArray, f: (x: T, i: number) => U): U[]; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 48c98970bde60..488867e61ffbd 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3600,6 +3600,12 @@ "reportsUnnecessary": true }, + "Do not emit insignificant whitespace or insignificant trailing semicolons to output.": { + "category": "Message", + "code": 6200 + }, + + "Projects to reference": { "category": "Message", "code": 6300 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 102b6cf1a0ea8..2f77e0a9b4377 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -100,9 +100,10 @@ namespace ts { const sourceMapDataList: SourceMapData[] | undefined = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined; const emittedFilesList: string[] | undefined = compilerOptions.listEmittedFiles ? [] : undefined; const emitterDiagnostics = createDiagnosticCollection(); - const newLine = host.getNewLine(); + const newLine = getNewLineCharacter(compilerOptions, () => host.getNewLine()); const writer = createTextWriter(newLine); - const sourceMap = createSourceMapWriter(host, writer); + const javaScriptWriter = compilerOptions.removeWhitespace ? getWhitespaceRemovingTextWriter(writer) : writer; + const sourceMap = createSourceMapWriter(host, javaScriptWriter); const declarationSourceMap = createSourceMapWriter(host, writer, { sourceMap: compilerOptions.declarationMap, sourceRoot: compilerOptions.sourceRoot, @@ -161,6 +162,7 @@ namespace ts { const printerOptions: PrinterOptions = { removeComments: compilerOptions.removeComments, + removeWhitespace: compilerOptions.removeWhitespace, newLine: compilerOptions.newLine, noEmitHelpers: compilerOptions.noEmitHelpers, module: compilerOptions.module, @@ -189,7 +191,7 @@ namespace ts { }); Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform"); - printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], bundleInfoPath, printer, sourceMap); + printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], bundleInfoPath, printer, sourceMap, javaScriptWriter); // Clean up emit nodes on parse tree transform.dispose(); @@ -245,7 +247,7 @@ namespace ts { emitSkipped = emitSkipped || declBlocked; if (!declBlocked || emitOnlyDtsFiles) { Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform"); - printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], /* bundleInfopath*/ undefined, declarationPrinter, declarationSourceMap); + printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], /* bundleInfopath*/ undefined, declarationPrinter, declarationSourceMap, writer); } declarationTransform.dispose(); } @@ -264,7 +266,7 @@ namespace ts { forEachChild(node, collectLinkedAliases); } - function printSourceFileOrBundle(jsFilePath: string, sourceMapFilePath: string | undefined, sourceFileOrBundle: SourceFile | Bundle, bundleInfoPath: string | undefined, printer: Printer, mapRecorder: SourceMapWriter) { + function printSourceFileOrBundle(jsFilePath: string, sourceMapFilePath: string | undefined, sourceFileOrBundle: SourceFile | Bundle, bundleInfoPath: string | undefined, printer: Printer, mapRecorder: SourceMapWriter, writer: EmitTextWriter) { const bundle = sourceFileOrBundle.kind === SyntaxKind.Bundle ? sourceFileOrBundle : undefined; const sourceFile = sourceFileOrBundle.kind === SyntaxKind.SourceFile ? sourceFileOrBundle : undefined; const sourceFiles = bundle ? bundle.sourceFiles : [sourceFile!]; @@ -277,16 +279,22 @@ namespace ts { printer.writeFile(sourceFile!, writer); } - writer.writeLine(); - const sourceMappingURL = mapRecorder.getSourceMappingURL(); if (sourceMappingURL) { - writer.write(`//# ${"sourceMappingURL"}=${sourceMappingURL}`); // Sometimes tools can sometimes see this line as a source mapping url comment + writer.flush(); + if (!writer.isAtStartOfLine()) writer.rawWrite(newLine); + writer.writeComment(`//# ${"sourceMappingURL"}=${sourceMappingURL}`); // Tools can sometimes see this line as a source mapping url comment + } + else { + writer.writeLine(); } // Write the source map - if (sourceMapFilePath) { - writeFile(host, emitterDiagnostics, sourceMapFilePath, mapRecorder.getText(), /*writeByteOrderMark*/ false, sourceFiles); + if (sourceMapFilePath && sourceMap) { + const sourceMap = mapRecorder.getText(); + if (sourceMap) { + writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles); + } } // Write the output file @@ -337,6 +345,7 @@ namespace ts { } = handlers; const newLine = getNewLineCharacter(printerOptions); + const removeWhitespace = printerOptions.removeWhitespace; const comments = createCommentWriter(printerOptions, onEmitSourceMapOfPosition); const { emitNodeWithComments, @@ -452,8 +461,8 @@ namespace ts { emitSyntheticTripleSlashReferencesIfNeeded(bundle); for (const prepend of bundle.prepends) { + writeSignificantLine(); print(EmitHint.Unspecified, prepend, /*sourceFile*/ undefined); - writeLine(); } if (bundleInfo) { @@ -606,6 +615,10 @@ namespace ts { if (hint === EmitHint.SourceFile) return emitSourceFile(cast(node, isSourceFile)); if (hint === EmitHint.IdentifierName) return emitIdentifier(cast(node, isIdentifier)); if (hint === EmitHint.MappedTypeParameter) return emitMappedTypeParameter(cast(node, isTypeParameterDeclaration)); + if (hint === EmitHint.EmbeddedStatement) { + Debug.assertNode(node, isEmptyStatement); + return emitEmptyStatement(/*isEmbeddedStatement*/ true); + } if (hint === EmitHint.Unspecified) { if (isKeyword(node.kind)) return writeTokenNode(node, writeKeyword); @@ -706,10 +719,10 @@ namespace ts { case SyntaxKind.ImportType: return emitImportTypeNode(node); case SyntaxKind.JSDocAllType: - write("*"); + writePunctuation("*"); return; case SyntaxKind.JSDocUnknownType: - write("?"); + writePunctuation("?"); return; case SyntaxKind.JSDocNullableType: return emitJSDocNullableType(node as JSDocNullableType); @@ -741,7 +754,7 @@ namespace ts { case SyntaxKind.VariableStatement: return emitVariableStatement(node); case SyntaxKind.EmptyStatement: - return emitEmptyStatement(); + return emitEmptyStatement(/*isEmbeddedStatement*/ false); case SyntaxKind.ExpressionStatement: return emitExpressionStatement(node); case SyntaxKind.IfStatement: @@ -1157,7 +1170,7 @@ namespace ts { emitNodeWithWriter(node.name, writeProperty); emit(node.questionToken); emitTypeAnnotation(node.type); - writeSemicolon(); + writeTrailingSemicolon(); } function emitPropertyDeclaration(node: PropertyDeclaration) { @@ -1168,7 +1181,7 @@ namespace ts { emit(node.exclamationToken); emitTypeAnnotation(node.type); emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name.end, node); - writeSemicolon(); + writeTrailingSemicolon(); } function emitMethodSignature(node: MethodSignature) { @@ -1180,7 +1193,7 @@ namespace ts { emitTypeParameters(node, node.typeParameters); emitParameters(node, node.parameters); emitTypeAnnotation(node.type); - writeSemicolon(); + writeTrailingSemicolon(); popNameGenerationScope(node); } @@ -1215,7 +1228,7 @@ namespace ts { emitTypeParameters(node, node.typeParameters); emitParameters(node, node.parameters); emitTypeAnnotation(node.type); - writeSemicolon(); + writeTrailingSemicolon(); popNameGenerationScope(node); } @@ -1228,7 +1241,7 @@ namespace ts { emitTypeParameters(node, node.typeParameters); emitParameters(node, node.parameters); emitTypeAnnotation(node.type); - writeSemicolon(); + writeTrailingSemicolon(); popNameGenerationScope(node); } @@ -1237,11 +1250,11 @@ namespace ts { emitModifiers(node, node.modifiers); emitParametersForIndexSignature(node, node.parameters); emitTypeAnnotation(node.type); - writeSemicolon(); + writeTrailingSemicolon(); } function emitSemicolonClassElement() { - writeSemicolon(); + writeTrailingSemicolon(); } // @@ -1273,26 +1286,26 @@ namespace ts { } function emitJSDocFunctionType(node: JSDocFunctionType) { - write("function"); + writeKeyword("function"); emitParameters(node, node.parameters); - write(":"); + writePunctuation(":"); emit(node.type); } function emitJSDocNullableType(node: JSDocNullableType) { - write("?"); + writePunctuation("?"); emit(node.type); } function emitJSDocNonNullableType(node: JSDocNonNullableType) { - write("!"); + writePunctuation("!"); emit(node.type); } function emitJSDocOptionalType(node: JSDocOptionalType) { emit(node.type); - write("="); + writePunctuation("="); } function emitConstructorType(node: ConstructorTypeNode) { @@ -1328,7 +1341,7 @@ namespace ts { } function emitRestOrJSDocVariadicType(node: RestTypeNode | JSDocVariadicType) { - write("..."); + writePunctuation("..."); emit(node.type); } @@ -1340,7 +1353,7 @@ namespace ts { function emitOptionalType(node: OptionalTypeNode) { emit(node.type); - write("?"); + writePunctuation("?"); } function emitUnionType(node: UnionTypeNode) { @@ -1428,7 +1441,7 @@ namespace ts { writePunctuation(":"); writeSpace(); emit(node.type); - writeSemicolon(); + writeTrailingSemicolon(); if (emitFlags & EmitFlags.SingleLine) { writeSpace(); } @@ -1516,7 +1529,7 @@ namespace ts { function emitPropertyAccessExpression(node: PropertyAccessExpression) { let indentBeforeDot = false; let indentAfterDot = false; - if (!(getEmitFlags(node) & EmitFlags.NoIndentation)) { + if (!(getEmitFlags(node) & EmitFlags.NoIndentation) && !removeWhitespace) { const dotRangeStart = node.expression.end; const dotRangeEnd = skipTrivia(currentSourceFile.text, node.expression.end) + 1; const dotToken = createToken(SyntaxKind.DotToken); @@ -1529,7 +1542,7 @@ namespace ts { emitExpression(node.expression); increaseIndentIf(indentBeforeDot); - const shouldEmitDotDot = !indentBeforeDot && needsDotDotForPropertyAccess(node.expression); + const shouldEmitDotDot = !indentBeforeDot && !removeWhitespace && needsDotDotForPropertyAccess(node.expression); if (shouldEmitDotDot) { writePunctuation("."); } @@ -1682,11 +1695,11 @@ namespace ts { const indentAfterOperator = needsIndentation(node, node.operatorToken, node.right); emitExpression(node.left); - increaseIndentIf(indentBeforeOperator, isCommaOperator ? " " : undefined); + increaseIndentIf(indentBeforeOperator, isCommaOperator); emitLeadingCommentsOfPosition(node.operatorToken.pos); - writeTokenNode(node.operatorToken, writeOperator); + writeTokenNode(node.operatorToken, node.operatorToken.kind === SyntaxKind.InKeyword ? writeKeyword : writeOperator); emitTrailingCommentsOfPosition(node.operatorToken.end, /*prefixSpace*/ true); // Binary operators should have a space before the comment starts - increaseIndentIf(indentAfterOperator, " "); + increaseIndentIf(indentAfterOperator, /*writeSpaceIfNotIndenting*/ true); emitExpression(node.right); decreaseIndentIf(indentBeforeOperator, indentAfterOperator); } @@ -1698,15 +1711,15 @@ namespace ts { const indentAfterColon = needsIndentation(node, node.colonToken, node.whenFalse); emitExpression(node.condition); - increaseIndentIf(indentBeforeQuestion, " "); + increaseIndentIf(indentBeforeQuestion, /*writeSpaceIfNotIndenting*/ true); emit(node.questionToken); - increaseIndentIf(indentAfterQuestion, " "); + increaseIndentIf(indentAfterQuestion, /*writeSpaceIfNotIndenting*/ true); emitExpression(node.whenTrue); decreaseIndentIf(indentBeforeQuestion, indentAfterQuestion); - increaseIndentIf(indentBeforeColon, " "); + increaseIndentIf(indentBeforeColon, /*writeSpaceIfNotIndenting*/ true); emit(node.colonToken); - increaseIndentIf(indentAfterColon, " "); + increaseIndentIf(indentAfterColon, /*writeSpaceIfNotIndenting*/ true); emitExpression(node.whenFalse); decreaseIndentIf(indentBeforeColon, indentAfterColon); } @@ -1785,17 +1798,24 @@ namespace ts { function emitVariableStatement(node: VariableStatement) { emitModifiers(node, node.modifiers); emit(node.declarationList); - writeSemicolon(); + writeTrailingSemicolon(); } - function emitEmptyStatement() { - writeSemicolon(); + function emitEmptyStatement(isEmbeddedStatement: boolean) { + // While most trailing semicolons are possibly insignificant, an embedded "empty" + // statement is significant and cannot be elided by the whitespace-removing writer. + if (isEmbeddedStatement) { + writePunctuation(";"); + } + else { + writeTrailingSemicolon(); + } } function emitExpressionStatement(node: ExpressionStatement) { emitExpression(node.expression); if (!isJsonSourceFile(currentSourceFile)) { - writeSemicolon(); + writeTrailingSemicolon(); } } @@ -1851,9 +1871,9 @@ namespace ts { writeSpace(); let pos = emitTokenWithComment(SyntaxKind.OpenParenToken, openParenPos, writePunctuation, /*contextNode*/ node); emitForBinding(node.initializer); - pos = emitTokenWithComment(SyntaxKind.SemicolonToken, node.initializer ? node.initializer.end : pos, writeSemicolon, node); + pos = emitTokenWithComment(SyntaxKind.SemicolonToken, node.initializer ? node.initializer.end : pos, writePunctuation, node); emitExpressionWithLeadingSpace(node.condition); - pos = emitTokenWithComment(SyntaxKind.SemicolonToken, node.condition ? node.condition.end : pos, writeSemicolon, node); + pos = emitTokenWithComment(SyntaxKind.SemicolonToken, node.condition ? node.condition.end : pos, writePunctuation, node); emitExpressionWithLeadingSpace(node.incrementor); emitTokenWithComment(SyntaxKind.CloseParenToken, node.incrementor ? node.incrementor.end : pos, writePunctuation, node); emitEmbeddedStatement(node, node.statement); @@ -1900,13 +1920,13 @@ namespace ts { function emitContinueStatement(node: ContinueStatement) { emitTokenWithComment(SyntaxKind.ContinueKeyword, node.pos, writeKeyword, node); emitWithLeadingSpace(node.label); - writeSemicolon(); + writeTrailingSemicolon(); } function emitBreakStatement(node: BreakStatement) { emitTokenWithComment(SyntaxKind.BreakKeyword, node.pos, writeKeyword, node); emitWithLeadingSpace(node.label); - writeSemicolon(); + writeTrailingSemicolon(); } function emitTokenWithComment(token: SyntaxKind, pos: number, writer: (s: string) => void, contextNode: Node, indentLeading?: boolean) { @@ -1936,7 +1956,7 @@ namespace ts { function emitReturnStatement(node: ReturnStatement) { emitTokenWithComment(SyntaxKind.ReturnKeyword, node.pos, writeKeyword, /*contextNode*/ node); emitExpressionWithLeadingSpace(node.expression); - writeSemicolon(); + writeTrailingSemicolon(); } function emitWithStatement(node: WithStatement) { @@ -1968,7 +1988,7 @@ namespace ts { function emitThrowStatement(node: ThrowStatement) { emitTokenWithComment(SyntaxKind.ThrowKeyword, node.pos, writeKeyword, node); emitExpressionWithLeadingSpace(node.expression); - writeSemicolon(); + writeTrailingSemicolon(); } function emitTryStatement(node: TryStatement) { @@ -1989,7 +2009,7 @@ namespace ts { function emitDebuggerStatement(node: DebuggerStatement) { writeToken(SyntaxKind.DebuggerKeyword, node.pos, writeKeyword); - writeSemicolon(); + writeTrailingSemicolon(); } // @@ -2060,7 +2080,7 @@ namespace ts { } else { emitSignatureHead(node); - writeSemicolon(); + writeTrailingSemicolon(); } } @@ -2206,7 +2226,7 @@ namespace ts { writePunctuation("="); writeSpace(); emit(node.type); - writeSemicolon(); + writeTrailingSemicolon(); } function emitEnumDeclaration(node: EnumDeclaration) { @@ -2230,7 +2250,7 @@ namespace ts { emit(node.name); let body = node.body; - if (!body) return writeSemicolon(); + if (!body) return writeTrailingSemicolon(); while (body.kind === SyntaxKind.ModuleDeclaration) { writePunctuation("."); emit((body).name); @@ -2263,7 +2283,7 @@ namespace ts { emitTokenWithComment(SyntaxKind.EqualsToken, node.name.end, writePunctuation, node); writeSpace(); emitModuleReference(node.moduleReference); - writeSemicolon(); + writeTrailingSemicolon(); } function emitModuleReference(node: ModuleReference) { @@ -2286,7 +2306,7 @@ namespace ts { writeSpace(); } emitExpression(node.moduleSpecifier); - writeSemicolon(); + writeTrailingSemicolon(); } function emitImportClause(node: ImportClause) { @@ -2325,7 +2345,7 @@ namespace ts { } writeSpace(); emitExpression(node.expression); - writeSemicolon(); + writeTrailingSemicolon(); } function emitExportDeclaration(node: ExportDeclaration) { @@ -2344,7 +2364,7 @@ namespace ts { writeSpace(); emitExpression(node.moduleSpecifier); } - writeSemicolon(); + writeTrailingSemicolon(); } function emitNamespaceExportDeclaration(node: NamespaceExportDeclaration) { @@ -2355,7 +2375,7 @@ namespace ts { nextPos = emitTokenWithComment(SyntaxKind.NamespaceKeyword, nextPos, writeKeyword, node); writeSpace(); emit(node.name); - writeSemicolon(); + writeTrailingSemicolon(); } function emitNamedExports(node: NamedExports) { @@ -2589,7 +2609,11 @@ namespace ts { // function emitSourceFile(node: SourceFile) { - writeLine(); + // NOTE: Our source map tests currently require each new source file be on a new + // generated line. Until we can rework the source map support in the test + // harness, ensure each source file is on a new line, even when using a + // whitespace-removing writer. + writeSignificantLine(); const statements = node.statements; if (emitBodyWithDetachedComments) { // Emit detached comment if there are no prologue directives or if the first node is synthesized. @@ -2615,30 +2639,30 @@ namespace ts { function emitTripleSlashDirectives(hasNoDefaultLib: boolean, files: ReadonlyArray, types: ReadonlyArray) { if (hasNoDefaultLib) { - write(`/// `); + writeComment(`/// `); writeLine(); } if (currentSourceFile && currentSourceFile.moduleName) { - write(`/// `); + writeComment(`/// `); writeLine(); } if (currentSourceFile && currentSourceFile.amdDependencies) { for (const dep of currentSourceFile.amdDependencies) { if (dep.name) { - write(`/// `); + writeComment(`/// `); } else { - write(`/// `); + writeComment(`/// `); } writeLine(); } } for (const directive of files) { - write(`/// `); + writeComment(`/// `); writeLine(); } for (const directive of types) { - write(`/// `); + writeComment(`/// `); writeLine(); } } @@ -2710,7 +2734,7 @@ namespace ts { if (isSourceFile(sourceFileOrBundle)) { const shebang = getShebang(sourceFileOrBundle.text); if (shebang) { - write(shebang); + writeComment(shebang); writeLine(); return true; } @@ -2797,7 +2821,13 @@ namespace ts { else { writeLine(); increaseIndent(); - emit(node); + if (isEmptyStatement(node)) { + const pipelinePhase = getPipelinePhase(PipelinePhase.Notification, EmitHint.EmbeddedStatement); + pipelinePhase(EmitHint.EmbeddedStatement, node); + } + else { + emit(node); + } decreaseIndent(); } } @@ -3053,7 +3083,7 @@ namespace ts { writer.writePunctuation(s); } - function writeSemicolon() { + function writeTrailingSemicolon() { writer.writeTrailingSemicolon(";"); } @@ -3069,6 +3099,10 @@ namespace ts { writer.writeParameter(s); } + function writeComment(s: string) { + writer.writeComment(s); + } + function writeSpace() { writer.writeSpace(" "); } @@ -3077,6 +3111,12 @@ namespace ts { writer.writeProperty(s); } + function writeSignificantLine() { + // writer.flush(); + // if (!writer.isAtStartOfLine()) writer.rawWrite(newLine); + writeLine(); + } + function writeLine() { writer.writeLine(); } @@ -3130,18 +3170,18 @@ namespace ts { if (line.length) { writeLine(); write(line); - writeLine(); + writer.rawWrite(newLine); } } } - function increaseIndentIf(value: boolean, valueToWriteWhenNotIndenting?: string) { + function increaseIndentIf(value: boolean, writeSpaceIfNotIndenting?: boolean) { if (value) { increaseIndent(); writeLine(); } - else if (valueToWriteWhenNotIndenting) { - write(valueToWriteWhenNotIndenting); + else if (writeSpaceIfNotIndenting) { + writeSpace(); } } diff --git a/src/compiler/performance.ts b/src/compiler/performance.ts index 64709a12ba908..b51dc337865d6 100644 --- a/src/compiler/performance.ts +++ b/src/compiler/performance.ts @@ -19,6 +19,37 @@ namespace ts.performance { let marks: Map; let measures: Map; + export interface Timer { + enter(): void; + exit(): void; + } + + export function createTimer(measureName: string, startMarkName: string, endMarkName: string): Timer { + let enterCount = 0; + return { + enter, + exit + }; + + function enter() { + if (++enterCount === 1) { + mark(startMarkName); + } + } + + function exit() { + if (--enterCount === 0) { + mark(endMarkName); + measure(measureName, startMarkName, endMarkName); + } + else if (enterCount < 0) { + Debug.fail("enter/exit count does not match."); + } + } + } + + export const nullTimer: Timer = { enter: noop, exit: noop }; + /** * Marks a performance event. * diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index af74d69ceefbb..882140f177613 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -420,7 +420,8 @@ namespace ts { ch === CharacterCodes.paragraphSeparator; } - function isDigit(ch: number): boolean { + /* @internal */ + export function isDigit(ch: number): boolean { return ch >= CharacterCodes._0 && ch <= CharacterCodes._9; } diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 8dfe91a6cff67..048b58ea5b9b3 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -54,23 +54,14 @@ namespace ts { /** * Gets the text for the source map. */ - getText(): string; + getText(): string | undefined; /** * Gets the SourceMappingURL for the source map. */ - getSourceMappingURL(): string; + getSourceMappingURL(): string | undefined; } - // Used for initialize lastEncodedSourceMapSpan and reset lastEncodedSourceMapSpan when updateLastEncodedAndRecordedSpans - const defaultLastEncodedSourceMapSpan: SourceMapSpan = { - emittedLine: 0, - emittedColumn: 0, - sourceLine: 0, - sourceColumn: 0, - sourceIndex: 0 - }; - export interface SourceMapOptions { sourceMap?: boolean; inlineSourceMap?: boolean; @@ -80,24 +71,18 @@ namespace ts { extendedDiagnostics?: boolean; } - export function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter, compilerOptions: SourceMapOptions = host.getCompilerOptions()): SourceMapWriter { - const extendedDiagnostics = compilerOptions.extendedDiagnostics; + export function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter, writerOptions: SourceMapOptions = host.getCompilerOptions()): SourceMapWriter { let currentSource: SourceMapSource; - let currentSourceText: string; + let currentSourceIndex = -1; let sourceMapDir: string; // The directory in which sourcemap will be - // Current source map file and its index in the sources list - let sourceMapSourceIndex: number; - - // Last recorded and encoded spans - let lastRecordedSourceMapSpan: SourceMapSpan | undefined; - let lastEncodedSourceMapSpan: SourceMapSpan | undefined; - let lastEncodedNameIndex: number | undefined; - // Source map data let sourceMapData: SourceMapData; let sourceMapDataList: SourceMapData[] | undefined; - let disabled: boolean = !(compilerOptions.sourceMap || compilerOptions.inlineSourceMap); + let disabled: boolean = !(writerOptions.sourceMap || writerOptions.inlineSourceMap); + + let sourceMapGenerator: SourceMapGenerator | undefined; + let sourceMapEmitter: SourceMapEmitter | undefined; return { initialize, @@ -114,7 +99,7 @@ namespace ts { * Skips trivia such as comments and white-space that can optionally overriden by the source map source */ function skipSourceTrivia(pos: number): number { - return currentSource.skipTrivia ? currentSource.skipTrivia(pos) : skipTrivia(currentSourceText, pos); + return currentSource.skipTrivia ? currentSource.skipTrivia(pos) : skipTrivia(currentSource.text, pos); } /** @@ -132,30 +117,20 @@ namespace ts { if (sourceMapData) { reset(); } - sourceMapDataList = outputSourceMapDataList; - currentSource = undefined!; - currentSourceText = undefined!; - - // Current source map file and its index in the sources list - sourceMapSourceIndex = -1; - - // Last recorded and encoded spans - lastRecordedSourceMapSpan = undefined; - lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan; - lastEncodedNameIndex = 0; + sourceMapDataList = outputSourceMapDataList; // Initialize source map data sourceMapData = { sourceMapFilePath, - jsSourceMappingURL: !compilerOptions.inlineSourceMap ? getBaseFileName(normalizeSlashes(sourceMapFilePath)) : undefined!, // TODO: GH#18217 + jsSourceMappingURL: !writerOptions.inlineSourceMap ? getBaseFileName(normalizeSlashes(sourceMapFilePath)) : undefined!, // TODO: GH#18217 sourceMapFile: getBaseFileName(normalizeSlashes(filePath)), - sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSourceRoot: writerOptions.sourceRoot || "", sourceMapSources: [], inputSourceFileNames: [], sourceMapNames: [], sourceMapMappings: "", - sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined, + sourceMapSourcesContent: writerOptions.inlineSources ? [] : undefined, sourceMapDecodedMappings: [] }; @@ -166,8 +141,8 @@ namespace ts { sourceMapData.sourceMapSourceRoot += directorySeparator; } - if (compilerOptions.mapRoot) { - sourceMapDir = normalizeSlashes(compilerOptions.mapRoot); + if (writerOptions.mapRoot) { + sourceMapDir = normalizeSlashes(writerOptions.mapRoot); if (sourceFileOrBundle.kind === SyntaxKind.SourceFile) { // emitting single module file // For modules or multiple emit files the mapRoot will have directory structure like the sources // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map @@ -191,6 +166,12 @@ namespace ts { else { sourceMapDir = getDirectoryPath(normalizePath(filePath)); } + + // If sourceroot option: Use the relative path corresponding to the common directory path + // otherwise source locations relative to map file location + const sourcesDirectoryPath = writerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + sourceMapGenerator = createSourceMapGenerator(host, sourceMapData, sourcesDirectoryPath, writerOptions); + sourceMapEmitter = getSourceMapEmitter(sourceMapGenerator, writer); } /** @@ -207,99 +188,11 @@ namespace ts { } currentSource = undefined!; + currentSourceIndex = -1; sourceMapDir = undefined!; - sourceMapSourceIndex = undefined!; - lastRecordedSourceMapSpan = undefined; - lastEncodedSourceMapSpan = undefined!; - lastEncodedNameIndex = undefined; sourceMapData = undefined!; sourceMapDataList = undefined!; - } - - interface SourceMapSection { - version: 3; - file: string; - sourceRoot?: string; - sources: string[]; - names?: string[]; - mappings: string; - sourcesContent?: (string | null)[]; - sections?: undefined; - } - - type SourceMapSectionDefinition = - | { offset: { line: number, column: number }, url: string } // Included for completeness - | { offset: { line: number, column: number }, map: SourceMap }; - - interface SectionalSourceMap { - version: 3; - file: string; - sections: SourceMapSectionDefinition[]; - } - - type SourceMap = SectionalSourceMap | SourceMapSection; - - function captureSection(): SourceMapSection { - return { - version: 3, - file: sourceMapData.sourceMapFile, - sourceRoot: sourceMapData.sourceMapSourceRoot, - sources: sourceMapData.sourceMapSources, - names: sourceMapData.sourceMapNames, - mappings: sourceMapData.sourceMapMappings, - sourcesContent: sourceMapData.sourceMapSourcesContent, - }; - } - - - // Encoding for sourcemap span - function encodeLastRecordedSourceMapSpan() { - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { - return; - } - - Debug.assert(lastRecordedSourceMapSpan.emittedColumn >= 0, "lastEncodedSourceMapSpan.emittedColumn was negative"); - Debug.assert(lastRecordedSourceMapSpan.sourceIndex >= 0, "lastEncodedSourceMapSpan.sourceIndex was negative"); - Debug.assert(lastRecordedSourceMapSpan.sourceLine >= 0, "lastEncodedSourceMapSpan.sourceLine was negative"); - Debug.assert(lastRecordedSourceMapSpan.sourceColumn >= 0, "lastEncodedSourceMapSpan.sourceColumn was negative"); - - let prevEncodedEmittedColumn = lastEncodedSourceMapSpan!.emittedColumn; - // Line/Comma delimiters - if (lastEncodedSourceMapSpan!.emittedLine === lastRecordedSourceMapSpan.emittedLine) { - // Emit comma to separate the entry - if (sourceMapData.sourceMapMappings) { - sourceMapData.sourceMapMappings += ","; - } - } - else { - // Emit line delimiters - for (let encodedLine = lastEncodedSourceMapSpan!.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { - sourceMapData.sourceMapMappings += ";"; - } - prevEncodedEmittedColumn = 0; - } - - // 1. Relative Column 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - - // 2. Relative sourceIndex - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan!.sourceIndex); - - // 3. Relative sourceLine 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan!.sourceLine); - - // 4. Relative sourceColumn 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan!.sourceColumn); - - // 5. Relative namePosition 0 based - if (lastRecordedSourceMapSpan.nameIndex! >= 0) { - Debug.assert(false, "We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this"); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex! - lastEncodedNameIndex!); - lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; - } - - lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; - sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + sourceMapEmitter = undefined; } /** @@ -315,50 +208,8 @@ namespace ts { return; } - if (extendedDiagnostics) { - performance.mark("beforeSourcemap"); - } - - const sourceLinePos = getLineAndCharacterOfPosition(currentSource, pos); - - const emittedLine = writer.getLine(); - const emittedColumn = writer.getColumn(); - - // If this location wasn't recorded or the location in source is going backwards, record the span - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine !== emittedLine || - lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { - - // Encode the last recordedSpan before assigning new - encodeLastRecordedSourceMapSpan(); - - // New span - lastRecordedSourceMapSpan = { - emittedLine, - emittedColumn, - sourceLine: sourceLinePos.line, - sourceColumn: sourceLinePos.character, - sourceIndex: sourceMapSourceIndex - }; - } - else { - // Take the new pos instead since there is no change in emittedLine and column since last location - lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; - lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; - lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; - } - - if (extendedDiagnostics) { - performance.mark("afterSourcemap"); - performance.measure("Source Map", "beforeSourcemap", "afterSourcemap"); - } - } - - function isPossiblySourceMap(x: {}): x is SourceMapSection { - return typeof x === "object" && !!(x as any).mappings && typeof (x as any).mappings === "string" && !!(x as any).sources; + const { line: sourceLine, character: sourceCharacter } = getLineAndCharacterOfPosition(currentSource, pos); + Debug.assertDefined(sourceMapEmitter, "Not initialized").emitMapping(currentSourceIndex, sourceLine, sourceCharacter, /*nameIndex*/ undefined); } /** @@ -375,55 +226,13 @@ namespace ts { if (node) { if (isUnparsedSource(node) && node.sourceMapText !== undefined) { - const text = node.sourceMapText; - let parsed: {} | undefined; - try { - parsed = JSON.parse(text); + const parsed = tryParseRawSourceMap(node.sourceMapText); + if (parsed) { + Debug.assertDefined(sourceMapEmitter, "Not initialized").emitSourceMap(parsed, node.sourceMapPath!); } - catch { - // empty - } - if (!parsed || !isPossiblySourceMap(parsed)) { - return emitCallback(hint, node); - } - const offsetLine = writer.getLine(); - const firstLineColumnOffset = writer.getColumn(); - // First, decode the old component sourcemap - const originalMap = parsed; - - const sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; - const resolvedPathCache = createMap(); - sourcemaps.calculateDecodedMappings(originalMap, (raw): void => { - // Apply offsets to each position and fixup source entries - const rawPath = originalMap.sources[raw.sourceIndex]; - const relativePath = originalMap.sourceRoot ? combinePaths(originalMap.sourceRoot, rawPath) : rawPath; - const combinedPath = combinePaths(getDirectoryPath(node.sourceMapPath!), relativePath); - if (!resolvedPathCache.has(combinedPath)) { - resolvedPathCache.set(combinedPath, getRelativePathToDirectoryOrUrl( - sourcesDirectoryPath, - combinedPath, - host.getCurrentDirectory(), - host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true - )); - } - const resolvedPath = resolvedPathCache.get(combinedPath)!; - const absolutePath = getNormalizedAbsolutePath(resolvedPath, sourcesDirectoryPath); - // tslint:disable-next-line:no-null-keyword - setupSourceEntry(absolutePath, originalMap.sourcesContent ? originalMap.sourcesContent[raw.sourceIndex] : null); // TODO: Lookup content for inlining? - const newIndex = sourceMapData.sourceMapSources.indexOf(resolvedPath); - // Then reencode all the updated spans into the overall map - encodeLastRecordedSourceMapSpan(); - lastRecordedSourceMapSpan = { - ...raw, - emittedLine: raw.emittedLine + offsetLine, - emittedColumn: raw.emittedLine === 0 ? (raw.emittedColumn + firstLineColumnOffset) : raw.emittedColumn, - sourceIndex: newIndex, - }; - }); - // And actually emit the text these sourcemaps are for return emitCallback(hint, node); } + const emitNode = node.emitNode; const emitFlags = emitNode && emitNode.flags || EmitFlags.None; const range = emitNode && emitNode.sourceMapRange; @@ -510,38 +319,16 @@ namespace ts { } currentSource = sourceFile; - currentSourceText = currentSource.text; if (isJsonSourceMapSource(sourceFile)) { return; } - setupSourceEntry(sourceFile.fileName, sourceFile.text); - } - - function setupSourceEntry(fileName: string, content: string | null) { - // Add the file to tsFilePaths - // If sourceroot option: Use the relative path corresponding to the common directory path - // otherwise source locations relative to map file location - const sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; - - const source = getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, - fileName, - host.getCurrentDirectory(), - host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true); - - sourceMapSourceIndex = sourceMapData.sourceMapSources.indexOf(source); - if (sourceMapSourceIndex === -1) { - sourceMapSourceIndex = sourceMapData.sourceMapSources.length; - sourceMapData.sourceMapSources.push(source); - - // The one that can be used from program to get the actual source file - sourceMapData.inputSourceFileNames.push(fileName); + if (!sourceMapGenerator) return Debug.fail("Not initialized"); - if (compilerOptions.inlineSources) { - sourceMapData.sourceMapSourcesContent!.push(content); - } + currentSourceIndex = sourceMapGenerator.addSource(sourceFile.fileName); + if (writerOptions.inlineSources) { + sourceMapGenerator.setSourceContent(currentSourceIndex, sourceFile.text); } } @@ -550,12 +337,10 @@ namespace ts { */ function getText() { if (disabled || isJsonSourceMapSource(currentSource)) { - return undefined!; // TODO: GH#18217 + return undefined; } - encodeLastRecordedSourceMapSpan(); - - return JSON.stringify(captureSection()); + return Debug.assertDefined(sourceMapGenerator, "Not initialized").toString(); } /** @@ -563,12 +348,13 @@ namespace ts { */ function getSourceMappingURL() { if (disabled || isJsonSourceMapSource(currentSource)) { - return undefined!; // TODO: GH#18217 + return undefined; } - if (compilerOptions.inlineSourceMap) { + if (writerOptions.inlineSourceMap) { // Encode the sourceMap into the sourceMap url - const base64SourceMapText = base64encode(sys, getText()); + const sourceMapText = Debug.assertDefined(sourceMapGenerator, "Not initialized").toString(); + const base64SourceMapText = base64encode(sys, sourceMapText); return sourceMapData.jsSourceMappingURL = `data:application/json;base64,${base64SourceMapText}`; } else { @@ -577,6 +363,326 @@ namespace ts { } } + interface SourceMapGeneratorOptions { + extendedDiagnostics?: boolean; + } + + function createSourceMapGenerator(host: EmitHost, sourceMapData: SourceMapData, sourcesDirectoryPath: string, generatorOptions: SourceMapGeneratorOptions): SourceMapGenerator { + const { enter, exit } = generatorOptions.extendedDiagnostics + ? performance.createTimer("Source Map", "beforeSourcemap", "afterSourcemap") + : performance.nullTimer; + + // Current source map file and its index in the sources list + const sourceToSourceIndexMap = createMap(); + let nameToNameIndexMap: Map | undefined; + + // Last recorded and encoded mappings + let generatedLine = 0; + let generatedCharacter = 0; + let sourceIndex = 0; + let sourceLine = 0; + let sourceCharacter = 0; + let nameIndex = 0; + + let hasPending = false; + let hasPendingSource = false; + let hasPendingName = false; + let hasMapping = false; + + let pendingGeneratedLine = 0; + let pendingGeneratedCharacter = 0; + let pendingSourceIndex = 0; + let pendingSourceLine = 0; + let pendingSourceCharacter = 0; + let pendingNameIndex = 0; + + return { + addSource, + setSourceContent, + addName, + addMapping, + appendSourceMap, + toJSON, + toString: () => JSON.stringify(toJSON()) + }; + + function addSource(fileName: string) { + enter(); + const source = getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, + fileName, + host.getCurrentDirectory(), + host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true); + + let sourceIndex = sourceToSourceIndexMap.get(source); + if (sourceIndex === undefined) { + sourceIndex = sourceMapData.sourceMapSources.length; + sourceMapData.sourceMapSources.push(source); + sourceMapData.inputSourceFileNames.push(fileName); + sourceToSourceIndexMap.set(source, sourceIndex); + } + exit(); + return sourceIndex; + } + + function setSourceContent(sourceIndex: number, content: string | null) { + enter(); + if (content !== null) { + if (!sourceMapData.sourceMapSourcesContent) sourceMapData.sourceMapSourcesContent = []; + while (sourceMapData.sourceMapSourcesContent.length < sourceIndex) { + // tslint:disable-next-line:no-null-keyword boolean-trivia + sourceMapData.sourceMapSourcesContent.push(null); + } + sourceMapData.sourceMapSourcesContent[sourceIndex] = content; + } + exit(); + } + + function addName(name: string) { + enter(); + if (!sourceMapData.sourceMapNames) sourceMapData.sourceMapNames = []; + if (!nameToNameIndexMap) nameToNameIndexMap = createMap(); + let nameIndex = nameToNameIndexMap.get(name); + if (nameIndex === undefined) { + nameIndex = sourceMapData.sourceMapNames.length; + sourceMapData.sourceMapNames.push(name); + nameToNameIndexMap.set(name, nameIndex); + } + exit(); + return nameIndex; + } + + function isNewGeneratedPosition(generatedLine: number, generatedCharacter: number) { + return !hasPending + || pendingGeneratedLine !== generatedLine + || pendingGeneratedCharacter !== generatedCharacter; + } + + function isBacktrackingSourcePosition(sourceIndex: number | undefined, sourceLine: number | undefined, sourceCharacter: number | undefined) { + return sourceIndex !== undefined + && sourceLine !== undefined + && sourceCharacter !== undefined + && pendingSourceIndex === sourceIndex + && (pendingSourceLine > sourceLine + || pendingSourceLine === sourceLine && pendingSourceCharacter > sourceCharacter); + } + + function addMapping(generatedLine: number, generatedCharacter: number, sourceIndex?: number, sourceLine?: number, sourceCharacter?: number, nameIndex?: number) { + enter(); + // If this location wasn't recorded or the location in source is going backwards, record the mapping + if (isNewGeneratedPosition(generatedLine, generatedCharacter) || + isBacktrackingSourcePosition(sourceIndex, sourceLine, sourceCharacter)) { + commitPendingMapping(); + Debug.assert(generatedLine >= pendingGeneratedLine, "Cannot backtrack generated lines."); + pendingGeneratedLine = generatedLine; + pendingGeneratedCharacter = generatedCharacter; + hasPendingSource = false; + hasPendingName = false; + hasPending = true; + } + + if (sourceIndex !== undefined && sourceLine !== undefined && sourceCharacter !== undefined) { + Debug.assert(sourceIndex !== -1, "No source was set for this mapping."); + pendingSourceIndex = sourceIndex; + pendingSourceLine = sourceLine; + pendingSourceCharacter = sourceCharacter; + hasPendingSource = true; + if (nameIndex !== undefined) { + pendingNameIndex = nameIndex; + hasPendingName = true; + } + } + exit(); + } + + function appendSourceMap(generatedLine: number, generatedCharacter: number, map: RawSourceMap, sourceMapPath: string) { + enter(); + // First, decode the old component sourcemap + const sourceIndexToNewSourceIndexMap: number[] = []; + let nameIndexToNewNameIndexMap: number[] | undefined; + sourcemaps.calculateDecodedMappings(map, (raw): void => { + // Then reencode all the updated mappings into the overall map + let newSourceIndex: number | undefined; + let newSourceLine: number | undefined; + let newSourceCharacter: number | undefined; + let newNameIndex: number | undefined; + if (raw.sourceIndex !== undefined) { + newSourceIndex = sourceIndexToNewSourceIndexMap[raw.sourceIndex]; + if (newSourceIndex === undefined) { + // Apply offsets to each position and fixup source entries + const rawPath = map.sources[raw.sourceIndex]; + const relativePath = map.sourceRoot ? combinePaths(map.sourceRoot, rawPath) : rawPath; + const combinedPath = combinePaths(getDirectoryPath(sourceMapPath), relativePath); + sourceIndexToNewSourceIndexMap[raw.sourceIndex] = newSourceIndex = addSource(combinedPath); + if (map.sourcesContent && typeof map.sourcesContent[raw.sourceIndex] === "string") { + setSourceContent(newSourceIndex, map.sourcesContent[raw.sourceIndex]); + } + } + + newSourceLine = raw.sourceLine; + newSourceCharacter = raw.sourceColumn; + if (map.names && raw.nameIndex !== undefined) { + if (!nameIndexToNewNameIndexMap) nameIndexToNewNameIndexMap = []; + newNameIndex = nameIndexToNewNameIndexMap[raw.nameIndex]; + if (newNameIndex === undefined) { + nameIndexToNewNameIndexMap[raw.nameIndex] = newNameIndex = addName(map.names[raw.nameIndex]); + } + } + } + + const newGeneratedLine = raw.emittedLine + generatedLine; + const newGeneratedCharacter = raw.emittedLine === 0 ? raw.emittedColumn + generatedCharacter : raw.emittedColumn; + addMapping(newGeneratedLine, newGeneratedCharacter, newSourceIndex, newSourceLine, newSourceCharacter, newNameIndex); + }); + exit(); + } + + function shouldCommitMapping() { + return !hasMapping + || generatedLine !== pendingGeneratedLine + || generatedCharacter !== pendingGeneratedCharacter + || sourceIndex !== pendingSourceIndex + || sourceLine !== pendingSourceLine + || sourceCharacter !== pendingSourceCharacter + || nameIndex !== pendingNameIndex; + } + + // Encoding for sourcemap span + function commitPendingMapping() { + if (!hasPending || !shouldCommitMapping()) { + return; + } + + enter(); + Debug.assert(pendingGeneratedCharacter >= 0, "lastRecordedGeneratedCharacter was negative"); + Debug.assert(pendingSourceIndex >= 0, "lastRecordedSourceIndex was negative"); + Debug.assert(pendingSourceLine >= 0, "lastRecordedSourceLine was negative"); + Debug.assert(pendingSourceCharacter >= 0, "lastRecordedSourceCharacter was negative"); + + sourceMapData.sourceMapDecodedMappings.push({ + emittedLine: pendingGeneratedLine, + emittedColumn: pendingGeneratedCharacter, + sourceIndex: pendingSourceIndex, + sourceLine: pendingSourceLine, + sourceColumn: pendingSourceCharacter, + nameIndex: hasPendingName ? pendingNameIndex : undefined + }); + + // Line/Comma delimiters + if (generatedLine < pendingGeneratedLine) { + // Emit line delimiters + do { + sourceMapData.sourceMapMappings += ";"; + generatedLine++; + generatedCharacter = 0; + } + while (generatedLine < pendingGeneratedLine); + } + else { + Debug.assertEqual(generatedLine, pendingGeneratedLine, "generatedLine cannot backtrack"); + // Emit comma to separate the entry + if (hasMapping) { + sourceMapData.sourceMapMappings += ","; + } + } + + // 1. Relative generated character + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingGeneratedCharacter - generatedCharacter); + generatedCharacter = pendingGeneratedCharacter; + + if (hasPendingSource) { + // 2. Relative sourceIndex + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingSourceIndex - sourceIndex); + sourceIndex = pendingSourceIndex; + + // 3. Relative source line + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingSourceLine - sourceLine); + sourceLine = pendingSourceLine; + + // 4. Relative source character + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingSourceCharacter - sourceCharacter); + sourceCharacter = pendingSourceCharacter; + + if (hasPendingName) { + // 5. Relative nameIndex + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingNameIndex - nameIndex); + nameIndex = pendingNameIndex; + } + } + + hasMapping = true; + exit(); + } + + function toJSON(): RawSourceMap { + commitPendingMapping(); + return { + version: 3, + file: sourceMapData.sourceMapFile, + sourceRoot: sourceMapData.sourceMapSourceRoot, + sources: sourceMapData.sourceMapSources, + names: sourceMapData.sourceMapNames, + mappings: sourceMapData.sourceMapMappings, + sourcesContent: sourceMapData.sourceMapSourcesContent, + }; + } + } + + function getSourceMapEmitter(generator: SourceMapGenerator, writer: EmitTextWriter): SourceMapEmitter { + if (writer.getSourceMapEmitter) { + return writer.getSourceMapEmitter(generator); + } + + return createSourceMapEmitter(generator, writer); + } + + function createSourceMapEmitter(generator: SourceMapGenerator, writer: EmitTextWriter) { + return { + emitMapping, + emitSourceMap + }; + + function emitMapping(sourceIndex?: number, sourceLine?: number, sourceCharacter?: number, nameIndex?: number) { + return generator.addMapping(writer.getLine(), writer.getColumn(), sourceIndex!, sourceLine!, sourceCharacter!, nameIndex); + } + + function emitSourceMap(sourceMap: RawSourceMap, sourceMapPath: string): void { + return generator.appendSourceMap(writer.getLine(), writer.getColumn(), sourceMap, sourceMapPath); + } + } + + function isStringOrNull(x: any) { + // tslint:disable-next-line:no-null-keyword + return typeof x === "string" || x === null; + } + + export function isRawSourceMap(x: any): x is RawSourceMap { + // tslint:disable-next-line:no-null-keyword + return x !== null + && typeof x === "object" + && x.version === 3 + && typeof x.file === "string" + && typeof x.mappings === "string" + && isArray(x.sources) && every(x.sources, isString) + && (x.sourceRoot === undefined || typeof x.sourceRoot === "string") + && (x.sourcesContent === undefined || isArray(x.sourcesContent) && every(x.sourcesContent, isStringOrNull)) + && (x.names === undefined || isArray(x.names) && every(x.names, isString)); + } + + function tryParseRawSourceMap(text: string) { + try { + const parsed = JSON.parse(text); + if (isRawSourceMap(parsed)) { + return parsed; + } + } + catch { + // empty + } + + return undefined; + } + const base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; function base64FormatEncode(inValue: number) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b5519bb4d8489..ea41e29572ec8 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4361,6 +4361,7 @@ namespace ts { jsxFactory?: string; composite?: boolean; removeComments?: boolean; + removeWhitespace?: boolean; rootDir?: string; rootDirs?: string[]; skipLibCheck?: boolean; @@ -5039,6 +5040,7 @@ namespace ts { IdentifierName, // Emitting an IdentifierName MappedTypeParameter, // Emitting a TypeParameterDeclaration inside of a MappedTypeNode Unspecified, // Emitting an otherwise unspecified node + EmbeddedStatement, // Emitting an embedded statement } /* @internal */ @@ -5290,13 +5292,84 @@ namespace ts { /*@internal*/ inlineSourceMap?: boolean; /*@internal*/ extendedDiagnostics?: boolean; /*@internal*/ onlyPrintJsDocStyle?: boolean; + /*@internal*/ removeWhitespace?: boolean; + } + + /* @internal */ + export interface RawSourceMap { + version: 3; + file: string; + sourceRoot?: string; + sources: string[]; + sourcesContent?: (string | null)[]; + mappings: string; + names?: string[]; + } + + /** + * Generates a source map. + * @internal + */ + export interface SourceMapGenerator { + /** + * Adds a source to the source map. + */ + addSource(fileName: string): number; + /** + * Set the content for a source. + */ + setSourceContent(sourceIndex: number, content: string | null): void; + /** + * Adds a name. + */ + addName(name: string): number; + /** + * Adds a mapping without source information. + */ + addMapping(generatedLine: number, generatedCharacter: number): void; + /** + * Adds a mapping with source information. + */ + addMapping(generatedLine: number, generatedCharacter: number, sourceIndex: number, sourceLine: number, sourceCharacter: number, nameIndex?: number): void; + /** + * Appends a source map. + */ + appendSourceMap(generatedLine: number, generatedCharacter: number, sourceMap: RawSourceMap, sourceMapPath: string): void; + /** + * Gets the source map as a `RawSourceMap` object. + */ + toJSON(): RawSourceMap; + /** + * Gets the string representation of the source map. + */ + toString(): string; + } + + /** + * Emits SourceMap information through an entangled `EmitTextWriter` + * @internal + */ + export interface SourceMapEmitter { + /** + * Emits a mapping without source information. + */ + emitMapping(): void; + /** + * Emits a mapping with source information. + */ + emitMapping(sourceIndex: number, sourceLine: number, sourceCharacter: number, nameIndex?: number): void; + /** + * Emits a source map. + */ + emitSourceMap(sourceMap: RawSourceMap, sourceMapPath: string): void; } /* @internal */ export interface EmitTextWriter extends SymbolWriter { write(s: string): void; - writeTextOfNode(text: string, node: Node): void; writeTrailingSemicolon(text: string): void; + writeComment(text: string): void; + flush(): void; getText(): string; rawWrite(s: string): void; writeLiteral(s: string): void; @@ -5305,6 +5378,7 @@ namespace ts { getColumn(): number; getIndent(): number; isAtStartOfLine(): boolean; + getSourceMapEmitter?(generator: SourceMapGenerator): SourceMapEmitter; } export interface GetEffectiveTypeRootsHost { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 546ed2f6261b4..fe5735be7bd8d 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -59,11 +59,10 @@ namespace ts { let str = ""; const writeText: (text: string) => void = text => str += text; - return { + const writer: EmitTextWriter = { getText: () => str, write: writeText, rawWrite: writeText, - writeTextOfNode: writeText, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -72,8 +71,9 @@ namespace ts { writeLiteral: writeText, writeParameter: writeText, writeProperty: writeText, - writeSymbol: writeText, + writeSymbol: (s, _) => writeText(s), writeTrailingSemicolon: writeText, + writeComment: writeText, getTextPos: () => str.length, getLine: () => 0, getColumn: () => 0, @@ -86,11 +86,13 @@ namespace ts { increaseIndent: noop, decreaseIndent: noop, clear: () => str = "", + flush: noop, trackSymbol: noop, reportInaccessibleThisError: noop, reportInaccessibleUniqueSymbolError: noop, - reportPrivateInBaseOfClassExpression: noop, + reportPrivateInBaseOfClassExpression: noop }; + return writer; } export function toPath(fileName: string, basePath: string | undefined, getCanonicalFileName: (path: string) => string): Path { @@ -3084,18 +3086,11 @@ namespace ts { } } - function writeTextOfNode(text: string, node: Node) { - const s = getTextOfNodeFromSourceText(text, node); - write(s); - updateLineCountAndPosFor(s); - } - reset(); - return { + const writer: EmitTextWriter = { write, rawWrite, - writeTextOfNode, writeLiteral, writeLine, increaseIndent: () => { indent++; }, @@ -3107,6 +3102,7 @@ namespace ts { getText: () => output, isAtStartOfLine: () => lineStart, clear: reset, + flush: noop, reportInaccessibleThisError: noop, reportPrivateInBaseOfClassExpression: noop, reportInaccessibleUniqueSymbolError: noop, @@ -3118,9 +3114,12 @@ namespace ts { writePunctuation: write, writeSpace: write, writeStringLiteral: write, - writeSymbol: write, - writeTrailingSemicolon: write + writeSymbol: (s, _) => write(s), + writeTrailingSemicolon: write, + writeComment: write }; + + return writer; } export function getTrailingSemicolonOmittingWriter(writer: EmitTextWriter): EmitTextWriter { @@ -3174,6 +3173,10 @@ namespace ts { commitPendingTrailingSemicolon(); writer.writeProperty(s); }, + writeComment(s) { + commitPendingTrailingSemicolon(); + writer.writeComment(s); + }, writeLine() { commitPendingTrailingSemicolon(); writer.writeLine(); @@ -3189,6 +3192,293 @@ namespace ts { }; } + enum SourceMapInfoKind { + emitMapping, + emitSourceMap, + } + + type SourceMapInfo = + | { kind: SourceMapInfoKind.emitMapping, sourceIndex: number | undefined, sourceLine: number | undefined, sourceCharacter: number | undefined, nameIndex: number | undefined } + | { kind: SourceMapInfoKind.emitSourceMap, map: RawSourceMap, sourceMapPath: string }; + + const enum WriteKind { + none, + write, + writeKeyword, + writeOperator, + writePunctuation, + writeTrailingSemicolon, + writeStringLiteral, + writeLiteral, + writeParameter, + writeProperty, + writeComment, + writeSymbol, + } + + export function getWhitespaceRemovingTextWriter(writer: EmitTextWriter): EmitTextWriter { + let pendingWrite = WriteKind.none; + let pendingText = ""; + let pendingSymbol: Symbol | undefined; + let pendingSourceMapInfo: SourceMapInfo[] | undefined; + let requestedSourceMapInfoBeforeSpace: SourceMapInfo[] | undefined; + let requestedSourceMapInfoAfterSpace: SourceMapInfo[] | undefined; + let requestedSpace = false; + let sourceMapGenerator: SourceMapGenerator | undefined; + let sourceMapEmitter: SourceMapEmitter | undefined; + + function getRequestedSourceMapInfoArray(): SourceMapInfo[] { + return requestedSpace + ? requestedSourceMapInfoAfterSpace || (requestedSourceMapInfoAfterSpace = []) + : requestedSourceMapInfoBeforeSpace || (requestedSourceMapInfoBeforeSpace = []); + } + + function pushMapping(sourceIndex?: number, sourceLine?: number, sourceCharacter?: number, nameIndex?: number) { + getRequestedSourceMapInfoArray().push({ kind: SourceMapInfoKind.emitMapping, sourceIndex, sourceLine, sourceCharacter, nameIndex }); + } + + function pushSourceMap(map: RawSourceMap, sourceMapPath: string) { + getRequestedSourceMapInfoArray().push({ kind: SourceMapInfoKind.emitSourceMap, map, sourceMapPath }); + } + + function pushRequestedSourceMapInfo(requestedSourceMapInfo: SourceMapInfo[] | undefined) { + if (some(requestedSourceMapInfo)) { + if (!pendingSourceMapInfo) pendingSourceMapInfo = []; + pendingSourceMapInfo.push(...requestedSourceMapInfo); + clear(requestedSourceMapInfo); + } + } + + function pushWrite(kind: WriteKind, text: string) { + commitPendingWrite(); + pushRequestedSourceMapInfo(requestedSourceMapInfoBeforeSpace); + pushRequestedSourceMapInfo(requestedSourceMapInfoAfterSpace); + pendingWrite = kind; + pendingText = text; + } + + function commitPendingSourceMapInfo() { + forEach(pendingSourceMapInfo, processPendingSourceMapInfo); + clear(pendingSourceMapInfo); + } + + function commitPendingWrite() { + commitPendingSourceMapInfo(); + processPendingWrite(); + discardPendingWrite(); + } + + function discardPendingWrite() { + pendingWrite = WriteKind.none; + pendingText = ""; + pendingSymbol = undefined; + if (some(pendingSourceMapInfo)) { + if (!requestedSourceMapInfoBeforeSpace) requestedSourceMapInfoBeforeSpace = []; + requestedSourceMapInfoBeforeSpace.unshift(...pendingSourceMapInfo); + } + } + + function processPendingSourceMapInfo(info: SourceMapInfo) { + switch (info.kind) { + case SourceMapInfoKind.emitMapping: return sourceMapGenerator!.addMapping(writer.getLine(), writer.getColumn(), info.sourceIndex!, info.sourceLine!, info.sourceCharacter!, info.nameIndex); + case SourceMapInfoKind.emitSourceMap: return sourceMapGenerator!.appendSourceMap(writer.getLine(), writer.getColumn(), info.map, info.sourceMapPath); + default: return Debug.assertNever(info); + } + } + + function processPendingWrite() { + switch (pendingWrite) { + case WriteKind.none: return; + case WriteKind.write: return writer.write(pendingText); + case WriteKind.writeKeyword: return writer.writeKeyword(pendingText); + case WriteKind.writeOperator: return writer.writeOperator(pendingText); + case WriteKind.writePunctuation: return writer.writePunctuation(pendingText); + case WriteKind.writeTrailingSemicolon: return writer.writeTrailingSemicolon(pendingText); + case WriteKind.writeStringLiteral: return writer.writeStringLiteral(pendingText); + case WriteKind.writeLiteral: return writer.writeLiteral(pendingText); + case WriteKind.writeParameter: return writer.writeParameter(pendingText); + case WriteKind.writeProperty: return writer.writeProperty(pendingText); + case WriteKind.writeComment: return writer.writeComment(pendingText); + case WriteKind.writeSymbol: return writer.writeSymbol(pendingText, pendingSymbol!); + default: return Debug.assertNever(pendingWrite); + } + } + + function flush() { + commitPendingWrite(); + pushRequestedSourceMapInfo(requestedSourceMapInfoBeforeSpace); + pushRequestedSourceMapInfo(requestedSourceMapInfoAfterSpace); + commitPendingSourceMapInfo(); + } + + function beforeWrite() { + commitPendingWrite(); + pushRequestedSourceMapInfo(requestedSourceMapInfoBeforeSpace); + commitPendingSourceMapInfo(); + } + + function writeSpace() { + beforeWrite(); + writer.writeSpace(" "); + requestedSpace = false; + } + + function writeSpaceBeforeWordIfNeeded() { + if (!requestedSpace) return; + if (pendingWrite === WriteKind.writeKeyword || + pendingWrite === WriteKind.writeParameter || + pendingWrite === WriteKind.writeProperty || + pendingWrite === WriteKind.write) { + writeSpace(); + } + } + + function writeSpaceBeforeLiteralIfNeeded(s: string) { + if (isIdentifierPart(s.charCodeAt(0), /*languageVersion*/ undefined)) { + writeSpaceBeforeWordIfNeeded(); + } + } + + function writeSpaceBeforeOperatorIfNeeded(s: string) { + if (!requestedSpace || pendingWrite !== WriteKind.writeOperator) return; + if (pendingText === "+" && (s === "+" || s === "++") || + pendingText === "-" && (s === "-" || s === "--")) { + writeSpace(); + } + } + + function writeDotBeforeDotIfNeeded(s: string) { + if (s === "." && pendingWrite === WriteKind.writeStringLiteral) { + const ch = pendingText.charCodeAt(0); + if (ch === CharacterCodes._0 && pendingText.length > 1) { + // prefixed literals (00, 0o, 0x, 0b, etc.) do not need a `.`. Also catches 0. and 0e + return; + } + if (ch === CharacterCodes.dot) { + // decimal literal with leading `.` does not require a `.` + return; + } + if (isDigit(ch)) { + for (let i = 1; i < pendingText.length; i++) { + const ch = pendingText.charCodeAt(i); + if (ch === CharacterCodes.dot || ch === CharacterCodes.E || ch === CharacterCodes.e) { + // decimal literal with a `.` or scientific notation does not require a `.` + return; + } + } + } + pushWrite(WriteKind.writePunctuation, "."); + requestedSpace = false; + } + } + + function discardTrailingSemicolonBeforeEndBrace(s: string) { + if (s === "}" && pendingWrite === WriteKind.writeTrailingSemicolon) { + discardPendingWrite(); + } + } + + function discardTrailingSemicolonBeforeTrailingSemicolon() { + if (pendingWrite === WriteKind.writeTrailingSemicolon) { + discardPendingWrite(); + } + } + + return { + getTextPos: writer.getTextPos, + getLine: writer.getLine, + getColumn: writer.getColumn, + getIndent: writer.getIndent, + isAtStartOfLine: writer.isAtStartOfLine, + increaseIndent: noop, + decreaseIndent: noop, + clear() { + writer.clear(); + discardPendingWrite(); + clear(requestedSourceMapInfoBeforeSpace); + clear(requestedSourceMapInfoAfterSpace); + requestedSpace = false; + sourceMapGenerator = undefined; + }, + flush, + write(s) { + writeSpaceBeforeWordIfNeeded(); + pushWrite(WriteKind.write, s); + }, + rawWrite(s) { + flush(); + writer.rawWrite(s); + }, + writeKeyword(s) { + writeSpaceBeforeWordIfNeeded(); + pushWrite(WriteKind.writeKeyword, s); + }, + writeOperator(s) { + writeSpaceBeforeOperatorIfNeeded(s); + pushWrite(WriteKind.writeOperator, s); + }, + writePunctuation(s) { + discardTrailingSemicolonBeforeEndBrace(s); + writeDotBeforeDotIfNeeded(s); + pushWrite(WriteKind.writePunctuation, s); + }, + writeTrailingSemicolon(s) { + discardTrailingSemicolonBeforeTrailingSemicolon(); + pushWrite(WriteKind.writeTrailingSemicolon, s); + }, + writeSpace(_) { + requestedSpace = true; + }, + writeStringLiteral(s) { + writeSpaceBeforeLiteralIfNeeded(s); + pushWrite(WriteKind.writeStringLiteral, s); + }, + writeLiteral(s) { + writeSpaceBeforeLiteralIfNeeded(s); + pushWrite(WriteKind.writeLiteral, s); + }, + writeParameter(s) { + pushWrite(WriteKind.writeParameter, s); + }, + writeProperty(s) { + pushWrite(WriteKind.writeProperty, s); + }, + writeComment(s) { + pushWrite(WriteKind.writeComment, s); + }, + writeSymbol(text, symbol) { + writeSpaceBeforeWordIfNeeded(); + pendingWrite = WriteKind.writeSymbol; + pendingText = text; + pendingSymbol = symbol; + }, + writeLine() { + if (pendingWrite === WriteKind.writeComment) { + flush(); + writer.writeLine(); + requestedSpace = false; + } + else { + requestedSpace = true; + } + }, + getText() { + flush(); + return writer.getText(); + }, + getSourceMapEmitter(writer) { + sourceMapGenerator = writer; + if (!sourceMapEmitter) { + sourceMapEmitter = { + emitMapping: pushMapping, + emitSourceMap: pushSourceMap + }; + } + return sourceMapEmitter; + } + }; + } + export function getResolvedExternalModuleName(host: EmitHost, file: SourceFile, referenceFile?: SourceFile): string { return file.moduleName || getExternalModuleNameFromPath(host, file.fileName, referenceFile && referenceFile.fileName); } @@ -3473,13 +3763,13 @@ namespace ts { writeComment: (text: string, lineMap: ReadonlyArray, writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) => void) { if (comments && comments.length > 0) { if (leadingSeparator) { - writer.write(" "); + writer.writeSpace(" "); } let emitInterveningSeparator = false; for (const comment of comments) { if (emitInterveningSeparator) { - writer.write(" "); + writer.writeSpace(" "); emitInterveningSeparator = false; } @@ -3493,7 +3783,7 @@ namespace ts { } if (emitInterveningSeparator && trailingSeparator) { - writer.write(" "); + writer.writeSpace(" "); } } } @@ -3627,7 +3917,7 @@ namespace ts { } else { // Single line comment of style //.... - writer.write(text.substring(commentPos, commentEnd)); + writer.writeComment(text.substring(commentPos, commentEnd)); } } @@ -3636,14 +3926,14 @@ namespace ts { const currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, ""); if (currentLineText) { // trimmed forward and ending spaces text - writer.write(currentLineText); + writer.writeComment(currentLineText); if (end !== commentEnd) { writer.writeLine(); } } else { // Empty string - make sure we write empty line - writer.writeLiteral(newLine); + writer.rawWrite(newLine); } } diff --git a/src/harness/sourceMapRecorder.ts b/src/harness/sourceMapRecorder.ts index 22f0659690b61..3100fcdc2c7cc 100644 --- a/src/harness/sourceMapRecorder.ts +++ b/src/harness/sourceMapRecorder.ts @@ -130,12 +130,19 @@ namespace Harness.SourceMapRecorder { } export function recordNewSourceFileSpan(sourceMapSpan: ts.SourceMapSpan, newSourceFileCode: string) { - assert.isTrue(spansOnSingleLine.length === 0 || spansOnSingleLine[0].sourceMapSpan.emittedLine !== sourceMapSpan.emittedLine, "new file source map span should be on new line. We currently handle only that scenario"); + let continuesLine = false; + if (spansOnSingleLine.length > 0 && spansOnSingleLine[0].sourceMapSpan.emittedLine === sourceMapSpan.emittedLine) { + writeRecordedSpans(); + spansOnSingleLine = []; + nextJsLineToWrite--; // walk back one line to reprint the line + continuesLine = true; + } + recordSourceMapSpan(sourceMapSpan); assert.isTrue(spansOnSingleLine.length === 1); sourceMapRecorder.WriteLine("-------------------------------------------------------------------"); - sourceMapRecorder.WriteLine("emittedFile:" + jsFile.file); + sourceMapRecorder.WriteLine("emittedFile:" + jsFile.file + (continuesLine ? ` (${sourceMapSpan.emittedLine + 1}, ${sourceMapSpan.emittedColumn + 1})` : "")); sourceMapRecorder.WriteLine("sourceFile:" + sourceMapSources[spansOnSingleLine[0].sourceMapSpan.sourceIndex]); sourceMapRecorder.WriteLine("-------------------------------------------------------------------"); diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index cd6810e5dd34f..3d13df8bb18e6 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -895,6 +895,9 @@ namespace ts.textChanges { this.writer.write(s); this.setLastNonTriviaPosition(s, /*force*/ false); } + writeComment(s: string): void { + this.writer.writeComment(s); + } writeKeyword(s: string): void { this.writer.writeKeyword(s); this.setLastNonTriviaPosition(s, /*force*/ false); @@ -931,9 +934,6 @@ namespace ts.textChanges { this.writer.writeSymbol(s, sym); this.setLastNonTriviaPosition(s, /*force*/ false); } - writeTextOfNode(text: string, node: Node): void { - this.writer.writeTextOfNode(text, node); - } writeLine(): void { this.writer.writeLine(); } @@ -969,6 +969,9 @@ namespace ts.textChanges { isAtStartOfLine(): boolean { return this.writer.isAtStartOfLine(); } + flush(): void { + this.writer.flush(); + } clear(): void { this.writer.clear(); this.lastNonTriviaPosition = 0; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 058bd397b7726..6ad6752fcab6e 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1433,7 +1433,7 @@ namespace ts { writeSymbol, writeLine, write: unknownWrite, - writeTextOfNode: unknownWrite, + writeComment: unknownWrite, getText: () => "", getTextPos: () => 0, getColumn: () => 0, @@ -1444,6 +1444,7 @@ namespace ts { increaseIndent: () => { indent++; }, decreaseIndent: () => { indent--; }, clear: resetWriter, + flush: noop, trackSymbol: noop, reportInaccessibleThisError: noop, reportInaccessibleUniqueSymbolError: noop, diff --git a/src/testRunner/unittests/customTransforms.ts b/src/testRunner/unittests/customTransforms.ts index 8cbc42f759929..4217469e31e36 100644 --- a/src/testRunner/unittests/customTransforms.ts +++ b/src/testRunner/unittests/customTransforms.ts @@ -18,7 +18,7 @@ namespace ts { writeFile: (fileName, text) => outputs.set(fileName, text), }; - const program = createProgram(arrayFrom(fileMap.keys()), options, host); + const program = createProgram(arrayFrom(fileMap.keys()), { newLine: NewLineKind.LineFeed, ...options }, host); program.emit(/*targetSourceFile*/ undefined, host.writeFile, /*cancellationToken*/ undefined, /*emitOnlyDtsFiles*/ false, customTransformers); Harness.Baseline.runBaseline(`customTransforms/${name}.js`, () => { let content = ""; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index bf4d44c982af0..57de3eed1ff42 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2510,6 +2510,7 @@ declare namespace ts { jsxFactory?: string; composite?: boolean; removeComments?: boolean; + removeWhitespace?: boolean; rootDir?: string; rootDirs?: string[]; skipLibCheck?: boolean; @@ -2780,7 +2781,8 @@ declare namespace ts { Expression = 1, IdentifierName = 2, MappedTypeParameter = 3, - Unspecified = 4 + Unspecified = 4, + EmbeddedStatement = 5 } interface TransformationContext { /** Gets the compiler options supplied to the transformer. */ diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index dea292370b89c..bbbda716c2900 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2330,6 +2330,7 @@ declare namespace ts { jsxFactory?: string; composite?: boolean; removeComments?: boolean; + removeWhitespace?: boolean; rootDir?: string; rootDirs?: string[]; skipLibCheck?: boolean; @@ -2554,7 +2555,8 @@ declare namespace ts { Expression = 1, IdentifierName = 2, MappedTypeParameter = 3, - Unspecified = 4 + Unspecified = 4, + EmbeddedStatement = 5 } interface TransformationContext { getCompilerOptions(): CompilerOptions; diff --git a/tests/baselines/reference/removeWhitespace.outDir.js b/tests/baselines/reference/removeWhitespace.outDir.js new file mode 100644 index 0000000000000..9d52cc233859e --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outDir.js @@ -0,0 +1,223 @@ +//// [tests/cases/conformance/removeWhitespace/removeWhitespace.outDir.ts] //// + +//// [global.d.ts] +declare let obj: any, i: any, fn; + +//// [propertyAccess.ts] +obj.a +obj .a +obj. a +obj . a + +obj. + a + +obj + .a + +obj + . + a + +obj // comment + . // comment + a // comment + +obj /* comment */ + . /* comment */ + a /* comment */ + +1..valueOf +1.. valueOf +1. .valueOf +1. . valueOf +1 .valueOf +1 . valueOf + +1.. + valueOf + +1. + .valueOf + +1. + . + valueOf + +1. // comment + . // comment + valueOf // comment + +1. /* comment */ + . /* comment */ + valueOf /* comment */ + +1 + .valueOf + +1 + . + valueOf + +1 // comment + . // comment + valueOf // comment + +1 /* comment */ + . /* comment */ + valueOf /* comment */ + +//// [elementAccess.ts] +obj["a"] +obj [ "a" ] + +obj [ + "a" ] + +obj + [ + "a" + ] + +obj // comment + [ // comment + "a" // comment + ] // comment + +obj /* comment */ + [ /* comment */ + "a" /* comment */ + ] /* comment */ + +//// [update.ts] +i + + i +i + +i +i+ + i +i+ +i + +i + ++ i +i + ++i +i+ ++ i +i+ ++i + +i ++ + i +i ++ +i +i++ + i +i++ +i +i+++i + +i - - i +i - -i +i- - i +i- -i + +i - -- i +i - --i +i- -- i +i- --i + +i -- - i +i -- -i +i-- - i +i-- -i +i---i + +//// [switch.ts] +switch (i) { + case 0: break; + case 1: break; + default: break; +} + +//// [keywords.ts] +delete obj.a +delete (obj).a +delete [][0] +void obj.a +void (obj).a +void [][0] +typeof obj.a +typeof (obj).a +typeof [][0] +function f1() { + return typeof obj +} +async function* f2() { + yield 1 + yield obj + yield (obj) + yield [] + yield* [] + yield *[] + yield * [] + yield + i + yield yield + yield typeof obj + yield void obj + yield delete obj.a + await 1 + await obj + for await (const x of []); + return yield await obj +} +export class C {} +export default function() {} + +//// [statements.ts] +obj; +fn(); +; +function fn3() { + obj; + fn(); + ; + function f() {} + return; + function g() {} +} + +//// [variables.ts] +var a = 0, b, { c } = obj, [d] = obj; +let e = 0, f, { g } = obj, [h] = obj; + +//// [for.ts] +for(;;){} + +//// [embeddedStatement.ts] +{while(true);} + +//// [propertyAccess.js] +obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj// comment +.// comment +a;// comment +obj/* comment */./* comment */a;/* comment */ +1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1.// comment +.// comment +valueOf;// comment +1./* comment */./* comment */valueOf;/* comment */ +1..valueOf;1..valueOf;1// comment +.// comment +valueOf;// comment +1/* comment */./* comment */valueOf;/* comment */ +//# sourceMappingURL=propertyAccess.js.map//// [elementAccess.js] +obj["a"];obj["a"];obj["a"];obj["a"];obj// comment +[// comment +"a"// comment +];// comment +obj/* comment */[/* comment */"a"/* comment */];/* comment */ +//# sourceMappingURL=elementAccess.js.map//// [update.js] +i+ +i;i+ +i;i+ +i;i+ +i;i+ ++i;i+ ++i;i+ ++i;i+ ++i;i+++i;i+++i;i+++i;i+++i;i+++i;i- -i;i- -i;i- -i;i- -i;i- --i;i- --i;i- --i;i- --i;i---i;i---i;i---i;i---i;i---i; +//# sourceMappingURL=update.js.map//// [switch.js] +switch(i){case 0:break;case 1:break;default:break} +//# sourceMappingURL=switch.js.map//// [keywords.js] +delete obj.a;delete(obj).a;delete[][0];void obj.a;void(obj).a;void[][0];typeof obj.a;typeof(obj).a;typeof[][0];function f1(){return typeof obj}async function*f2(){yield 1;yield obj;yield(obj);yield[];yield*[];yield*[];yield*[];yield;i;yield yield;yield typeof obj;yield void obj;yield delete obj.a;await 1;await obj;for await(const x of[]);return yield await obj}export class C{}export default function(){} +//# sourceMappingURL=keywords.js.map//// [statements.js] +obj;fn();function fn3(){obj;fn();function f(){}return;function g(){}} +//# sourceMappingURL=statements.js.map//// [variables.js] +var a=0,b,{c}=obj,[d]=obj;let e=0,f,{g}=obj,[h]=obj; +//# sourceMappingURL=variables.js.map//// [for.js] +for(;;){} +//# sourceMappingURL=for.js.map//// [embeddedStatement.js] +{while(true);} +//# sourceMappingURL=embeddedStatement.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outDir.js.map b/tests/baselines/reference/removeWhitespace.outDir.js.map new file mode 100644 index 0000000000000..edf16207a595a --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outDir.js.map @@ -0,0 +1,10 @@ +//// [propertyAccess.js.map] +{"version":3,"file":"propertyAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/propertyAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAC,CACL,GAAG,CAAE,CAAC,CACN,GAAG,CAAE,CAAC,CACN,GAAG,CAAG,CAAC,CAEP,GAAG,CACC,CAAC,CAEL,GAAG,CACE,CAAC,CAEN,GAAG,CAEC,CAAC,CAEL,GAAI,UAAU;CACR,UAAU;AACZ,CAAC,CAAC,UAAU;AAEhB,GAAI,aAAa,CACX,aACF,CAAC,CAAC,aAAa;AAEnB,EAAE,CAAC,OAAO,CACV,EAAE,CAAE,OAAO,CACX,EAAE,CAAE,OAAO,CACX,EAAE,CAAG,OAAO,CACZ,CAAC,EAAE,OAAO,CACV,CAAC,EAAG,OAAO,CAEX,EAAE,CACE,OAAO,CAEX,EAAE,CACG,OAAO,CAEZ,EAAE,CAEE,OAAO,CAEX,EAAG,UAAU;CACP,UAAU;AACZ,OAAO,CAAC,UAAU;AAEtB,EAAG,aAAa,CACV,aACF,OAAO,CAAC,aAAa;AAEzB,CAAC,EACI,OAAO,CAEZ,CAAC,EAEG,OAAO,CAEX,CAAE,UAAU;CACN,UAAU;AACZ,OAAO,CAAC,UAAU;AAEtB,CAAE,aAAa,CACT,aACF,OAAO,CAAC,aAAa"}//// [elementAccess.js.map] +{"version":3,"file":"elementAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/elementAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,GAAG,CAAC,CACR,GAAG,CAAG,GAAG,CAAE,CAEX,GAAG,CACC,GAAG,CAAE,CAET,GAAG,CAEC,GAAG,CACF,CAEL,GAAI,UAAU;CACR,UAAU;AACZ,GAAI,UAAU;CACb,CAAC,UAAU;AAEhB,GAAI,aAAa,CACX,aACF,GAAI,aAAa,CAChB,CAAC,aAAa"}//// [update.js.map] +{"version":3,"file":"update.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/update.ts"],"names":[],"mappings":"AAAA,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAAA"}//// [switch.js.map] +{"version":3,"file":"switch.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/switch.ts"],"names":[],"mappings":"AAAA,OAAQ,CAAC,CAAE,CACP,KAAK,CAAC,CAAE,MACR,KAAK,CAAC,CAAE,MACR,OAAO,CAAE,KAAM,CAClB"}//// [keywords.js.map] +{"version":3,"file":"keywords.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/keywords.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,KAAK,GAAG,CAAC,CAAC,CACV,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CACZ,IAAK,EAAE,CAAC,CAAC,CAAC,CACV,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,cACI,OAAO,OAAO,GAClB,CACA,MAAK,QAAS,CAAC,KACX,MAAM,CAAC,CACP,MAAM,GAAG,CACT,KAAM,CAAC,GAAG,CAAC,CACX,KAAM,EAAE,CACR,KAAK,CAAE,EAAE,CACT,KAAM,CAAC,EAAE,CACT,KAAM,CAAE,EAAE,CACV,KAAK,CACL,CAAC,CACD,MAAM,KAAK,CACX,MAAM,OAAO,GAAG,CAChB,MAAM,KAAK,GAAG,CACd,MAAM,OAAO,GAAG,CAAC,CAAC,CAClB,MAAM,CAAC,CACP,MAAM,GAAG,CACT,IAAI,KAAK,CAAE,MAAM,CAAC,GAAI,EAAE,CAAC,CACzB,OAAO,MAAM,MAAM,GACvB,CACA,OAAM,SACN,OAAO,OAAO,YAAa,CAAC"}//// [statements.js.map] +{"version":3,"file":"statements.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/statements.ts"],"names":[],"mappings":"AAAA,GAAG,CACH,EAAE,EACF,CACA,eACI,GAAG,CACH,EAAE,EACF,CACA,aAAc,CACd,OACA,aAAc,CAClB,CAAC"}//// [variables.js.map] +{"version":3,"file":"variables.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/variables.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CACpC,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CAAC"}//// [for.js.map] +{"version":3,"file":"for.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/for.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE"}//// [embeddedStatement.js.map] +{"version":3,"file":"embeddedStatement.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/embeddedStatement.ts"],"names":[],"mappings":"AAAA,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outDir.sourcemap.txt b/tests/baselines/reference/removeWhitespace.outDir.sourcemap.txt new file mode 100644 index 0000000000000..d35455dbc0499 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outDir.sourcemap.txt @@ -0,0 +1,1855 @@ +=================================================================== +JsFile: propertyAccess.js +mapUrl: propertyAccess.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/propertyAccess.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/propertyAccess.js +sourceFile:../tests/cases/conformance/removeWhitespace/propertyAccess.ts +------------------------------------------------------------------- +>>>obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj// comment +1 > +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^ +7 > ^ +8 > ^ +9 > ^ +10> ^^^ +11> ^ +12> ^ +13> ^ +14> ^^^ +15> ^ +16> ^ +17> ^ +18> ^^^ +19> ^ +20> ^ +21> ^ +22> ^^^ +23> ^ +24> ^ +25> ^ +26> ^^^ +27> ^ +28> ^ +29> ^ +30> ^^^ +31> ^^^^^^^^^^ +1 > +2 >obj +3 > . +4 > a +5 > + > +6 > obj +7 > . +8 > a +9 > + > +10> obj +11> . +12> a +13> + > +14> obj +15> . +16> a +17> + > + > +18> obj +19> . + > +20> a +21> + > + > +22> obj +23> + > . +24> a +25> + > + > +26> obj +27> + > . + > +28> a +29> + > + > +30> obj +31> // comment +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +5 >Emitted(1, 7) Source(2, 1) + SourceIndex(0) +6 >Emitted(1, 10) Source(2, 4) + SourceIndex(0) +7 >Emitted(1, 11) Source(2, 6) + SourceIndex(0) +8 >Emitted(1, 12) Source(2, 7) + SourceIndex(0) +9 >Emitted(1, 13) Source(3, 1) + SourceIndex(0) +10>Emitted(1, 16) Source(3, 4) + SourceIndex(0) +11>Emitted(1, 17) Source(3, 6) + SourceIndex(0) +12>Emitted(1, 18) Source(3, 7) + SourceIndex(0) +13>Emitted(1, 19) Source(4, 1) + SourceIndex(0) +14>Emitted(1, 22) Source(4, 4) + SourceIndex(0) +15>Emitted(1, 23) Source(4, 7) + SourceIndex(0) +16>Emitted(1, 24) Source(4, 8) + SourceIndex(0) +17>Emitted(1, 25) Source(6, 1) + SourceIndex(0) +18>Emitted(1, 28) Source(6, 4) + SourceIndex(0) +19>Emitted(1, 29) Source(7, 5) + SourceIndex(0) +20>Emitted(1, 30) Source(7, 6) + SourceIndex(0) +21>Emitted(1, 31) Source(9, 1) + SourceIndex(0) +22>Emitted(1, 34) Source(9, 4) + SourceIndex(0) +23>Emitted(1, 35) Source(10, 6) + SourceIndex(0) +24>Emitted(1, 36) Source(10, 7) + SourceIndex(0) +25>Emitted(1, 37) Source(12, 1) + SourceIndex(0) +26>Emitted(1, 40) Source(12, 4) + SourceIndex(0) +27>Emitted(1, 41) Source(14, 5) + SourceIndex(0) +28>Emitted(1, 42) Source(14, 6) + SourceIndex(0) +29>Emitted(1, 43) Source(16, 1) + SourceIndex(0) +30>Emitted(1, 46) Source(16, 5) + SourceIndex(0) +31>Emitted(1, 56) Source(16, 15) + SourceIndex(0) +--- +>>>.// comment +1 >^ +2 > ^^^^^^^^^^ +3 > ^^-> +1 > + > . +2 > // comment +1 >Emitted(2, 2) Source(17, 7) + SourceIndex(0) +2 >Emitted(2, 12) Source(17, 17) + SourceIndex(0) +--- +>>>a;// comment +1-> +2 >^ +3 > ^ +4 > ^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >a +3 > +4 > // comment +1->Emitted(3, 1) Source(18, 5) + SourceIndex(0) +2 >Emitted(3, 2) Source(18, 6) + SourceIndex(0) +3 >Emitted(3, 3) Source(18, 7) + SourceIndex(0) +4 >Emitted(3, 13) Source(18, 17) + SourceIndex(0) +--- +>>>obj/* comment */./* comment */a;/* comment */ +1-> +2 >^^^ +3 > ^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^ +6 > ^ +7 > ^ +8 > ^^^^^^^^^^^^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >obj +3 > /* comment */ +4 > + > . +5 > /* comment */ + > +6 > a +7 > +8 > /* comment */ +1->Emitted(4, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(4, 4) Source(20, 5) + SourceIndex(0) +3 >Emitted(4, 17) Source(20, 18) + SourceIndex(0) +4 >Emitted(4, 18) Source(21, 7) + SourceIndex(0) +5 >Emitted(4, 31) Source(22, 5) + SourceIndex(0) +6 >Emitted(4, 32) Source(22, 6) + SourceIndex(0) +7 >Emitted(4, 33) Source(22, 7) + SourceIndex(0) +8 >Emitted(4, 46) Source(22, 20) + SourceIndex(0) +--- +>>>1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1.// comment +1-> +2 >^^ +3 > ^ +4 > ^^^^^^^ +5 > ^ +6 > ^^ +7 > ^ +8 > ^^^^^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^^^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^^^^^ +17> ^ +18> ^ +19> ^^ +20> ^^^^^^^ +21> ^ +22> ^ +23> ^^ +24> ^^^^^^^ +25> ^ +26> ^^ +27> ^ +28> ^^^^^^^ +29> ^ +30> ^^ +31> ^ +32> ^^^^^^^ +33> ^ +34> ^^ +35> ^ +36> ^^^^^^^ +37> ^ +38> ^^ +39> ^^^^^^^^^^ +1-> + > + > +2 >1. +3 > . +4 > valueOf +5 > + > +6 > 1. +7 > . +8 > valueOf +9 > + > +10> 1. +11> . +12> valueOf +13> + > +14> 1. +15> . +16> valueOf +17> + > +18> 1 +19> . +20> valueOf +21> + > +22> 1 +23> . +24> valueOf +25> + > + > +26> 1. +27> . + > +28> valueOf +29> + > + > +30> 1. +31> + > . +32> valueOf +33> + > + > +34> 1. +35> + > . + > +36> valueOf +37> + > + > +38> 1. +39> // comment +1->Emitted(5, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(5, 3) Source(24, 3) + SourceIndex(0) +3 >Emitted(5, 4) Source(24, 4) + SourceIndex(0) +4 >Emitted(5, 11) Source(24, 11) + SourceIndex(0) +5 >Emitted(5, 12) Source(25, 1) + SourceIndex(0) +6 >Emitted(5, 14) Source(25, 3) + SourceIndex(0) +7 >Emitted(5, 15) Source(25, 5) + SourceIndex(0) +8 >Emitted(5, 22) Source(25, 12) + SourceIndex(0) +9 >Emitted(5, 23) Source(26, 1) + SourceIndex(0) +10>Emitted(5, 25) Source(26, 3) + SourceIndex(0) +11>Emitted(5, 26) Source(26, 5) + SourceIndex(0) +12>Emitted(5, 33) Source(26, 12) + SourceIndex(0) +13>Emitted(5, 34) Source(27, 1) + SourceIndex(0) +14>Emitted(5, 36) Source(27, 3) + SourceIndex(0) +15>Emitted(5, 37) Source(27, 6) + SourceIndex(0) +16>Emitted(5, 44) Source(27, 13) + SourceIndex(0) +17>Emitted(5, 45) Source(28, 1) + SourceIndex(0) +18>Emitted(5, 46) Source(28, 2) + SourceIndex(0) +19>Emitted(5, 48) Source(28, 4) + SourceIndex(0) +20>Emitted(5, 55) Source(28, 11) + SourceIndex(0) +21>Emitted(5, 56) Source(29, 1) + SourceIndex(0) +22>Emitted(5, 57) Source(29, 2) + SourceIndex(0) +23>Emitted(5, 59) Source(29, 5) + SourceIndex(0) +24>Emitted(5, 66) Source(29, 12) + SourceIndex(0) +25>Emitted(5, 67) Source(31, 1) + SourceIndex(0) +26>Emitted(5, 69) Source(31, 3) + SourceIndex(0) +27>Emitted(5, 70) Source(32, 5) + SourceIndex(0) +28>Emitted(5, 77) Source(32, 12) + SourceIndex(0) +29>Emitted(5, 78) Source(34, 1) + SourceIndex(0) +30>Emitted(5, 80) Source(34, 3) + SourceIndex(0) +31>Emitted(5, 81) Source(35, 6) + SourceIndex(0) +32>Emitted(5, 88) Source(35, 13) + SourceIndex(0) +33>Emitted(5, 89) Source(37, 1) + SourceIndex(0) +34>Emitted(5, 91) Source(37, 3) + SourceIndex(0) +35>Emitted(5, 92) Source(39, 5) + SourceIndex(0) +36>Emitted(5, 99) Source(39, 12) + SourceIndex(0) +37>Emitted(5, 100) Source(41, 1) + SourceIndex(0) +38>Emitted(5, 102) Source(41, 4) + SourceIndex(0) +39>Emitted(5, 112) Source(41, 14) + SourceIndex(0) +--- +>>>.// comment +1 >^ +2 > ^^^^^^^^^^ +3 > ^^^^^^^^-> +1 > + > . +2 > // comment +1 >Emitted(6, 2) Source(42, 7) + SourceIndex(0) +2 >Emitted(6, 12) Source(42, 17) + SourceIndex(0) +--- +>>>valueOf;// comment +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >valueOf +3 > +4 > // comment +1->Emitted(7, 1) Source(43, 5) + SourceIndex(0) +2 >Emitted(7, 8) Source(43, 12) + SourceIndex(0) +3 >Emitted(7, 9) Source(43, 13) + SourceIndex(0) +4 >Emitted(7, 19) Source(43, 23) + SourceIndex(0) +--- +>>>1./* comment */./* comment */valueOf;/* comment */ +1-> +2 >^^ +3 > ^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^ +6 > ^^^^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^ +1-> + > + > +2 >1. +3 > /* comment */ +4 > + > . +5 > /* comment */ + > +6 > valueOf +7 > +8 > /* comment */ +1->Emitted(8, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(8, 3) Source(45, 4) + SourceIndex(0) +3 >Emitted(8, 16) Source(45, 17) + SourceIndex(0) +4 >Emitted(8, 17) Source(46, 7) + SourceIndex(0) +5 >Emitted(8, 30) Source(47, 5) + SourceIndex(0) +6 >Emitted(8, 37) Source(47, 12) + SourceIndex(0) +7 >Emitted(8, 38) Source(47, 13) + SourceIndex(0) +8 >Emitted(8, 51) Source(47, 26) + SourceIndex(0) +--- +>>>1..valueOf;1..valueOf;1// comment +1 > +2 >^ +3 > ^^ +4 > ^^^^^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^ +10> ^ +11> ^^^^^^^^^^ +1 > + > + > +2 >1 +3 > + > . +4 > valueOf +5 > + > + > +6 > 1 +7 > + > . + > +8 > valueOf +9 > + > + > +10> 1 +11> // comment +1 >Emitted(9, 1) Source(49, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(49, 2) + SourceIndex(0) +3 >Emitted(9, 4) Source(50, 6) + SourceIndex(0) +4 >Emitted(9, 11) Source(50, 13) + SourceIndex(0) +5 >Emitted(9, 12) Source(52, 1) + SourceIndex(0) +6 >Emitted(9, 13) Source(52, 2) + SourceIndex(0) +7 >Emitted(9, 15) Source(54, 5) + SourceIndex(0) +8 >Emitted(9, 22) Source(54, 12) + SourceIndex(0) +9 >Emitted(9, 23) Source(56, 1) + SourceIndex(0) +10>Emitted(9, 24) Source(56, 3) + SourceIndex(0) +11>Emitted(9, 34) Source(56, 13) + SourceIndex(0) +--- +>>>.// comment +1 >^ +2 > ^^^^^^^^^^ +3 > ^^^^^^^^-> +1 > + > . +2 > // comment +1 >Emitted(10, 2) Source(57, 7) + SourceIndex(0) +2 >Emitted(10, 12) Source(57, 17) + SourceIndex(0) +--- +>>>valueOf;// comment +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >valueOf +3 > +4 > // comment +1->Emitted(11, 1) Source(58, 5) + SourceIndex(0) +2 >Emitted(11, 8) Source(58, 12) + SourceIndex(0) +3 >Emitted(11, 9) Source(58, 13) + SourceIndex(0) +4 >Emitted(11, 19) Source(58, 23) + SourceIndex(0) +--- +>>>1/* comment */./* comment */valueOf;/* comment */ +1-> +2 >^ +3 > ^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^ +6 > ^^^^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^ +1-> + > + > +2 >1 +3 > /* comment */ +4 > + > . +5 > /* comment */ + > +6 > valueOf +7 > +8 > /* comment */ +1->Emitted(12, 1) Source(60, 1) + SourceIndex(0) +2 >Emitted(12, 2) Source(60, 3) + SourceIndex(0) +3 >Emitted(12, 15) Source(60, 16) + SourceIndex(0) +4 >Emitted(12, 16) Source(61, 7) + SourceIndex(0) +5 >Emitted(12, 29) Source(62, 5) + SourceIndex(0) +6 >Emitted(12, 36) Source(62, 12) + SourceIndex(0) +7 >Emitted(12, 37) Source(62, 13) + SourceIndex(0) +8 >Emitted(12, 50) Source(62, 26) + SourceIndex(0) +--- +>>>//# sourceMappingURL=propertyAccess.js.map=================================================================== +JsFile: elementAccess.js +mapUrl: elementAccess.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/elementAccess.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/elementAccess.js +sourceFile:../tests/cases/conformance/removeWhitespace/elementAccess.ts +------------------------------------------------------------------- +>>>obj["a"];obj["a"];obj["a"];obj["a"];obj// comment +1 > +2 >^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^^ +10> ^ +11> ^ +12> ^^^ +13> ^ +14> ^^^ +15> ^ +16> ^ +17> ^^^ +18> ^ +19> ^^^ +20> ^ +21> ^ +22> ^^^ +23> ^^^^^^^^^^ +1 > +2 >obj +3 > [ +4 > "a" +5 > ] +6 > + > +7 > obj +8 > [ +9 > "a" +10> ] +11> + > + > +12> obj +13> [ + > +14> "a" +15> ] +16> + > + > +17> obj +18> + > [ + > +19> "a" +20> + > ] +21> + > + > +22> obj +23> // comment +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +5 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +6 >Emitted(1, 10) Source(2, 1) + SourceIndex(0) +7 >Emitted(1, 13) Source(2, 4) + SourceIndex(0) +8 >Emitted(1, 14) Source(2, 7) + SourceIndex(0) +9 >Emitted(1, 17) Source(2, 10) + SourceIndex(0) +10>Emitted(1, 18) Source(2, 12) + SourceIndex(0) +11>Emitted(1, 19) Source(4, 1) + SourceIndex(0) +12>Emitted(1, 22) Source(4, 4) + SourceIndex(0) +13>Emitted(1, 23) Source(5, 5) + SourceIndex(0) +14>Emitted(1, 26) Source(5, 8) + SourceIndex(0) +15>Emitted(1, 27) Source(5, 10) + SourceIndex(0) +16>Emitted(1, 28) Source(7, 1) + SourceIndex(0) +17>Emitted(1, 31) Source(7, 4) + SourceIndex(0) +18>Emitted(1, 32) Source(9, 5) + SourceIndex(0) +19>Emitted(1, 35) Source(9, 8) + SourceIndex(0) +20>Emitted(1, 36) Source(10, 6) + SourceIndex(0) +21>Emitted(1, 37) Source(12, 1) + SourceIndex(0) +22>Emitted(1, 40) Source(12, 5) + SourceIndex(0) +23>Emitted(1, 50) Source(12, 15) + SourceIndex(0) +--- +>>>[// comment +1 >^ +2 > ^^^^^^^^^^ +3 > ^^^-> +1 > + > [ +2 > // comment +1 >Emitted(2, 2) Source(13, 7) + SourceIndex(0) +2 >Emitted(2, 12) Source(13, 17) + SourceIndex(0) +--- +>>>"a"// comment +1-> +2 >^^^ +3 > ^^^^^^^^^^ +1-> + > +2 >"a" +3 > // comment +1->Emitted(3, 1) Source(14, 5) + SourceIndex(0) +2 >Emitted(3, 4) Source(14, 9) + SourceIndex(0) +3 >Emitted(3, 14) Source(14, 19) + SourceIndex(0) +--- +>>>];// comment +1 >^ +2 > ^ +3 > ^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > ] +2 > +3 > // comment +1 >Emitted(4, 2) Source(15, 6) + SourceIndex(0) +2 >Emitted(4, 3) Source(15, 7) + SourceIndex(0) +3 >Emitted(4, 13) Source(15, 17) + SourceIndex(0) +--- +>>>obj/* comment */[/* comment */"a"/* comment */];/* comment */ +1-> +2 >^^^ +3 > ^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^ +6 > ^^^ +7 > ^^^^^^^^^^^^^ +8 > ^ +9 > ^ +10> ^^^^^^^^^^^^^ +1-> + > + > +2 >obj +3 > /* comment */ +4 > + > [ +5 > /* comment */ + > +6 > "a" +7 > /* comment */ +8 > + > ] +9 > +10> /* comment */ +1->Emitted(5, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(5, 4) Source(17, 5) + SourceIndex(0) +3 >Emitted(5, 17) Source(17, 18) + SourceIndex(0) +4 >Emitted(5, 18) Source(18, 7) + SourceIndex(0) +5 >Emitted(5, 31) Source(19, 5) + SourceIndex(0) +6 >Emitted(5, 34) Source(19, 9) + SourceIndex(0) +7 >Emitted(5, 47) Source(19, 22) + SourceIndex(0) +8 >Emitted(5, 48) Source(20, 6) + SourceIndex(0) +9 >Emitted(5, 49) Source(20, 7) + SourceIndex(0) +10>Emitted(5, 62) Source(20, 20) + SourceIndex(0) +--- +>>>//# sourceMappingURL=elementAccess.js.map=================================================================== +JsFile: update.js +mapUrl: update.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/update.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/update.js +sourceFile:../tests/cases/conformance/removeWhitespace/update.ts +------------------------------------------------------------------- +>>>i+ +i;i+ +i;i+ +i;i+ +i;i+ ++i;i+ ++i;i+ ++i;i+ ++i;i+++i;i+++i;i+++i;i+++i;i+++i;i- -i;i- -i;i- -i;i- -i;i- --i;i- --i;i- --i;i- --i;i---i;i---i;i---i;i---i;i---i; +1 > +2 >^ +3 > ^^ +4 > ^ +5 > ^ +6 > ^ +7 > ^ +8 > ^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^^ +19> ^ +20> ^ +21> ^ +22> ^ +23> ^^ +24> ^^ +25> ^ +26> ^ +27> ^ +28> ^^ +29> ^^ +30> ^ +31> ^ +32> ^ +33> ^^ +34> ^^ +35> ^ +36> ^ +37> ^ +38> ^^ +39> ^^ +40> ^ +41> ^ +42> ^ +43> ^^ +44> ^ +45> ^ +46> ^ +47> ^ +48> ^^ +49> ^ +50> ^ +51> ^ +52> ^ +53> ^^ +54> ^ +55> ^ +56> ^ +57> ^ +58> ^^ +59> ^ +60> ^ +61> ^ +62> ^ +63> ^^ +64> ^ +65> ^ +66> ^ +67> ^ +68> ^^ +69> ^ +70> ^ +71> ^ +72> ^ +73> ^^ +74> ^ +75> ^ +76> ^ +77> ^ +78> ^^ +79> ^ +80> ^ +81> ^ +82> ^ +83> ^^ +84> ^ +85> ^ +86> ^ +87> ^ +88> ^^ +89> ^^ +90> ^ +91> ^ +92> ^ +93> ^^ +94> ^^ +95> ^ +96> ^ +97> ^ +98> ^^ +99> ^^ +100> ^ +101> ^ +102> ^ +103> ^^ +104> ^^ +105> ^ +106> ^ +107> ^ +108> ^^ +109> ^ +110> ^ +111> ^ +112> ^ +113> ^^ +114> ^ +115> ^ +116> ^ +117> ^ +118> ^^ +119> ^ +120> ^ +121> ^ +122> ^ +123> ^^ +124> ^ +125> ^ +126> ^ +127> ^ +128> ^^ +129> ^ +130> ^ +131> ^ +1 > +2 >i +3 > + +4 > + +5 > i +6 > + > +7 > i +8 > + +9 > + +10> i +11> + > +12> i +13> + +14> + +15> i +16> + > +17> i +18> + +19> + +20> i +21> + > + > +22> i +23> + +24> ++ +25> i +26> + > +27> i +28> + +29> ++ +30> i +31> + > +32> i +33> + +34> ++ +35> i +36> + > +37> i +38> + +39> ++ +40> i +41> + > + > +42> i +43> ++ +44> + +45> i +46> + > +47> i +48> ++ +49> + +50> i +51> + > +52> i +53> ++ +54> + +55> i +56> + > +57> i +58> ++ +59> + +60> i +61> + > +62> i +63> ++ +64> + +65> i +66> + > + > +67> i +68> - +69> - +70> i +71> + > +72> i +73> - +74> - +75> i +76> + > +77> i +78> - +79> - +80> i +81> + > +82> i +83> - +84> - +85> i +86> + > + > +87> i +88> - +89> -- +90> i +91> + > +92> i +93> - +94> -- +95> i +96> + > +97> i +98> - +99> -- +100> i +101> + > +102> i +103> - +104> -- +105> i +106> + > + > +107> i +108> -- +109> - +110> i +111> + > +112> i +113> -- +114> - +115> i +116> + > +117> i +118> -- +119> - +120> i +121> + > +122> i +123> -- +124> - +125> i +126> + > +127> i +128> -- +129> - +130> i +131> +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 2) Source(1, 2) + SourceIndex(0) +3 >Emitted(1, 4) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 5) Source(1, 7) + SourceIndex(0) +5 >Emitted(1, 6) Source(1, 8) + SourceIndex(0) +6 >Emitted(1, 7) Source(2, 1) + SourceIndex(0) +7 >Emitted(1, 8) Source(2, 2) + SourceIndex(0) +8 >Emitted(1, 10) Source(2, 5) + SourceIndex(0) +9 >Emitted(1, 11) Source(2, 6) + SourceIndex(0) +10>Emitted(1, 12) Source(2, 7) + SourceIndex(0) +11>Emitted(1, 13) Source(3, 1) + SourceIndex(0) +12>Emitted(1, 14) Source(3, 2) + SourceIndex(0) +13>Emitted(1, 16) Source(3, 4) + SourceIndex(0) +14>Emitted(1, 17) Source(3, 6) + SourceIndex(0) +15>Emitted(1, 18) Source(3, 7) + SourceIndex(0) +16>Emitted(1, 19) Source(4, 1) + SourceIndex(0) +17>Emitted(1, 20) Source(4, 2) + SourceIndex(0) +18>Emitted(1, 22) Source(4, 4) + SourceIndex(0) +19>Emitted(1, 23) Source(4, 5) + SourceIndex(0) +20>Emitted(1, 24) Source(4, 6) + SourceIndex(0) +21>Emitted(1, 25) Source(6, 1) + SourceIndex(0) +22>Emitted(1, 26) Source(6, 2) + SourceIndex(0) +23>Emitted(1, 28) Source(6, 5) + SourceIndex(0) +24>Emitted(1, 30) Source(6, 8) + SourceIndex(0) +25>Emitted(1, 31) Source(6, 9) + SourceIndex(0) +26>Emitted(1, 32) Source(7, 1) + SourceIndex(0) +27>Emitted(1, 33) Source(7, 2) + SourceIndex(0) +28>Emitted(1, 35) Source(7, 5) + SourceIndex(0) +29>Emitted(1, 37) Source(7, 7) + SourceIndex(0) +30>Emitted(1, 38) Source(7, 8) + SourceIndex(0) +31>Emitted(1, 39) Source(8, 1) + SourceIndex(0) +32>Emitted(1, 40) Source(8, 2) + SourceIndex(0) +33>Emitted(1, 42) Source(8, 4) + SourceIndex(0) +34>Emitted(1, 44) Source(8, 7) + SourceIndex(0) +35>Emitted(1, 45) Source(8, 8) + SourceIndex(0) +36>Emitted(1, 46) Source(9, 1) + SourceIndex(0) +37>Emitted(1, 47) Source(9, 2) + SourceIndex(0) +38>Emitted(1, 49) Source(9, 4) + SourceIndex(0) +39>Emitted(1, 51) Source(9, 6) + SourceIndex(0) +40>Emitted(1, 52) Source(9, 7) + SourceIndex(0) +41>Emitted(1, 53) Source(11, 1) + SourceIndex(0) +42>Emitted(1, 54) Source(11, 2) + SourceIndex(0) +43>Emitted(1, 56) Source(11, 5) + SourceIndex(0) +44>Emitted(1, 57) Source(11, 8) + SourceIndex(0) +45>Emitted(1, 58) Source(11, 9) + SourceIndex(0) +46>Emitted(1, 59) Source(12, 1) + SourceIndex(0) +47>Emitted(1, 60) Source(12, 2) + SourceIndex(0) +48>Emitted(1, 62) Source(12, 5) + SourceIndex(0) +49>Emitted(1, 63) Source(12, 7) + SourceIndex(0) +50>Emitted(1, 64) Source(12, 8) + SourceIndex(0) +51>Emitted(1, 65) Source(13, 1) + SourceIndex(0) +52>Emitted(1, 66) Source(13, 2) + SourceIndex(0) +53>Emitted(1, 68) Source(13, 4) + SourceIndex(0) +54>Emitted(1, 69) Source(13, 7) + SourceIndex(0) +55>Emitted(1, 70) Source(13, 8) + SourceIndex(0) +56>Emitted(1, 71) Source(14, 1) + SourceIndex(0) +57>Emitted(1, 72) Source(14, 2) + SourceIndex(0) +58>Emitted(1, 74) Source(14, 4) + SourceIndex(0) +59>Emitted(1, 75) Source(14, 6) + SourceIndex(0) +60>Emitted(1, 76) Source(14, 7) + SourceIndex(0) +61>Emitted(1, 77) Source(15, 1) + SourceIndex(0) +62>Emitted(1, 78) Source(15, 2) + SourceIndex(0) +63>Emitted(1, 80) Source(15, 4) + SourceIndex(0) +64>Emitted(1, 81) Source(15, 5) + SourceIndex(0) +65>Emitted(1, 82) Source(15, 6) + SourceIndex(0) +66>Emitted(1, 83) Source(17, 1) + SourceIndex(0) +67>Emitted(1, 84) Source(17, 2) + SourceIndex(0) +68>Emitted(1, 86) Source(17, 5) + SourceIndex(0) +69>Emitted(1, 87) Source(17, 7) + SourceIndex(0) +70>Emitted(1, 88) Source(17, 8) + SourceIndex(0) +71>Emitted(1, 89) Source(18, 1) + SourceIndex(0) +72>Emitted(1, 90) Source(18, 2) + SourceIndex(0) +73>Emitted(1, 92) Source(18, 5) + SourceIndex(0) +74>Emitted(1, 93) Source(18, 6) + SourceIndex(0) +75>Emitted(1, 94) Source(18, 7) + SourceIndex(0) +76>Emitted(1, 95) Source(19, 1) + SourceIndex(0) +77>Emitted(1, 96) Source(19, 2) + SourceIndex(0) +78>Emitted(1, 98) Source(19, 4) + SourceIndex(0) +79>Emitted(1, 99) Source(19, 6) + SourceIndex(0) +80>Emitted(1, 100) Source(19, 7) + SourceIndex(0) +81>Emitted(1, 101) Source(20, 1) + SourceIndex(0) +82>Emitted(1, 102) Source(20, 2) + SourceIndex(0) +83>Emitted(1, 104) Source(20, 4) + SourceIndex(0) +84>Emitted(1, 105) Source(20, 5) + SourceIndex(0) +85>Emitted(1, 106) Source(20, 6) + SourceIndex(0) +86>Emitted(1, 107) Source(22, 1) + SourceIndex(0) +87>Emitted(1, 108) Source(22, 2) + SourceIndex(0) +88>Emitted(1, 110) Source(22, 5) + SourceIndex(0) +89>Emitted(1, 112) Source(22, 8) + SourceIndex(0) +90>Emitted(1, 113) Source(22, 9) + SourceIndex(0) +91>Emitted(1, 114) Source(23, 1) + SourceIndex(0) +92>Emitted(1, 115) Source(23, 2) + SourceIndex(0) +93>Emitted(1, 117) Source(23, 5) + SourceIndex(0) +94>Emitted(1, 119) Source(23, 7) + SourceIndex(0) +95>Emitted(1, 120) Source(23, 8) + SourceIndex(0) +96>Emitted(1, 121) Source(24, 1) + SourceIndex(0) +97>Emitted(1, 122) Source(24, 2) + SourceIndex(0) +98>Emitted(1, 124) Source(24, 4) + SourceIndex(0) +99>Emitted(1, 126) Source(24, 7) + SourceIndex(0) +100>Emitted(1, 127) Source(24, 8) + SourceIndex(0) +101>Emitted(1, 128) Source(25, 1) + SourceIndex(0) +102>Emitted(1, 129) Source(25, 2) + SourceIndex(0) +103>Emitted(1, 131) Source(25, 4) + SourceIndex(0) +104>Emitted(1, 133) Source(25, 6) + SourceIndex(0) +105>Emitted(1, 134) Source(25, 7) + SourceIndex(0) +106>Emitted(1, 135) Source(27, 1) + SourceIndex(0) +107>Emitted(1, 136) Source(27, 2) + SourceIndex(0) +108>Emitted(1, 138) Source(27, 5) + SourceIndex(0) +109>Emitted(1, 139) Source(27, 8) + SourceIndex(0) +110>Emitted(1, 140) Source(27, 9) + SourceIndex(0) +111>Emitted(1, 141) Source(28, 1) + SourceIndex(0) +112>Emitted(1, 142) Source(28, 2) + SourceIndex(0) +113>Emitted(1, 144) Source(28, 5) + SourceIndex(0) +114>Emitted(1, 145) Source(28, 7) + SourceIndex(0) +115>Emitted(1, 146) Source(28, 8) + SourceIndex(0) +116>Emitted(1, 147) Source(29, 1) + SourceIndex(0) +117>Emitted(1, 148) Source(29, 2) + SourceIndex(0) +118>Emitted(1, 150) Source(29, 4) + SourceIndex(0) +119>Emitted(1, 151) Source(29, 7) + SourceIndex(0) +120>Emitted(1, 152) Source(29, 8) + SourceIndex(0) +121>Emitted(1, 153) Source(30, 1) + SourceIndex(0) +122>Emitted(1, 154) Source(30, 2) + SourceIndex(0) +123>Emitted(1, 156) Source(30, 4) + SourceIndex(0) +124>Emitted(1, 157) Source(30, 6) + SourceIndex(0) +125>Emitted(1, 158) Source(30, 7) + SourceIndex(0) +126>Emitted(1, 159) Source(31, 1) + SourceIndex(0) +127>Emitted(1, 160) Source(31, 2) + SourceIndex(0) +128>Emitted(1, 162) Source(31, 4) + SourceIndex(0) +129>Emitted(1, 163) Source(31, 5) + SourceIndex(0) +130>Emitted(1, 164) Source(31, 6) + SourceIndex(0) +131>Emitted(1, 165) Source(31, 6) + SourceIndex(0) +--- +>>>//# sourceMappingURL=update.js.map=================================================================== +JsFile: switch.js +mapUrl: switch.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/switch.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/switch.js +sourceFile:../tests/cases/conformance/removeWhitespace/switch.ts +------------------------------------------------------------------- +>>>switch(i){case 0:break;case 1:break;default:break} +1 > +2 >^^^^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +9 > ^^^^^^ +10> ^^^^^ +11> ^ +12> ^ +13> ^^^^^^ +14> ^^^^^^^ +15> ^ +16> ^^^^^ +17> ^ +1 > +2 >switch ( +3 > i +4 > ) +5 > { + > +6 > case +7 > 0 +8 > : +9 > break; + > +10> case +11> 1 +12> : +13> break; + > +14> default +15> : +16> break; +17> + > } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 9) + SourceIndex(0) +3 >Emitted(1, 9) Source(1, 10) + SourceIndex(0) +4 >Emitted(1, 10) Source(1, 12) + SourceIndex(0) +5 >Emitted(1, 11) Source(2, 5) + SourceIndex(0) +6 >Emitted(1, 16) Source(2, 10) + SourceIndex(0) +7 >Emitted(1, 17) Source(2, 11) + SourceIndex(0) +8 >Emitted(1, 18) Source(2, 13) + SourceIndex(0) +9 >Emitted(1, 24) Source(3, 5) + SourceIndex(0) +10>Emitted(1, 29) Source(3, 10) + SourceIndex(0) +11>Emitted(1, 30) Source(3, 11) + SourceIndex(0) +12>Emitted(1, 31) Source(3, 13) + SourceIndex(0) +13>Emitted(1, 37) Source(4, 5) + SourceIndex(0) +14>Emitted(1, 44) Source(4, 12) + SourceIndex(0) +15>Emitted(1, 45) Source(4, 14) + SourceIndex(0) +16>Emitted(1, 50) Source(4, 20) + SourceIndex(0) +17>Emitted(1, 51) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=switch.js.map=================================================================== +JsFile: keywords.js +mapUrl: keywords.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/keywords.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/keywords.js +sourceFile:../tests/cases/conformance/removeWhitespace/keywords.ts +------------------------------------------------------------------- +>>>delete obj.a;delete(obj).a;delete[][0];void obj.a;void(obj).a;void[][0];typeof obj.a;typeof(obj).a;typeof[][0];function f1(){return typeof obj}async function*f2(){yield 1;yield obj;yield(obj);yield[];yield*[];yield*[];yield*[];yield;i;yield yield;yield typeof obj;yield void obj;yield delete obj.a;await 1;await obj;for await(const x of[]);return yield await obj}export class C{}export default function(){} +1 > +2 >^^^^^^^ +3 > ^^^ +4 > ^ +5 > ^ +6 > ^ +7 > ^^^^^^ +8 > ^ +9 > ^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^^^^^^ +15> ^^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^^^^^ +21> ^^^ +22> ^ +23> ^ +24> ^ +25> ^^^^ +26> ^ +27> ^^^ +28> ^ +29> ^ +30> ^ +31> ^ +32> ^^^^ +33> ^^ +34> ^ +35> ^ +36> ^ +37> ^ +38> ^^^^^^^ +39> ^^^ +40> ^ +41> ^ +42> ^ +43> ^^^^^^ +44> ^ +45> ^^^ +46> ^ +47> ^ +48> ^ +49> ^ +50> ^^^^^^ +51> ^^ +52> ^ +53> ^ +54> ^ +55> ^ +56> ^^^^^^^^^^^^^^ +57> ^^^^^^^ +58> ^^^^^^^ +59> ^^^ +60> ^ +61> ^^^^^^ +62> ^^^^^^^^ +63> ^ +64> ^^^^^ +65> ^^^^^^ +66> ^ +67> ^ +68> ^^^^^^ +69> ^^^ +70> ^ +71> ^^^^^ +72> ^ +73> ^^^ +74> ^ +75> ^ +76> ^^^^^ +77> ^^ +78> ^ +79> ^^^^^ +80> ^ +81> ^^ +82> ^ +83> ^^^^^ +84> ^ +85> ^^ +86> ^ +87> ^^^^^ +88> ^ +89> ^^ +90> ^ +91> ^^^^^ +92> ^ +93> ^ +94> ^ +95> ^^^^^^ +96> ^^^^^ +97> ^ +98> ^^^^^^ +99> ^^^^^^^ +100> ^^^ +101> ^ +102> ^^^^^^ +103> ^^^^^ +104> ^^^ +105> ^ +106> ^^^^^^ +107> ^^^^^^^ +108> ^^^ +109> ^ +110> ^ +111> ^ +112> ^^^^^^ +113> ^ +114> ^ +115> ^^^^^^ +116> ^^^ +117> ^ +118> ^^^^ +119> ^^^^^ +120> ^ +121> ^^^^^^ +122> ^ +123> ^^^ +124> ^^ +125> ^ +126> ^ +127> ^^^^^^^ +128> ^^^^^^ +129> ^^^^^^ +130> ^^^ +131> ^ +132> ^^^^^^^ +133> ^^^^^^^^^ +134> ^^^^^^^ +135> ^^^^^^^ +136> ^^^^^^^^^^^^ +137> ^ +1 > +2 >delete +3 > obj +4 > . +5 > a +6 > + > +7 > delete +8 > ( +9 > obj +10> ) +11> . +12> a +13> + > +14> delete +15> [] +16> [ +17> 0 +18> ] +19> + > +20> void +21> obj +22> . +23> a +24> + > +25> void +26> ( +27> obj +28> ) +29> . +30> a +31> + > +32> void +33> [] +34> [ +35> 0 +36> ] +37> + > +38> typeof +39> obj +40> . +41> a +42> + > +43> typeof +44> ( +45> obj +46> ) +47> . +48> a +49> + > +50> typeof +51> [] +52> [ +53> 0 +54> ] +55> + > +56> function f1() { + > +57> return +58> typeof +59> obj + > +60> } + > +61> async +62> function +63> * +64> f2() { + > +65> yield +66> 1 +67> + > +68> yield +69> obj +70> + > +71> yield +72> ( +73> obj +74> ) +75> + > +76> yield +77> [] +78> + > +79> yield +80> * +81> [] +82> + > +83> yield +84> * +85> [] +86> + > +87> yield +88> * +89> [] +90> + > +91> yield +92> + > +93> i +94> + > +95> yield +96> yield +97> + > +98> yield +99> typeof +100> obj +101> + > +102> yield +103> void +104> obj +105> + > +106> yield +107> delete +108> obj +109> . +110> a +111> + > +112> await +113> 1 +114> + > +115> await +116> obj +117> + > +118> for +119> await +120> ( +121> const +122> x +123> of +124> [] +125> ) +126> ; + > +127> return +128> yield +129> await +130> obj + > +131> } + > +132> export +133> class C {} + > +134> export +135> default +136> function() { +137> } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +3 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +4 >Emitted(1, 12) Source(1, 12) + SourceIndex(0) +5 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +6 >Emitted(1, 14) Source(2, 1) + SourceIndex(0) +7 >Emitted(1, 20) Source(2, 8) + SourceIndex(0) +8 >Emitted(1, 21) Source(2, 9) + SourceIndex(0) +9 >Emitted(1, 24) Source(2, 12) + SourceIndex(0) +10>Emitted(1, 25) Source(2, 13) + SourceIndex(0) +11>Emitted(1, 26) Source(2, 14) + SourceIndex(0) +12>Emitted(1, 27) Source(2, 15) + SourceIndex(0) +13>Emitted(1, 28) Source(3, 1) + SourceIndex(0) +14>Emitted(1, 34) Source(3, 8) + SourceIndex(0) +15>Emitted(1, 36) Source(3, 10) + SourceIndex(0) +16>Emitted(1, 37) Source(3, 11) + SourceIndex(0) +17>Emitted(1, 38) Source(3, 12) + SourceIndex(0) +18>Emitted(1, 39) Source(3, 13) + SourceIndex(0) +19>Emitted(1, 40) Source(4, 1) + SourceIndex(0) +20>Emitted(1, 45) Source(4, 6) + SourceIndex(0) +21>Emitted(1, 48) Source(4, 9) + SourceIndex(0) +22>Emitted(1, 49) Source(4, 10) + SourceIndex(0) +23>Emitted(1, 50) Source(4, 11) + SourceIndex(0) +24>Emitted(1, 51) Source(5, 1) + SourceIndex(0) +25>Emitted(1, 55) Source(5, 6) + SourceIndex(0) +26>Emitted(1, 56) Source(5, 7) + SourceIndex(0) +27>Emitted(1, 59) Source(5, 10) + SourceIndex(0) +28>Emitted(1, 60) Source(5, 11) + SourceIndex(0) +29>Emitted(1, 61) Source(5, 12) + SourceIndex(0) +30>Emitted(1, 62) Source(5, 13) + SourceIndex(0) +31>Emitted(1, 63) Source(6, 1) + SourceIndex(0) +32>Emitted(1, 67) Source(6, 6) + SourceIndex(0) +33>Emitted(1, 69) Source(6, 8) + SourceIndex(0) +34>Emitted(1, 70) Source(6, 9) + SourceIndex(0) +35>Emitted(1, 71) Source(6, 10) + SourceIndex(0) +36>Emitted(1, 72) Source(6, 11) + SourceIndex(0) +37>Emitted(1, 73) Source(7, 1) + SourceIndex(0) +38>Emitted(1, 80) Source(7, 8) + SourceIndex(0) +39>Emitted(1, 83) Source(7, 11) + SourceIndex(0) +40>Emitted(1, 84) Source(7, 12) + SourceIndex(0) +41>Emitted(1, 85) Source(7, 13) + SourceIndex(0) +42>Emitted(1, 86) Source(8, 1) + SourceIndex(0) +43>Emitted(1, 92) Source(8, 8) + SourceIndex(0) +44>Emitted(1, 93) Source(8, 9) + SourceIndex(0) +45>Emitted(1, 96) Source(8, 12) + SourceIndex(0) +46>Emitted(1, 97) Source(8, 13) + SourceIndex(0) +47>Emitted(1, 98) Source(8, 14) + SourceIndex(0) +48>Emitted(1, 99) Source(8, 15) + SourceIndex(0) +49>Emitted(1, 100) Source(9, 1) + SourceIndex(0) +50>Emitted(1, 106) Source(9, 8) + SourceIndex(0) +51>Emitted(1, 108) Source(9, 10) + SourceIndex(0) +52>Emitted(1, 109) Source(9, 11) + SourceIndex(0) +53>Emitted(1, 110) Source(9, 12) + SourceIndex(0) +54>Emitted(1, 111) Source(9, 13) + SourceIndex(0) +55>Emitted(1, 112) Source(10, 1) + SourceIndex(0) +56>Emitted(1, 126) Source(11, 5) + SourceIndex(0) +57>Emitted(1, 133) Source(11, 12) + SourceIndex(0) +58>Emitted(1, 140) Source(11, 19) + SourceIndex(0) +59>Emitted(1, 143) Source(12, 1) + SourceIndex(0) +60>Emitted(1, 144) Source(13, 1) + SourceIndex(0) +61>Emitted(1, 150) Source(13, 6) + SourceIndex(0) +62>Emitted(1, 158) Source(13, 15) + SourceIndex(0) +63>Emitted(1, 159) Source(13, 16) + SourceIndex(0) +64>Emitted(1, 164) Source(14, 5) + SourceIndex(0) +65>Emitted(1, 170) Source(14, 11) + SourceIndex(0) +66>Emitted(1, 171) Source(14, 12) + SourceIndex(0) +67>Emitted(1, 172) Source(15, 5) + SourceIndex(0) +68>Emitted(1, 178) Source(15, 11) + SourceIndex(0) +69>Emitted(1, 181) Source(15, 14) + SourceIndex(0) +70>Emitted(1, 182) Source(16, 5) + SourceIndex(0) +71>Emitted(1, 187) Source(16, 11) + SourceIndex(0) +72>Emitted(1, 188) Source(16, 12) + SourceIndex(0) +73>Emitted(1, 191) Source(16, 15) + SourceIndex(0) +74>Emitted(1, 192) Source(16, 16) + SourceIndex(0) +75>Emitted(1, 193) Source(17, 5) + SourceIndex(0) +76>Emitted(1, 198) Source(17, 11) + SourceIndex(0) +77>Emitted(1, 200) Source(17, 13) + SourceIndex(0) +78>Emitted(1, 201) Source(18, 5) + SourceIndex(0) +79>Emitted(1, 206) Source(18, 10) + SourceIndex(0) +80>Emitted(1, 207) Source(18, 12) + SourceIndex(0) +81>Emitted(1, 209) Source(18, 14) + SourceIndex(0) +82>Emitted(1, 210) Source(19, 5) + SourceIndex(0) +83>Emitted(1, 215) Source(19, 11) + SourceIndex(0) +84>Emitted(1, 216) Source(19, 12) + SourceIndex(0) +85>Emitted(1, 218) Source(19, 14) + SourceIndex(0) +86>Emitted(1, 219) Source(20, 5) + SourceIndex(0) +87>Emitted(1, 224) Source(20, 11) + SourceIndex(0) +88>Emitted(1, 225) Source(20, 13) + SourceIndex(0) +89>Emitted(1, 227) Source(20, 15) + SourceIndex(0) +90>Emitted(1, 228) Source(21, 5) + SourceIndex(0) +91>Emitted(1, 233) Source(21, 10) + SourceIndex(0) +92>Emitted(1, 234) Source(22, 5) + SourceIndex(0) +93>Emitted(1, 235) Source(22, 6) + SourceIndex(0) +94>Emitted(1, 236) Source(23, 5) + SourceIndex(0) +95>Emitted(1, 242) Source(23, 11) + SourceIndex(0) +96>Emitted(1, 247) Source(23, 16) + SourceIndex(0) +97>Emitted(1, 248) Source(24, 5) + SourceIndex(0) +98>Emitted(1, 254) Source(24, 11) + SourceIndex(0) +99>Emitted(1, 261) Source(24, 18) + SourceIndex(0) +100>Emitted(1, 264) Source(24, 21) + SourceIndex(0) +101>Emitted(1, 265) Source(25, 5) + SourceIndex(0) +102>Emitted(1, 271) Source(25, 11) + SourceIndex(0) +103>Emitted(1, 276) Source(25, 16) + SourceIndex(0) +104>Emitted(1, 279) Source(25, 19) + SourceIndex(0) +105>Emitted(1, 280) Source(26, 5) + SourceIndex(0) +106>Emitted(1, 286) Source(26, 11) + SourceIndex(0) +107>Emitted(1, 293) Source(26, 18) + SourceIndex(0) +108>Emitted(1, 296) Source(26, 21) + SourceIndex(0) +109>Emitted(1, 297) Source(26, 22) + SourceIndex(0) +110>Emitted(1, 298) Source(26, 23) + SourceIndex(0) +111>Emitted(1, 299) Source(27, 5) + SourceIndex(0) +112>Emitted(1, 305) Source(27, 11) + SourceIndex(0) +113>Emitted(1, 306) Source(27, 12) + SourceIndex(0) +114>Emitted(1, 307) Source(28, 5) + SourceIndex(0) +115>Emitted(1, 313) Source(28, 11) + SourceIndex(0) +116>Emitted(1, 316) Source(28, 14) + SourceIndex(0) +117>Emitted(1, 317) Source(29, 5) + SourceIndex(0) +118>Emitted(1, 321) Source(29, 9) + SourceIndex(0) +119>Emitted(1, 326) Source(29, 14) + SourceIndex(0) +120>Emitted(1, 327) Source(29, 16) + SourceIndex(0) +121>Emitted(1, 333) Source(29, 22) + SourceIndex(0) +122>Emitted(1, 334) Source(29, 23) + SourceIndex(0) +123>Emitted(1, 337) Source(29, 27) + SourceIndex(0) +124>Emitted(1, 339) Source(29, 29) + SourceIndex(0) +125>Emitted(1, 340) Source(29, 30) + SourceIndex(0) +126>Emitted(1, 341) Source(30, 5) + SourceIndex(0) +127>Emitted(1, 348) Source(30, 12) + SourceIndex(0) +128>Emitted(1, 354) Source(30, 18) + SourceIndex(0) +129>Emitted(1, 360) Source(30, 24) + SourceIndex(0) +130>Emitted(1, 363) Source(31, 1) + SourceIndex(0) +131>Emitted(1, 364) Source(32, 1) + SourceIndex(0) +132>Emitted(1, 371) Source(32, 7) + SourceIndex(0) +133>Emitted(1, 380) Source(33, 1) + SourceIndex(0) +134>Emitted(1, 387) Source(33, 8) + SourceIndex(0) +135>Emitted(1, 394) Source(33, 15) + SourceIndex(0) +136>Emitted(1, 406) Source(33, 28) + SourceIndex(0) +137>Emitted(1, 407) Source(33, 29) + SourceIndex(0) +--- +>>>//# sourceMappingURL=keywords.js.map=================================================================== +JsFile: statements.js +mapUrl: statements.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/statements.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/statements.js +sourceFile:../tests/cases/conformance/removeWhitespace/statements.ts +------------------------------------------------------------------- +>>>obj;fn();function fn3(){obj;fn();function f(){}return;function g(){}} +1 > +2 >^^^ +3 > ^ +4 > ^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^^ +12> ^ +13> ^^^^^^^^^^^^^ +14> ^ +15> ^^^^^^^ +16> ^^^^^^^^^^^^^ +17> ^ +18> ^ +1 > +2 >obj +3 > ; + > +4 > fn +5 > (); + > +6 > ; + > +7 > function fn3() { + > +8 > obj +9 > ; + > +10> fn +11> (); + > +12> ; + > +13> function f() { +14> } + > +15> return; + > +16> function g() { +17> } + > +18> } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(2, 1) + SourceIndex(0) +4 >Emitted(1, 7) Source(2, 3) + SourceIndex(0) +5 >Emitted(1, 9) Source(3, 1) + SourceIndex(0) +6 >Emitted(1, 10) Source(4, 1) + SourceIndex(0) +7 >Emitted(1, 25) Source(5, 5) + SourceIndex(0) +8 >Emitted(1, 28) Source(5, 8) + SourceIndex(0) +9 >Emitted(1, 29) Source(6, 5) + SourceIndex(0) +10>Emitted(1, 31) Source(6, 7) + SourceIndex(0) +11>Emitted(1, 33) Source(7, 5) + SourceIndex(0) +12>Emitted(1, 34) Source(8, 5) + SourceIndex(0) +13>Emitted(1, 47) Source(8, 19) + SourceIndex(0) +14>Emitted(1, 48) Source(9, 5) + SourceIndex(0) +15>Emitted(1, 55) Source(10, 5) + SourceIndex(0) +16>Emitted(1, 68) Source(10, 19) + SourceIndex(0) +17>Emitted(1, 69) Source(11, 1) + SourceIndex(0) +18>Emitted(1, 70) Source(11, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=statements.js.map=================================================================== +JsFile: variables.js +mapUrl: variables.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/variables.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/variables.js +sourceFile:../tests/cases/conformance/removeWhitespace/variables.ts +------------------------------------------------------------------- +>>>var a=0,b,{c}=obj,[d]=obj;let e=0,f,{g}=obj,[h]=obj; +1 > +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^^^ +20> ^ +21> ^^^^ +22> ^ +23> ^ +24> ^ +25> ^ +26> ^ +27> ^ +28> ^ +29> ^ +30> ^ +31> ^ +32> ^^^ +33> ^ +34> ^ +35> ^ +36> ^ +37> ^ +38> ^^^ +39> ^ +1 > +2 >var +3 > a +4 > = +5 > 0 +6 > , +7 > b +8 > , +9 > { +10> c +11> } +12> = +13> obj +14> , +15> [ +16> d +17> ] +18> = +19> obj +20> ; + > +21> let +22> e +23> = +24> 0 +25> , +26> f +27> , +28> { +29> g +30> } +31> = +32> obj +33> , +34> [ +35> h +36> ] +37> = +38> obj +39> ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 7) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 8) Source(1, 10) + SourceIndex(0) +6 >Emitted(1, 9) Source(1, 12) + SourceIndex(0) +7 >Emitted(1, 10) Source(1, 13) + SourceIndex(0) +8 >Emitted(1, 11) Source(1, 15) + SourceIndex(0) +9 >Emitted(1, 12) Source(1, 17) + SourceIndex(0) +10>Emitted(1, 13) Source(1, 18) + SourceIndex(0) +11>Emitted(1, 14) Source(1, 20) + SourceIndex(0) +12>Emitted(1, 15) Source(1, 23) + SourceIndex(0) +13>Emitted(1, 18) Source(1, 26) + SourceIndex(0) +14>Emitted(1, 19) Source(1, 28) + SourceIndex(0) +15>Emitted(1, 20) Source(1, 29) + SourceIndex(0) +16>Emitted(1, 21) Source(1, 30) + SourceIndex(0) +17>Emitted(1, 22) Source(1, 31) + SourceIndex(0) +18>Emitted(1, 23) Source(1, 34) + SourceIndex(0) +19>Emitted(1, 26) Source(1, 37) + SourceIndex(0) +20>Emitted(1, 27) Source(2, 1) + SourceIndex(0) +21>Emitted(1, 31) Source(2, 5) + SourceIndex(0) +22>Emitted(1, 32) Source(2, 6) + SourceIndex(0) +23>Emitted(1, 33) Source(2, 9) + SourceIndex(0) +24>Emitted(1, 34) Source(2, 10) + SourceIndex(0) +25>Emitted(1, 35) Source(2, 12) + SourceIndex(0) +26>Emitted(1, 36) Source(2, 13) + SourceIndex(0) +27>Emitted(1, 37) Source(2, 15) + SourceIndex(0) +28>Emitted(1, 38) Source(2, 17) + SourceIndex(0) +29>Emitted(1, 39) Source(2, 18) + SourceIndex(0) +30>Emitted(1, 40) Source(2, 20) + SourceIndex(0) +31>Emitted(1, 41) Source(2, 23) + SourceIndex(0) +32>Emitted(1, 44) Source(2, 26) + SourceIndex(0) +33>Emitted(1, 45) Source(2, 28) + SourceIndex(0) +34>Emitted(1, 46) Source(2, 29) + SourceIndex(0) +35>Emitted(1, 47) Source(2, 30) + SourceIndex(0) +36>Emitted(1, 48) Source(2, 31) + SourceIndex(0) +37>Emitted(1, 49) Source(2, 34) + SourceIndex(0) +38>Emitted(1, 52) Source(2, 37) + SourceIndex(0) +39>Emitted(1, 53) Source(2, 38) + SourceIndex(0) +--- +>>>//# sourceMappingURL=variables.js.map=================================================================== +JsFile: for.js +mapUrl: for.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/for.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/for.js +sourceFile:../tests/cases/conformance/removeWhitespace/for.ts +------------------------------------------------------------------- +>>>for(;;){} +1 > +2 >^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >for(;;) +3 > {} +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +3 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +--- +>>>//# sourceMappingURL=for.js.map=================================================================== +JsFile: embeddedStatement.js +mapUrl: embeddedStatement.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/embeddedStatement.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/embeddedStatement.js +sourceFile:../tests/cases/conformance/removeWhitespace/embeddedStatement.ts +------------------------------------------------------------------- +>>>{while(true);} +1 > +2 >^ +3 > ^^^^^^ +4 > ^^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >{ +3 > while( +4 > true +5 > ) +6 > ; +7 > } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 2) Source(1, 2) + SourceIndex(0) +3 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +4 >Emitted(1, 12) Source(1, 12) + SourceIndex(0) +5 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +6 >Emitted(1, 14) Source(1, 14) + SourceIndex(0) +7 >Emitted(1, 15) Source(1, 15) + SourceIndex(0) +--- +>>>//# sourceMappingURL=embeddedStatement.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outDir.symbols b/tests/baselines/reference/removeWhitespace.outDir.symbols new file mode 100644 index 0000000000000..5743a1a0ab80a --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outDir.symbols @@ -0,0 +1,398 @@ +=== tests/cases/conformance/removeWhitespace/global.d.ts === +declare let obj: any, i: any, fn; +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>fn : Symbol(fn, Decl(global.d.ts, 0, 29)) + +=== tests/cases/conformance/removeWhitespace/propertyAccess.ts === +obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj .a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj. a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj . a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj. +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + a + +obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + .a + +obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + . + a + +obj // comment +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + . // comment + a // comment + +obj /* comment */ +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + . /* comment */ + a /* comment */ + +1..valueOf +>1..valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1.. valueOf +>1.. valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. .valueOf +>1. .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. . valueOf +>1. . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 .valueOf +>1 .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 . valueOf +>1 . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1.. +>1.. valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. +>1. .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + .valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. +>1. . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . + valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. // comment +>1. // comment . // comment valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . // comment + valueOf // comment +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. /* comment */ +>1. /* comment */ . /* comment */ valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . /* comment */ + valueOf /* comment */ +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 +>1 .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + .valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 +>1 . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . + valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 // comment +>1 // comment . // comment valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . // comment + valueOf // comment +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 /* comment */ +>1 /* comment */ . /* comment */ valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . /* comment */ + valueOf /* comment */ +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +=== tests/cases/conformance/removeWhitespace/elementAccess.ts === +obj["a"] +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj [ "a" ] +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj [ +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + "a" ] + +obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + [ + "a" + ] + +obj // comment +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + [ // comment + "a" // comment + ] // comment + +obj /* comment */ +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + [ /* comment */ + "a" /* comment */ + ] /* comment */ + +=== tests/cases/conformance/removeWhitespace/update.ts === +i + + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i + +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i + ++ i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i + ++i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ ++ i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ ++i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i ++ + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i ++ +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i++ + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i++ +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+++i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - -- i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - --i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- -- i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- --i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i -- - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i -- -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i-- - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i-- -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i---i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +=== tests/cases/conformance/removeWhitespace/switch.ts === +switch (i) { +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + + case 0: break; + case 1: break; + default: break; +} + +=== tests/cases/conformance/removeWhitespace/keywords.ts === +delete obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +delete (obj).a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +delete [][0] +void obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +void (obj).a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +void [][0] +typeof obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +typeof (obj).a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +typeof [][0] +function f1() { +>f1 : Symbol(f1, Decl(keywords.ts, 8, 12)) + + return typeof obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +} +async function* f2() { +>f2 : Symbol(f2, Decl(keywords.ts, 11, 1)) + + yield 1 + yield obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield (obj) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield [] + yield* [] + yield *[] + yield * [] + yield + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + + yield yield + yield typeof obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield void obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield delete obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + await 1 + await obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + for await (const x of []); +>x : Symbol(x, Decl(keywords.ts, 28, 20)) + + return yield await obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +} +export class C {} +>C : Symbol(C, Decl(keywords.ts, 30, 1)) + +export default function() {} + +=== tests/cases/conformance/removeWhitespace/statements.ts === +obj; +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +fn(); +>fn : Symbol(fn, Decl(global.d.ts, 0, 29)) + +; +function fn3() { +>fn3 : Symbol(fn3, Decl(statements.ts, 2, 1)) + + obj; +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + fn(); +>fn : Symbol(fn, Decl(global.d.ts, 0, 29)) + + ; + function f() {} +>f : Symbol(f, Decl(statements.ts, 6, 5)) + + return; + function g() {} +>g : Symbol(g, Decl(statements.ts, 8, 11)) +} + +=== tests/cases/conformance/removeWhitespace/variables.ts === +var a = 0, b, { c } = obj, [d] = obj; +>a : Symbol(a, Decl(variables.ts, 0, 3)) +>b : Symbol(b, Decl(variables.ts, 0, 10)) +>c : Symbol(c, Decl(variables.ts, 0, 15)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +>d : Symbol(d, Decl(variables.ts, 0, 28)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +let e = 0, f, { g } = obj, [h] = obj; +>e : Symbol(e, Decl(variables.ts, 1, 3)) +>f : Symbol(f, Decl(variables.ts, 1, 10)) +>g : Symbol(g, Decl(variables.ts, 1, 15)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +>h : Symbol(h, Decl(variables.ts, 1, 28)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +=== tests/cases/conformance/removeWhitespace/for.ts === +for(;;){} +No type information for this code. +No type information for this code.=== tests/cases/conformance/removeWhitespace/embeddedStatement.ts === +{while(true);} +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outDir.types b/tests/baselines/reference/removeWhitespace.outDir.types new file mode 100644 index 0000000000000..a26e8735f7692 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outDir.types @@ -0,0 +1,582 @@ +=== tests/cases/conformance/removeWhitespace/global.d.ts === +declare let obj: any, i: any, fn; +>obj : any +>i : any +>fn : any + +=== tests/cases/conformance/removeWhitespace/propertyAccess.ts === +obj.a +>obj.a : any +>obj : any +>a : any + +obj .a +>obj .a : any +>obj : any +>a : any + +obj. a +>obj. a : any +>obj : any +>a : any + +obj . a +>obj . a : any +>obj : any +>a : any + +obj. +>obj. a : any +>obj : any + + a +>a : any + +obj +>obj .a : any +>obj : any + + .a +>a : any + +obj +>obj . a : any +>obj : any + + . + a +>a : any + +obj // comment +>obj // comment . // comment a : any +>obj : any + + . // comment + a // comment +>a : any + +obj /* comment */ +>obj /* comment */ . /* comment */ a : any +>obj : any + + . /* comment */ + a /* comment */ +>a : any + +1..valueOf +>1..valueOf : () => number +>1. : 1 +>valueOf : () => number + +1.. valueOf +>1.. valueOf : () => number +>1. : 1 +>valueOf : () => number + +1. .valueOf +>1. .valueOf : () => number +>1. : 1 +>valueOf : () => number + +1. . valueOf +>1. . valueOf : () => number +>1. : 1 +>valueOf : () => number + +1 .valueOf +>1 .valueOf : () => number +>1 : 1 +>valueOf : () => number + +1 . valueOf +>1 . valueOf : () => number +>1 : 1 +>valueOf : () => number + +1.. +>1.. valueOf : () => number +>1. : 1 + + valueOf +>valueOf : () => number + +1. +>1. .valueOf : () => number +>1. : 1 + + .valueOf +>valueOf : () => number + +1. +>1. . valueOf : () => number +>1. : 1 + + . + valueOf +>valueOf : () => number + +1. // comment +>1. // comment . // comment valueOf : () => number +>1. : 1 + + . // comment + valueOf // comment +>valueOf : () => number + +1. /* comment */ +>1. /* comment */ . /* comment */ valueOf : () => number +>1. : 1 + + . /* comment */ + valueOf /* comment */ +>valueOf : () => number + +1 +>1 .valueOf : () => number +>1 : 1 + + .valueOf +>valueOf : () => number + +1 +>1 . valueOf : () => number +>1 : 1 + + . + valueOf +>valueOf : () => number + +1 // comment +>1 // comment . // comment valueOf : () => number +>1 : 1 + + . // comment + valueOf // comment +>valueOf : () => number + +1 /* comment */ +>1 /* comment */ . /* comment */ valueOf : () => number +>1 : 1 + + . /* comment */ + valueOf /* comment */ +>valueOf : () => number + +=== tests/cases/conformance/removeWhitespace/elementAccess.ts === +obj["a"] +>obj["a"] : any +>obj : any +>"a" : "a" + +obj [ "a" ] +>obj [ "a" ] : any +>obj : any +>"a" : "a" + +obj [ +>obj [ "a" ] : any +>obj : any + + "a" ] +>"a" : "a" + +obj +>obj [ "a" ] : any +>obj : any + + [ + "a" +>"a" : "a" + + ] + +obj // comment +>obj // comment [ // comment "a" // comment ] : any +>obj : any + + [ // comment + "a" // comment +>"a" : "a" + + ] // comment + +obj /* comment */ +>obj /* comment */ [ /* comment */ "a" /* comment */ ] : any +>obj : any + + [ /* comment */ + "a" /* comment */ +>"a" : "a" + + ] /* comment */ + +=== tests/cases/conformance/removeWhitespace/update.ts === +i + + i +>i + + i : any +>i : any +>+ i : number +>i : any + +i + +i +>i + +i : any +>i : any +>+i : number +>i : any + +i+ + i +>i+ + i : any +>i : any +>+ i : number +>i : any + +i+ +i +>i+ +i : any +>i : any +>+i : number +>i : any + +i + ++ i +>i + ++ i : any +>i : any +>++ i : number +>i : any + +i + ++i +>i + ++i : any +>i : any +>++i : number +>i : any + +i+ ++ i +>i+ ++ i : any +>i : any +>++ i : number +>i : any + +i+ ++i +>i+ ++i : any +>i : any +>++i : number +>i : any + +i ++ + i +>i ++ + i : any +>i ++ : number +>i : any +>i : any + +i ++ +i +>i ++ +i : any +>i ++ : number +>i : any +>i : any + +i++ + i +>i++ + i : any +>i++ : number +>i : any +>i : any + +i++ +i +>i++ +i : any +>i++ : number +>i : any +>i : any + +i+++i +>i+++i : any +>i++ : number +>i : any +>i : any + +i - - i +>i - - i : number +>i : any +>- i : number +>i : any + +i - -i +>i - -i : number +>i : any +>-i : number +>i : any + +i- - i +>i- - i : number +>i : any +>- i : number +>i : any + +i- -i +>i- -i : number +>i : any +>-i : number +>i : any + +i - -- i +>i - -- i : number +>i : any +>-- i : number +>i : any + +i - --i +>i - --i : number +>i : any +>--i : number +>i : any + +i- -- i +>i- -- i : number +>i : any +>-- i : number +>i : any + +i- --i +>i- --i : number +>i : any +>--i : number +>i : any + +i -- - i +>i -- - i : number +>i -- : number +>i : any +>i : any + +i -- -i +>i -- -i : number +>i -- : number +>i : any +>i : any + +i-- - i +>i-- - i : number +>i-- : number +>i : any +>i : any + +i-- -i +>i-- -i : number +>i-- : number +>i : any +>i : any + +i---i +>i---i : number +>i-- : number +>i : any +>i : any + +=== tests/cases/conformance/removeWhitespace/switch.ts === +switch (i) { +>i : any + + case 0: break; +>0 : 0 + + case 1: break; +>1 : 1 + + default: break; +} + +=== tests/cases/conformance/removeWhitespace/keywords.ts === +delete obj.a +>delete obj.a : boolean +>obj.a : any +>obj : any +>a : any + +delete (obj).a +>delete (obj).a : boolean +>(obj).a : any +>(obj) : any +>obj : any +>a : any + +delete [][0] +>delete [][0] : boolean +>[][0] : undefined +>[] : undefined[] +>0 : 0 + +void obj.a +>void obj.a : undefined +>obj.a : any +>obj : any +>a : any + +void (obj).a +>void (obj).a : undefined +>(obj).a : any +>(obj) : any +>obj : any +>a : any + +void [][0] +>void [][0] : undefined +>[][0] : undefined +>[] : undefined[] +>0 : 0 + +typeof obj.a +>typeof obj.a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>obj.a : any +>obj : any +>a : any + +typeof (obj).a +>typeof (obj).a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>(obj).a : any +>(obj) : any +>obj : any +>a : any + +typeof [][0] +>typeof [][0] : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>[][0] : undefined +>[] : undefined[] +>0 : 0 + +function f1() { +>f1 : () => "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" + + return typeof obj +>typeof obj : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>obj : any +} +async function* f2() { +>f2 : () => AsyncIterableIterator + + yield 1 +>yield 1 : any +>1 : 1 + + yield obj +>yield obj : any +>obj : any + + yield (obj) +>yield (obj) : any +>(obj) : any +>obj : any + + yield [] +>yield [] : any +>[] : undefined[] + + yield* [] +>yield* [] : any +>[] : undefined[] + + yield *[] +>yield *[] : any +>[] : undefined[] + + yield * [] +>yield * [] : any +>[] : undefined[] + + yield +>yield : any + + i +>i : any + + yield yield +>yield yield : any +>yield : any + + yield typeof obj +>yield typeof obj : any +>typeof obj : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>obj : any + + yield void obj +>yield void obj : any +>void obj : undefined +>obj : any + + yield delete obj.a +>yield delete obj.a : any +>delete obj.a : boolean +>obj.a : any +>obj : any +>a : any + + await 1 +>await 1 : 1 +>1 : 1 + + await obj +>await obj : any +>obj : any + + for await (const x of []); +>x : any +>[] : undefined[] + + return yield await obj +>yield await obj : any +>await obj : any +>obj : any +} +export class C {} +>C : C + +export default function() {} + +=== tests/cases/conformance/removeWhitespace/statements.ts === +obj; +>obj : any + +fn(); +>fn() : any +>fn : any + +; +function fn3() { +>fn3 : () => void + + obj; +>obj : any + + fn(); +>fn() : any +>fn : any + + ; + function f() {} +>f : () => void + + return; + function g() {} +>g : () => void +} + +=== tests/cases/conformance/removeWhitespace/variables.ts === +var a = 0, b, { c } = obj, [d] = obj; +>a : number +>0 : 0 +>b : any +>c : any +>obj : any +>d : any +>obj : any + +let e = 0, f, { g } = obj, [h] = obj; +>e : number +>0 : 0 +>f : any +>g : any +>obj : any +>h : any +>obj : any + +=== tests/cases/conformance/removeWhitespace/for.ts === +for(;;){} +No type information for this code. +No type information for this code.=== tests/cases/conformance/removeWhitespace/embeddedStatement.ts === +{while(true);} +>true : true + diff --git a/tests/baselines/reference/removeWhitespace.outFile.errors.txt b/tests/baselines/reference/removeWhitespace.outFile.errors.txt new file mode 100644 index 0000000000000..89fe837f2ce69 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outFile.errors.txt @@ -0,0 +1,16 @@ +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. +==== tests/cases/conformance/removeWhitespace/a.ts (0 errors) ==== + let a = 1; + +==== tests/cases/conformance/removeWhitespace/b.ts (0 errors) ==== + let b = 2; + +==== tests/cases/conformance/removeWhitespace/c.ts (0 errors) ==== + class C {} + +==== tests/cases/conformance/removeWhitespace/d.ts (0 errors) ==== + function d() {} + \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outFile.js b/tests/baselines/reference/removeWhitespace.outFile.js new file mode 100644 index 0000000000000..1b55ecdfb39f0 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outFile.js @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/removeWhitespace/removeWhitespace.outFile.ts] //// + +//// [a.ts] +let a = 1; + +//// [b.ts] +let b = 2; + +//// [c.ts] +class C {} + +//// [d.ts] +function d() {} + + +//// [combined.js] +let a=1;let b=2;class C{}function d(){} +//# sourceMappingURL=combined.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outFile.js.map b/tests/baselines/reference/removeWhitespace.outFile.js.map new file mode 100644 index 0000000000000..830db7633f2a8 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outFile.js.map @@ -0,0 +1,2 @@ +//// [combined.js.map] +{"version":3,"file":"combined.js","sourceRoot":"","sources":["tests/cases/conformance/removeWhitespace/a.ts","tests/cases/conformance/removeWhitespace/b.ts","tests/cases/conformance/removeWhitespace/c.ts","tests/cases/conformance/removeWhitespace/d.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,CAAG,CAAC,CCAT,IAAI,CAAC,CAAG,CAAC,CCAT,SCAA,aAAc,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outFile.sourcemap.txt b/tests/baselines/reference/removeWhitespace.outFile.sourcemap.txt new file mode 100644 index 0000000000000..4b0d8ce74449b --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outFile.sourcemap.txt @@ -0,0 +1,76 @@ +=================================================================== +JsFile: combined.js +mapUrl: combined.js.map +sourceRoot: +sources: tests/cases/conformance/removeWhitespace/a.ts,tests/cases/conformance/removeWhitespace/b.ts,tests/cases/conformance/removeWhitespace/c.ts,tests/cases/conformance/removeWhitespace/d.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:combined.js +sourceFile:tests/cases/conformance/removeWhitespace/a.ts +------------------------------------------------------------------- +>>>let a=1;let b=2;class C{}function d(){} +1 > +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >let +3 > a +4 > = +5 > 1 +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 7) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 8) Source(1, 10) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:combined.js (1, 9) +sourceFile:tests/cases/conformance/removeWhitespace/b.ts +------------------------------------------------------------------- +>>>let a=1;let b=2;class C{}function d(){} +1->^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^-> +1-> +2 > let +3 > b +4 > = +5 > 2 +1->Emitted(1, 9) Source(1, 1) + SourceIndex(1) +2 >Emitted(1, 13) Source(1, 5) + SourceIndex(1) +3 >Emitted(1, 14) Source(1, 6) + SourceIndex(1) +4 >Emitted(1, 15) Source(1, 9) + SourceIndex(1) +5 >Emitted(1, 16) Source(1, 10) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:combined.js (1, 17) +sourceFile:tests/cases/conformance/removeWhitespace/c.ts +------------------------------------------------------------------- +>>>let a=1;let b=2;class C{}function d(){} +1->^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(1, 17) Source(1, 1) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:combined.js (1, 26) +sourceFile:tests/cases/conformance/removeWhitespace/d.ts +------------------------------------------------------------------- +>>>let a=1;let b=2;class C{}function d(){} +1->^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^ +1-> +2 > function d() { +3 > } +1->Emitted(1, 26) Source(1, 1) + SourceIndex(3) +2 >Emitted(1, 39) Source(1, 15) + SourceIndex(3) +3 >Emitted(1, 40) Source(1, 16) + SourceIndex(3) +--- +>>>//# sourceMappingURL=combined.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outFile.symbols b/tests/baselines/reference/removeWhitespace.outFile.symbols new file mode 100644 index 0000000000000..034861c49ba15 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outFile.symbols @@ -0,0 +1,16 @@ +=== tests/cases/conformance/removeWhitespace/a.ts === +let a = 1; +>a : Symbol(a, Decl(a.ts, 0, 3)) + +=== tests/cases/conformance/removeWhitespace/b.ts === +let b = 2; +>b : Symbol(b, Decl(b.ts, 0, 3)) + +=== tests/cases/conformance/removeWhitespace/c.ts === +class C {} +>C : Symbol(C, Decl(c.ts, 0, 0)) + +=== tests/cases/conformance/removeWhitespace/d.ts === +function d() {} +>d : Symbol(d, Decl(d.ts, 0, 0)) + diff --git a/tests/baselines/reference/removeWhitespace.outFile.types b/tests/baselines/reference/removeWhitespace.outFile.types new file mode 100644 index 0000000000000..b20742f4a7859 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outFile.types @@ -0,0 +1,18 @@ +=== tests/cases/conformance/removeWhitespace/a.ts === +let a = 1; +>a : number +>1 : 1 + +=== tests/cases/conformance/removeWhitespace/b.ts === +let b = 2; +>b : number +>2 : 2 + +=== tests/cases/conformance/removeWhitespace/c.ts === +class C {} +>C : C + +=== tests/cases/conformance/removeWhitespace/d.ts === +function d() {} +>d : () => void + diff --git a/tests/baselines/reference/removeWhitespaceAndComments.outDir.js b/tests/baselines/reference/removeWhitespaceAndComments.outDir.js new file mode 100644 index 0000000000000..6b4534d283394 --- /dev/null +++ b/tests/baselines/reference/removeWhitespaceAndComments.outDir.js @@ -0,0 +1,198 @@ +//// [tests/cases/conformance/removeWhitespace/removeWhitespaceAndComments.outDir.ts] //// + +//// [global.d.ts] +declare let obj: any, i: any, fn; + +//// [propertyAccess.ts] +obj.a +obj .a +obj. a +obj . a + +obj. + a + +obj + .a + +obj + . + a + +obj // comment + . // comment + a // comment + +obj /* comment */ + . /* comment */ + a /* comment */ + +1..valueOf +1.. valueOf +1. .valueOf +1. . valueOf +1 .valueOf +1 . valueOf + +1.. + valueOf + +1. + .valueOf + +1. + . + valueOf + +1. // comment + . // comment + valueOf // comment + +1. /* comment */ + . /* comment */ + valueOf /* comment */ + +1 + .valueOf + +1 + . + valueOf + +1 // comment + . // comment + valueOf // comment + +1 /* comment */ + . /* comment */ + valueOf /* comment */ + +//// [elementAccess.ts] +obj["a"] +obj [ "a" ] + +obj [ + "a" ] + +obj + [ + "a" + ] + +obj // comment + [ // comment + "a" // comment + ] // comment + +obj /* comment */ + [ /* comment */ + "a" /* comment */ + ] /* comment */ + +//// [update.ts] +i + + i +i + +i +i+ + i +i+ +i + +i + ++ i +i + ++i +i+ ++ i +i+ ++i + +i ++ + i +i ++ +i +i++ + i +i++ +i +i+++i + +i - - i +i - -i +i- - i +i- -i + +i - -- i +i - --i +i- -- i +i- --i + +i -- - i +i -- -i +i-- - i +i-- -i +i---i + +//// [switch.ts] +switch (i) { + case 0: break; + case 1: break; + default: break; +} + +//// [keywords.ts] +delete obj.a +delete (obj).a +delete [][0] +void obj.a +void (obj).a +void [][0] +typeof obj.a +typeof (obj).a +typeof [][0] +function f1() { + return typeof obj +} +async function* f2() { + yield 1 + yield obj + yield (obj) + yield [] + yield* [] + yield *[] + yield * [] + yield + i + yield yield + yield typeof obj + yield void obj + yield delete obj.a + await 1 + await obj + for await (const x of []); + return yield await obj +} +export class C {} +export default function() {} + +//// [statements.ts] +obj; +fn(); +; +function fn3() { + obj; + fn(); + ; + function f() {} + return; + function g() {} +} + +//// [variables.ts] +var a = 0, b, { c } = obj, [d] = obj; +let e = 0, f, { g } = obj, [h] = obj; + +//// [propertyAccess.js] +obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf; +//# sourceMappingURL=propertyAccess.js.map//// [elementAccess.js] +obj["a"];obj["a"];obj["a"];obj["a"];obj["a"];obj["a"]; +//# sourceMappingURL=elementAccess.js.map//// [update.js] +i+ +i;i+ +i;i+ +i;i+ +i;i+ ++i;i+ ++i;i+ ++i;i+ ++i;i+++i;i+++i;i+++i;i+++i;i+++i;i- -i;i- -i;i- -i;i- -i;i- --i;i- --i;i- --i;i- --i;i---i;i---i;i---i;i---i;i---i; +//# sourceMappingURL=update.js.map//// [switch.js] +switch(i){case 0:break;case 1:break;default:break} +//# sourceMappingURL=switch.js.map//// [keywords.js] +delete obj.a;delete(obj).a;delete[][0];void obj.a;void(obj).a;void[][0];typeof obj.a;typeof(obj).a;typeof[][0];function f1(){return typeof obj}async function*f2(){yield 1;yield obj;yield(obj);yield[];yield*[];yield*[];yield*[];yield;i;yield yield;yield typeof obj;yield void obj;yield delete obj.a;await 1;await obj;for await(const x of[]);return yield await obj}export class C{}export default function(){} +//# sourceMappingURL=keywords.js.map//// [statements.js] +obj;fn();function fn3(){obj;fn();function f(){}return;function g(){}} +//# sourceMappingURL=statements.js.map//// [variables.js] +var a=0,b,{c}=obj,[d]=obj;let e=0,f,{g}=obj,[h]=obj; +//# sourceMappingURL=variables.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespaceAndComments.outDir.js.map b/tests/baselines/reference/removeWhitespaceAndComments.outDir.js.map new file mode 100644 index 0000000000000..a913fc552f649 --- /dev/null +++ b/tests/baselines/reference/removeWhitespaceAndComments.outDir.js.map @@ -0,0 +1,8 @@ +//// [propertyAccess.js.map] +{"version":3,"file":"propertyAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/propertyAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAC,CACL,GAAG,CAAE,CAAC,CACN,GAAG,CAAE,CAAC,CACN,GAAG,CAAG,CAAC,CAEP,GAAG,CACC,CAAC,CAEL,GAAG,CACE,CAAC,CAEN,GAAG,CAEC,CAAC,CAEL,GAAG,CAEC,CAAC,CAEL,GAAG,CAEC,CAAC,CAEL,EAAE,CAAC,OAAO,CACV,EAAE,CAAE,OAAO,CACX,EAAE,CAAE,OAAO,CACX,EAAE,CAAG,OAAO,CACZ,CAAC,EAAE,OAAO,CACV,CAAC,EAAG,OAAO,CAEX,EAAE,CACE,OAAO,CAEX,EAAE,CACG,OAAO,CAEZ,EAAE,CAEE,OAAO,CAEX,EAAE,CAEE,OAAO,CAEX,EAAE,CAEE,OAAO,CAEX,CAAC,EACI,OAAO,CAEZ,CAAC,EAEG,OAAO,CAEX,CAAC,EAEG,OAAO,CAEX,CAAC,EAEG,OAAO,CAAA"}//// [elementAccess.js.map] +{"version":3,"file":"elementAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/elementAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,GAAG,CAAC,CACR,GAAG,CAAG,GAAG,CAAE,CAEX,GAAG,CACC,GAAG,CAAE,CAET,GAAG,CAEC,GAAG,CACF,CAEL,GAAG,CAEC,GAAG,CACF,CAEL,GAAG,CAEC,GAAG,CACF,CAAA"}//// [update.js.map] +{"version":3,"file":"update.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/update.ts"],"names":[],"mappings":"AAAA,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAAA"}//// [switch.js.map] +{"version":3,"file":"switch.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/switch.ts"],"names":[],"mappings":"AAAA,OAAQ,CAAC,CAAE,CACP,KAAK,CAAC,CAAE,MACR,KAAK,CAAC,CAAE,MACR,OAAO,CAAE,KAAM,CAClB"}//// [keywords.js.map] +{"version":3,"file":"keywords.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/keywords.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,KAAK,GAAG,CAAC,CAAC,CACV,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CACZ,IAAK,EAAE,CAAC,CAAC,CAAC,CACV,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,cACI,OAAO,OAAO,GAClB,CACA,MAAK,QAAS,CAAC,KACX,MAAM,CAAC,CACP,MAAM,GAAG,CACT,KAAM,CAAC,GAAG,CAAC,CACX,KAAM,EAAE,CACR,KAAK,CAAE,EAAE,CACT,KAAM,CAAC,EAAE,CACT,KAAM,CAAE,EAAE,CACV,KAAK,CACL,CAAC,CACD,MAAM,KAAK,CACX,MAAM,OAAO,GAAG,CAChB,MAAM,KAAK,GAAG,CACd,MAAM,OAAO,GAAG,CAAC,CAAC,CAClB,MAAM,CAAC,CACP,MAAM,GAAG,CACT,IAAI,KAAK,CAAE,MAAM,CAAC,GAAI,EAAE,CAAC,CACzB,OAAO,MAAM,MAAM,GACvB,CACA,OAAM,SACN,OAAO,OAAO,YAAa,CAAC"}//// [statements.js.map] +{"version":3,"file":"statements.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/statements.ts"],"names":[],"mappings":"AAAA,GAAG,CACH,EAAE,EACF,CACA,eACI,GAAG,CACH,EAAE,EACF,CACA,aAAc,CACd,OACA,aAAc,CAClB,CAAC"}//// [variables.js.map] +{"version":3,"file":"variables.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/variables.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CACpC,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespaceAndComments.outDir.sourcemap.txt b/tests/baselines/reference/removeWhitespaceAndComments.outDir.sourcemap.txt new file mode 100644 index 0000000000000..182450a7e248b --- /dev/null +++ b/tests/baselines/reference/removeWhitespaceAndComments.outDir.sourcemap.txt @@ -0,0 +1,1652 @@ +=================================================================== +JsFile: propertyAccess.js +mapUrl: propertyAccess.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/propertyAccess.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/propertyAccess.js +sourceFile:../tests/cases/conformance/removeWhitespace/propertyAccess.ts +------------------------------------------------------------------- +>>>obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf; +1 > +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^ +7 > ^ +8 > ^ +9 > ^ +10> ^^^ +11> ^ +12> ^ +13> ^ +14> ^^^ +15> ^ +16> ^ +17> ^ +18> ^^^ +19> ^ +20> ^ +21> ^ +22> ^^^ +23> ^ +24> ^ +25> ^ +26> ^^^ +27> ^ +28> ^ +29> ^ +30> ^^^ +31> ^ +32> ^ +33> ^ +34> ^^^ +35> ^ +36> ^ +37> ^ +38> ^^ +39> ^ +40> ^^^^^^^ +41> ^ +42> ^^ +43> ^ +44> ^^^^^^^ +45> ^ +46> ^^ +47> ^ +48> ^^^^^^^ +49> ^ +50> ^^ +51> ^ +52> ^^^^^^^ +53> ^ +54> ^ +55> ^^ +56> ^^^^^^^ +57> ^ +58> ^ +59> ^^ +60> ^^^^^^^ +61> ^ +62> ^^ +63> ^ +64> ^^^^^^^ +65> ^ +66> ^^ +67> ^ +68> ^^^^^^^ +69> ^ +70> ^^ +71> ^ +72> ^^^^^^^ +73> ^ +74> ^^ +75> ^ +76> ^^^^^^^ +77> ^ +78> ^^ +79> ^ +80> ^^^^^^^ +81> ^ +82> ^ +83> ^^ +84> ^^^^^^^ +85> ^ +86> ^ +87> ^^ +88> ^^^^^^^ +89> ^ +90> ^ +91> ^^ +92> ^^^^^^^ +93> ^ +94> ^ +95> ^^ +96> ^^^^^^^ +97> ^ +1 > +2 >obj +3 > . +4 > a +5 > + > +6 > obj +7 > . +8 > a +9 > + > +10> obj +11> . +12> a +13> + > +14> obj +15> . +16> a +17> + > + > +18> obj +19> . + > +20> a +21> + > + > +22> obj +23> + > . +24> a +25> + > + > +26> obj +27> + > . + > +28> a +29> + > + > +30> obj +31> // comment + > . // comment + > +32> a +33> // comment + > + > +34> obj +35> /* comment */ + > . /* comment */ + > +36> a +37> /* comment */ + > + > +38> 1. +39> . +40> valueOf +41> + > +42> 1. +43> . +44> valueOf +45> + > +46> 1. +47> . +48> valueOf +49> + > +50> 1. +51> . +52> valueOf +53> + > +54> 1 +55> . +56> valueOf +57> + > +58> 1 +59> . +60> valueOf +61> + > + > +62> 1. +63> . + > +64> valueOf +65> + > + > +66> 1. +67> + > . +68> valueOf +69> + > + > +70> 1. +71> + > . + > +72> valueOf +73> + > + > +74> 1. +75> // comment + > . // comment + > +76> valueOf +77> // comment + > + > +78> 1. +79> /* comment */ + > . /* comment */ + > +80> valueOf +81> /* comment */ + > + > +82> 1 +83> + > . +84> valueOf +85> + > + > +86> 1 +87> + > . + > +88> valueOf +89> + > + > +90> 1 +91> // comment + > . // comment + > +92> valueOf +93> // comment + > + > +94> 1 +95> /* comment */ + > . /* comment */ + > +96> valueOf +97> +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +5 >Emitted(1, 7) Source(2, 1) + SourceIndex(0) +6 >Emitted(1, 10) Source(2, 4) + SourceIndex(0) +7 >Emitted(1, 11) Source(2, 6) + SourceIndex(0) +8 >Emitted(1, 12) Source(2, 7) + SourceIndex(0) +9 >Emitted(1, 13) Source(3, 1) + SourceIndex(0) +10>Emitted(1, 16) Source(3, 4) + SourceIndex(0) +11>Emitted(1, 17) Source(3, 6) + SourceIndex(0) +12>Emitted(1, 18) Source(3, 7) + SourceIndex(0) +13>Emitted(1, 19) Source(4, 1) + SourceIndex(0) +14>Emitted(1, 22) Source(4, 4) + SourceIndex(0) +15>Emitted(1, 23) Source(4, 7) + SourceIndex(0) +16>Emitted(1, 24) Source(4, 8) + SourceIndex(0) +17>Emitted(1, 25) Source(6, 1) + SourceIndex(0) +18>Emitted(1, 28) Source(6, 4) + SourceIndex(0) +19>Emitted(1, 29) Source(7, 5) + SourceIndex(0) +20>Emitted(1, 30) Source(7, 6) + SourceIndex(0) +21>Emitted(1, 31) Source(9, 1) + SourceIndex(0) +22>Emitted(1, 34) Source(9, 4) + SourceIndex(0) +23>Emitted(1, 35) Source(10, 6) + SourceIndex(0) +24>Emitted(1, 36) Source(10, 7) + SourceIndex(0) +25>Emitted(1, 37) Source(12, 1) + SourceIndex(0) +26>Emitted(1, 40) Source(12, 4) + SourceIndex(0) +27>Emitted(1, 41) Source(14, 5) + SourceIndex(0) +28>Emitted(1, 42) Source(14, 6) + SourceIndex(0) +29>Emitted(1, 43) Source(16, 1) + SourceIndex(0) +30>Emitted(1, 46) Source(16, 4) + SourceIndex(0) +31>Emitted(1, 47) Source(18, 5) + SourceIndex(0) +32>Emitted(1, 48) Source(18, 6) + SourceIndex(0) +33>Emitted(1, 49) Source(20, 1) + SourceIndex(0) +34>Emitted(1, 52) Source(20, 4) + SourceIndex(0) +35>Emitted(1, 53) Source(22, 5) + SourceIndex(0) +36>Emitted(1, 54) Source(22, 6) + SourceIndex(0) +37>Emitted(1, 55) Source(24, 1) + SourceIndex(0) +38>Emitted(1, 57) Source(24, 3) + SourceIndex(0) +39>Emitted(1, 58) Source(24, 4) + SourceIndex(0) +40>Emitted(1, 65) Source(24, 11) + SourceIndex(0) +41>Emitted(1, 66) Source(25, 1) + SourceIndex(0) +42>Emitted(1, 68) Source(25, 3) + SourceIndex(0) +43>Emitted(1, 69) Source(25, 5) + SourceIndex(0) +44>Emitted(1, 76) Source(25, 12) + SourceIndex(0) +45>Emitted(1, 77) Source(26, 1) + SourceIndex(0) +46>Emitted(1, 79) Source(26, 3) + SourceIndex(0) +47>Emitted(1, 80) Source(26, 5) + SourceIndex(0) +48>Emitted(1, 87) Source(26, 12) + SourceIndex(0) +49>Emitted(1, 88) Source(27, 1) + SourceIndex(0) +50>Emitted(1, 90) Source(27, 3) + SourceIndex(0) +51>Emitted(1, 91) Source(27, 6) + SourceIndex(0) +52>Emitted(1, 98) Source(27, 13) + SourceIndex(0) +53>Emitted(1, 99) Source(28, 1) + SourceIndex(0) +54>Emitted(1, 100) Source(28, 2) + SourceIndex(0) +55>Emitted(1, 102) Source(28, 4) + SourceIndex(0) +56>Emitted(1, 109) Source(28, 11) + SourceIndex(0) +57>Emitted(1, 110) Source(29, 1) + SourceIndex(0) +58>Emitted(1, 111) Source(29, 2) + SourceIndex(0) +59>Emitted(1, 113) Source(29, 5) + SourceIndex(0) +60>Emitted(1, 120) Source(29, 12) + SourceIndex(0) +61>Emitted(1, 121) Source(31, 1) + SourceIndex(0) +62>Emitted(1, 123) Source(31, 3) + SourceIndex(0) +63>Emitted(1, 124) Source(32, 5) + SourceIndex(0) +64>Emitted(1, 131) Source(32, 12) + SourceIndex(0) +65>Emitted(1, 132) Source(34, 1) + SourceIndex(0) +66>Emitted(1, 134) Source(34, 3) + SourceIndex(0) +67>Emitted(1, 135) Source(35, 6) + SourceIndex(0) +68>Emitted(1, 142) Source(35, 13) + SourceIndex(0) +69>Emitted(1, 143) Source(37, 1) + SourceIndex(0) +70>Emitted(1, 145) Source(37, 3) + SourceIndex(0) +71>Emitted(1, 146) Source(39, 5) + SourceIndex(0) +72>Emitted(1, 153) Source(39, 12) + SourceIndex(0) +73>Emitted(1, 154) Source(41, 1) + SourceIndex(0) +74>Emitted(1, 156) Source(41, 3) + SourceIndex(0) +75>Emitted(1, 157) Source(43, 5) + SourceIndex(0) +76>Emitted(1, 164) Source(43, 12) + SourceIndex(0) +77>Emitted(1, 165) Source(45, 1) + SourceIndex(0) +78>Emitted(1, 167) Source(45, 3) + SourceIndex(0) +79>Emitted(1, 168) Source(47, 5) + SourceIndex(0) +80>Emitted(1, 175) Source(47, 12) + SourceIndex(0) +81>Emitted(1, 176) Source(49, 1) + SourceIndex(0) +82>Emitted(1, 177) Source(49, 2) + SourceIndex(0) +83>Emitted(1, 179) Source(50, 6) + SourceIndex(0) +84>Emitted(1, 186) Source(50, 13) + SourceIndex(0) +85>Emitted(1, 187) Source(52, 1) + SourceIndex(0) +86>Emitted(1, 188) Source(52, 2) + SourceIndex(0) +87>Emitted(1, 190) Source(54, 5) + SourceIndex(0) +88>Emitted(1, 197) Source(54, 12) + SourceIndex(0) +89>Emitted(1, 198) Source(56, 1) + SourceIndex(0) +90>Emitted(1, 199) Source(56, 2) + SourceIndex(0) +91>Emitted(1, 201) Source(58, 5) + SourceIndex(0) +92>Emitted(1, 208) Source(58, 12) + SourceIndex(0) +93>Emitted(1, 209) Source(60, 1) + SourceIndex(0) +94>Emitted(1, 210) Source(60, 2) + SourceIndex(0) +95>Emitted(1, 212) Source(62, 5) + SourceIndex(0) +96>Emitted(1, 219) Source(62, 12) + SourceIndex(0) +97>Emitted(1, 220) Source(62, 12) + SourceIndex(0) +--- +>>>//# sourceMappingURL=propertyAccess.js.map=================================================================== +JsFile: elementAccess.js +mapUrl: elementAccess.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/elementAccess.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/elementAccess.js +sourceFile:../tests/cases/conformance/removeWhitespace/elementAccess.ts +------------------------------------------------------------------- +>>>obj["a"];obj["a"];obj["a"];obj["a"];obj["a"];obj["a"]; +1 > +2 >^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^^ +10> ^ +11> ^ +12> ^^^ +13> ^ +14> ^^^ +15> ^ +16> ^ +17> ^^^ +18> ^ +19> ^^^ +20> ^ +21> ^ +22> ^^^ +23> ^ +24> ^^^ +25> ^ +26> ^ +27> ^^^ +28> ^ +29> ^^^ +30> ^ +31> ^ +1 > +2 >obj +3 > [ +4 > "a" +5 > ] +6 > + > +7 > obj +8 > [ +9 > "a" +10> ] +11> + > + > +12> obj +13> [ + > +14> "a" +15> ] +16> + > + > +17> obj +18> + > [ + > +19> "a" +20> + > ] +21> + > + > +22> obj +23> // comment + > [ // comment + > +24> "a" +25> // comment + > ] +26> // comment + > + > +27> obj +28> /* comment */ + > [ /* comment */ + > +29> "a" +30> /* comment */ + > ] +31> +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +5 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +6 >Emitted(1, 10) Source(2, 1) + SourceIndex(0) +7 >Emitted(1, 13) Source(2, 4) + SourceIndex(0) +8 >Emitted(1, 14) Source(2, 7) + SourceIndex(0) +9 >Emitted(1, 17) Source(2, 10) + SourceIndex(0) +10>Emitted(1, 18) Source(2, 12) + SourceIndex(0) +11>Emitted(1, 19) Source(4, 1) + SourceIndex(0) +12>Emitted(1, 22) Source(4, 4) + SourceIndex(0) +13>Emitted(1, 23) Source(5, 5) + SourceIndex(0) +14>Emitted(1, 26) Source(5, 8) + SourceIndex(0) +15>Emitted(1, 27) Source(5, 10) + SourceIndex(0) +16>Emitted(1, 28) Source(7, 1) + SourceIndex(0) +17>Emitted(1, 31) Source(7, 4) + SourceIndex(0) +18>Emitted(1, 32) Source(9, 5) + SourceIndex(0) +19>Emitted(1, 35) Source(9, 8) + SourceIndex(0) +20>Emitted(1, 36) Source(10, 6) + SourceIndex(0) +21>Emitted(1, 37) Source(12, 1) + SourceIndex(0) +22>Emitted(1, 40) Source(12, 4) + SourceIndex(0) +23>Emitted(1, 41) Source(14, 5) + SourceIndex(0) +24>Emitted(1, 44) Source(14, 8) + SourceIndex(0) +25>Emitted(1, 45) Source(15, 6) + SourceIndex(0) +26>Emitted(1, 46) Source(17, 1) + SourceIndex(0) +27>Emitted(1, 49) Source(17, 4) + SourceIndex(0) +28>Emitted(1, 50) Source(19, 5) + SourceIndex(0) +29>Emitted(1, 53) Source(19, 8) + SourceIndex(0) +30>Emitted(1, 54) Source(20, 6) + SourceIndex(0) +31>Emitted(1, 55) Source(20, 6) + SourceIndex(0) +--- +>>>//# sourceMappingURL=elementAccess.js.map=================================================================== +JsFile: update.js +mapUrl: update.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/update.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/update.js +sourceFile:../tests/cases/conformance/removeWhitespace/update.ts +------------------------------------------------------------------- +>>>i+ +i;i+ +i;i+ +i;i+ +i;i+ ++i;i+ ++i;i+ ++i;i+ ++i;i+++i;i+++i;i+++i;i+++i;i+++i;i- -i;i- -i;i- -i;i- -i;i- --i;i- --i;i- --i;i- --i;i---i;i---i;i---i;i---i;i---i; +1 > +2 >^ +3 > ^^ +4 > ^ +5 > ^ +6 > ^ +7 > ^ +8 > ^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^^ +19> ^ +20> ^ +21> ^ +22> ^ +23> ^^ +24> ^^ +25> ^ +26> ^ +27> ^ +28> ^^ +29> ^^ +30> ^ +31> ^ +32> ^ +33> ^^ +34> ^^ +35> ^ +36> ^ +37> ^ +38> ^^ +39> ^^ +40> ^ +41> ^ +42> ^ +43> ^^ +44> ^ +45> ^ +46> ^ +47> ^ +48> ^^ +49> ^ +50> ^ +51> ^ +52> ^ +53> ^^ +54> ^ +55> ^ +56> ^ +57> ^ +58> ^^ +59> ^ +60> ^ +61> ^ +62> ^ +63> ^^ +64> ^ +65> ^ +66> ^ +67> ^ +68> ^^ +69> ^ +70> ^ +71> ^ +72> ^ +73> ^^ +74> ^ +75> ^ +76> ^ +77> ^ +78> ^^ +79> ^ +80> ^ +81> ^ +82> ^ +83> ^^ +84> ^ +85> ^ +86> ^ +87> ^ +88> ^^ +89> ^^ +90> ^ +91> ^ +92> ^ +93> ^^ +94> ^^ +95> ^ +96> ^ +97> ^ +98> ^^ +99> ^^ +100> ^ +101> ^ +102> ^ +103> ^^ +104> ^^ +105> ^ +106> ^ +107> ^ +108> ^^ +109> ^ +110> ^ +111> ^ +112> ^ +113> ^^ +114> ^ +115> ^ +116> ^ +117> ^ +118> ^^ +119> ^ +120> ^ +121> ^ +122> ^ +123> ^^ +124> ^ +125> ^ +126> ^ +127> ^ +128> ^^ +129> ^ +130> ^ +131> ^ +1 > +2 >i +3 > + +4 > + +5 > i +6 > + > +7 > i +8 > + +9 > + +10> i +11> + > +12> i +13> + +14> + +15> i +16> + > +17> i +18> + +19> + +20> i +21> + > + > +22> i +23> + +24> ++ +25> i +26> + > +27> i +28> + +29> ++ +30> i +31> + > +32> i +33> + +34> ++ +35> i +36> + > +37> i +38> + +39> ++ +40> i +41> + > + > +42> i +43> ++ +44> + +45> i +46> + > +47> i +48> ++ +49> + +50> i +51> + > +52> i +53> ++ +54> + +55> i +56> + > +57> i +58> ++ +59> + +60> i +61> + > +62> i +63> ++ +64> + +65> i +66> + > + > +67> i +68> - +69> - +70> i +71> + > +72> i +73> - +74> - +75> i +76> + > +77> i +78> - +79> - +80> i +81> + > +82> i +83> - +84> - +85> i +86> + > + > +87> i +88> - +89> -- +90> i +91> + > +92> i +93> - +94> -- +95> i +96> + > +97> i +98> - +99> -- +100> i +101> + > +102> i +103> - +104> -- +105> i +106> + > + > +107> i +108> -- +109> - +110> i +111> + > +112> i +113> -- +114> - +115> i +116> + > +117> i +118> -- +119> - +120> i +121> + > +122> i +123> -- +124> - +125> i +126> + > +127> i +128> -- +129> - +130> i +131> +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 2) Source(1, 2) + SourceIndex(0) +3 >Emitted(1, 4) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 5) Source(1, 7) + SourceIndex(0) +5 >Emitted(1, 6) Source(1, 8) + SourceIndex(0) +6 >Emitted(1, 7) Source(2, 1) + SourceIndex(0) +7 >Emitted(1, 8) Source(2, 2) + SourceIndex(0) +8 >Emitted(1, 10) Source(2, 5) + SourceIndex(0) +9 >Emitted(1, 11) Source(2, 6) + SourceIndex(0) +10>Emitted(1, 12) Source(2, 7) + SourceIndex(0) +11>Emitted(1, 13) Source(3, 1) + SourceIndex(0) +12>Emitted(1, 14) Source(3, 2) + SourceIndex(0) +13>Emitted(1, 16) Source(3, 4) + SourceIndex(0) +14>Emitted(1, 17) Source(3, 6) + SourceIndex(0) +15>Emitted(1, 18) Source(3, 7) + SourceIndex(0) +16>Emitted(1, 19) Source(4, 1) + SourceIndex(0) +17>Emitted(1, 20) Source(4, 2) + SourceIndex(0) +18>Emitted(1, 22) Source(4, 4) + SourceIndex(0) +19>Emitted(1, 23) Source(4, 5) + SourceIndex(0) +20>Emitted(1, 24) Source(4, 6) + SourceIndex(0) +21>Emitted(1, 25) Source(6, 1) + SourceIndex(0) +22>Emitted(1, 26) Source(6, 2) + SourceIndex(0) +23>Emitted(1, 28) Source(6, 5) + SourceIndex(0) +24>Emitted(1, 30) Source(6, 8) + SourceIndex(0) +25>Emitted(1, 31) Source(6, 9) + SourceIndex(0) +26>Emitted(1, 32) Source(7, 1) + SourceIndex(0) +27>Emitted(1, 33) Source(7, 2) + SourceIndex(0) +28>Emitted(1, 35) Source(7, 5) + SourceIndex(0) +29>Emitted(1, 37) Source(7, 7) + SourceIndex(0) +30>Emitted(1, 38) Source(7, 8) + SourceIndex(0) +31>Emitted(1, 39) Source(8, 1) + SourceIndex(0) +32>Emitted(1, 40) Source(8, 2) + SourceIndex(0) +33>Emitted(1, 42) Source(8, 4) + SourceIndex(0) +34>Emitted(1, 44) Source(8, 7) + SourceIndex(0) +35>Emitted(1, 45) Source(8, 8) + SourceIndex(0) +36>Emitted(1, 46) Source(9, 1) + SourceIndex(0) +37>Emitted(1, 47) Source(9, 2) + SourceIndex(0) +38>Emitted(1, 49) Source(9, 4) + SourceIndex(0) +39>Emitted(1, 51) Source(9, 6) + SourceIndex(0) +40>Emitted(1, 52) Source(9, 7) + SourceIndex(0) +41>Emitted(1, 53) Source(11, 1) + SourceIndex(0) +42>Emitted(1, 54) Source(11, 2) + SourceIndex(0) +43>Emitted(1, 56) Source(11, 5) + SourceIndex(0) +44>Emitted(1, 57) Source(11, 8) + SourceIndex(0) +45>Emitted(1, 58) Source(11, 9) + SourceIndex(0) +46>Emitted(1, 59) Source(12, 1) + SourceIndex(0) +47>Emitted(1, 60) Source(12, 2) + SourceIndex(0) +48>Emitted(1, 62) Source(12, 5) + SourceIndex(0) +49>Emitted(1, 63) Source(12, 7) + SourceIndex(0) +50>Emitted(1, 64) Source(12, 8) + SourceIndex(0) +51>Emitted(1, 65) Source(13, 1) + SourceIndex(0) +52>Emitted(1, 66) Source(13, 2) + SourceIndex(0) +53>Emitted(1, 68) Source(13, 4) + SourceIndex(0) +54>Emitted(1, 69) Source(13, 7) + SourceIndex(0) +55>Emitted(1, 70) Source(13, 8) + SourceIndex(0) +56>Emitted(1, 71) Source(14, 1) + SourceIndex(0) +57>Emitted(1, 72) Source(14, 2) + SourceIndex(0) +58>Emitted(1, 74) Source(14, 4) + SourceIndex(0) +59>Emitted(1, 75) Source(14, 6) + SourceIndex(0) +60>Emitted(1, 76) Source(14, 7) + SourceIndex(0) +61>Emitted(1, 77) Source(15, 1) + SourceIndex(0) +62>Emitted(1, 78) Source(15, 2) + SourceIndex(0) +63>Emitted(1, 80) Source(15, 4) + SourceIndex(0) +64>Emitted(1, 81) Source(15, 5) + SourceIndex(0) +65>Emitted(1, 82) Source(15, 6) + SourceIndex(0) +66>Emitted(1, 83) Source(17, 1) + SourceIndex(0) +67>Emitted(1, 84) Source(17, 2) + SourceIndex(0) +68>Emitted(1, 86) Source(17, 5) + SourceIndex(0) +69>Emitted(1, 87) Source(17, 7) + SourceIndex(0) +70>Emitted(1, 88) Source(17, 8) + SourceIndex(0) +71>Emitted(1, 89) Source(18, 1) + SourceIndex(0) +72>Emitted(1, 90) Source(18, 2) + SourceIndex(0) +73>Emitted(1, 92) Source(18, 5) + SourceIndex(0) +74>Emitted(1, 93) Source(18, 6) + SourceIndex(0) +75>Emitted(1, 94) Source(18, 7) + SourceIndex(0) +76>Emitted(1, 95) Source(19, 1) + SourceIndex(0) +77>Emitted(1, 96) Source(19, 2) + SourceIndex(0) +78>Emitted(1, 98) Source(19, 4) + SourceIndex(0) +79>Emitted(1, 99) Source(19, 6) + SourceIndex(0) +80>Emitted(1, 100) Source(19, 7) + SourceIndex(0) +81>Emitted(1, 101) Source(20, 1) + SourceIndex(0) +82>Emitted(1, 102) Source(20, 2) + SourceIndex(0) +83>Emitted(1, 104) Source(20, 4) + SourceIndex(0) +84>Emitted(1, 105) Source(20, 5) + SourceIndex(0) +85>Emitted(1, 106) Source(20, 6) + SourceIndex(0) +86>Emitted(1, 107) Source(22, 1) + SourceIndex(0) +87>Emitted(1, 108) Source(22, 2) + SourceIndex(0) +88>Emitted(1, 110) Source(22, 5) + SourceIndex(0) +89>Emitted(1, 112) Source(22, 8) + SourceIndex(0) +90>Emitted(1, 113) Source(22, 9) + SourceIndex(0) +91>Emitted(1, 114) Source(23, 1) + SourceIndex(0) +92>Emitted(1, 115) Source(23, 2) + SourceIndex(0) +93>Emitted(1, 117) Source(23, 5) + SourceIndex(0) +94>Emitted(1, 119) Source(23, 7) + SourceIndex(0) +95>Emitted(1, 120) Source(23, 8) + SourceIndex(0) +96>Emitted(1, 121) Source(24, 1) + SourceIndex(0) +97>Emitted(1, 122) Source(24, 2) + SourceIndex(0) +98>Emitted(1, 124) Source(24, 4) + SourceIndex(0) +99>Emitted(1, 126) Source(24, 7) + SourceIndex(0) +100>Emitted(1, 127) Source(24, 8) + SourceIndex(0) +101>Emitted(1, 128) Source(25, 1) + SourceIndex(0) +102>Emitted(1, 129) Source(25, 2) + SourceIndex(0) +103>Emitted(1, 131) Source(25, 4) + SourceIndex(0) +104>Emitted(1, 133) Source(25, 6) + SourceIndex(0) +105>Emitted(1, 134) Source(25, 7) + SourceIndex(0) +106>Emitted(1, 135) Source(27, 1) + SourceIndex(0) +107>Emitted(1, 136) Source(27, 2) + SourceIndex(0) +108>Emitted(1, 138) Source(27, 5) + SourceIndex(0) +109>Emitted(1, 139) Source(27, 8) + SourceIndex(0) +110>Emitted(1, 140) Source(27, 9) + SourceIndex(0) +111>Emitted(1, 141) Source(28, 1) + SourceIndex(0) +112>Emitted(1, 142) Source(28, 2) + SourceIndex(0) +113>Emitted(1, 144) Source(28, 5) + SourceIndex(0) +114>Emitted(1, 145) Source(28, 7) + SourceIndex(0) +115>Emitted(1, 146) Source(28, 8) + SourceIndex(0) +116>Emitted(1, 147) Source(29, 1) + SourceIndex(0) +117>Emitted(1, 148) Source(29, 2) + SourceIndex(0) +118>Emitted(1, 150) Source(29, 4) + SourceIndex(0) +119>Emitted(1, 151) Source(29, 7) + SourceIndex(0) +120>Emitted(1, 152) Source(29, 8) + SourceIndex(0) +121>Emitted(1, 153) Source(30, 1) + SourceIndex(0) +122>Emitted(1, 154) Source(30, 2) + SourceIndex(0) +123>Emitted(1, 156) Source(30, 4) + SourceIndex(0) +124>Emitted(1, 157) Source(30, 6) + SourceIndex(0) +125>Emitted(1, 158) Source(30, 7) + SourceIndex(0) +126>Emitted(1, 159) Source(31, 1) + SourceIndex(0) +127>Emitted(1, 160) Source(31, 2) + SourceIndex(0) +128>Emitted(1, 162) Source(31, 4) + SourceIndex(0) +129>Emitted(1, 163) Source(31, 5) + SourceIndex(0) +130>Emitted(1, 164) Source(31, 6) + SourceIndex(0) +131>Emitted(1, 165) Source(31, 6) + SourceIndex(0) +--- +>>>//# sourceMappingURL=update.js.map=================================================================== +JsFile: switch.js +mapUrl: switch.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/switch.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/switch.js +sourceFile:../tests/cases/conformance/removeWhitespace/switch.ts +------------------------------------------------------------------- +>>>switch(i){case 0:break;case 1:break;default:break} +1 > +2 >^^^^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +9 > ^^^^^^ +10> ^^^^^ +11> ^ +12> ^ +13> ^^^^^^ +14> ^^^^^^^ +15> ^ +16> ^^^^^ +17> ^ +1 > +2 >switch ( +3 > i +4 > ) +5 > { + > +6 > case +7 > 0 +8 > : +9 > break; + > +10> case +11> 1 +12> : +13> break; + > +14> default +15> : +16> break; +17> + > } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 9) + SourceIndex(0) +3 >Emitted(1, 9) Source(1, 10) + SourceIndex(0) +4 >Emitted(1, 10) Source(1, 12) + SourceIndex(0) +5 >Emitted(1, 11) Source(2, 5) + SourceIndex(0) +6 >Emitted(1, 16) Source(2, 10) + SourceIndex(0) +7 >Emitted(1, 17) Source(2, 11) + SourceIndex(0) +8 >Emitted(1, 18) Source(2, 13) + SourceIndex(0) +9 >Emitted(1, 24) Source(3, 5) + SourceIndex(0) +10>Emitted(1, 29) Source(3, 10) + SourceIndex(0) +11>Emitted(1, 30) Source(3, 11) + SourceIndex(0) +12>Emitted(1, 31) Source(3, 13) + SourceIndex(0) +13>Emitted(1, 37) Source(4, 5) + SourceIndex(0) +14>Emitted(1, 44) Source(4, 12) + SourceIndex(0) +15>Emitted(1, 45) Source(4, 14) + SourceIndex(0) +16>Emitted(1, 50) Source(4, 20) + SourceIndex(0) +17>Emitted(1, 51) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=switch.js.map=================================================================== +JsFile: keywords.js +mapUrl: keywords.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/keywords.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/keywords.js +sourceFile:../tests/cases/conformance/removeWhitespace/keywords.ts +------------------------------------------------------------------- +>>>delete obj.a;delete(obj).a;delete[][0];void obj.a;void(obj).a;void[][0];typeof obj.a;typeof(obj).a;typeof[][0];function f1(){return typeof obj}async function*f2(){yield 1;yield obj;yield(obj);yield[];yield*[];yield*[];yield*[];yield;i;yield yield;yield typeof obj;yield void obj;yield delete obj.a;await 1;await obj;for await(const x of[]);return yield await obj}export class C{}export default function(){} +1 > +2 >^^^^^^^ +3 > ^^^ +4 > ^ +5 > ^ +6 > ^ +7 > ^^^^^^ +8 > ^ +9 > ^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^^^^^^ +15> ^^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^^^^^ +21> ^^^ +22> ^ +23> ^ +24> ^ +25> ^^^^ +26> ^ +27> ^^^ +28> ^ +29> ^ +30> ^ +31> ^ +32> ^^^^ +33> ^^ +34> ^ +35> ^ +36> ^ +37> ^ +38> ^^^^^^^ +39> ^^^ +40> ^ +41> ^ +42> ^ +43> ^^^^^^ +44> ^ +45> ^^^ +46> ^ +47> ^ +48> ^ +49> ^ +50> ^^^^^^ +51> ^^ +52> ^ +53> ^ +54> ^ +55> ^ +56> ^^^^^^^^^^^^^^ +57> ^^^^^^^ +58> ^^^^^^^ +59> ^^^ +60> ^ +61> ^^^^^^ +62> ^^^^^^^^ +63> ^ +64> ^^^^^ +65> ^^^^^^ +66> ^ +67> ^ +68> ^^^^^^ +69> ^^^ +70> ^ +71> ^^^^^ +72> ^ +73> ^^^ +74> ^ +75> ^ +76> ^^^^^ +77> ^^ +78> ^ +79> ^^^^^ +80> ^ +81> ^^ +82> ^ +83> ^^^^^ +84> ^ +85> ^^ +86> ^ +87> ^^^^^ +88> ^ +89> ^^ +90> ^ +91> ^^^^^ +92> ^ +93> ^ +94> ^ +95> ^^^^^^ +96> ^^^^^ +97> ^ +98> ^^^^^^ +99> ^^^^^^^ +100> ^^^ +101> ^ +102> ^^^^^^ +103> ^^^^^ +104> ^^^ +105> ^ +106> ^^^^^^ +107> ^^^^^^^ +108> ^^^ +109> ^ +110> ^ +111> ^ +112> ^^^^^^ +113> ^ +114> ^ +115> ^^^^^^ +116> ^^^ +117> ^ +118> ^^^^ +119> ^^^^^ +120> ^ +121> ^^^^^^ +122> ^ +123> ^^^ +124> ^^ +125> ^ +126> ^ +127> ^^^^^^^ +128> ^^^^^^ +129> ^^^^^^ +130> ^^^ +131> ^ +132> ^^^^^^^ +133> ^^^^^^^^^ +134> ^^^^^^^ +135> ^^^^^^^ +136> ^^^^^^^^^^^^ +137> ^ +1 > +2 >delete +3 > obj +4 > . +5 > a +6 > + > +7 > delete +8 > ( +9 > obj +10> ) +11> . +12> a +13> + > +14> delete +15> [] +16> [ +17> 0 +18> ] +19> + > +20> void +21> obj +22> . +23> a +24> + > +25> void +26> ( +27> obj +28> ) +29> . +30> a +31> + > +32> void +33> [] +34> [ +35> 0 +36> ] +37> + > +38> typeof +39> obj +40> . +41> a +42> + > +43> typeof +44> ( +45> obj +46> ) +47> . +48> a +49> + > +50> typeof +51> [] +52> [ +53> 0 +54> ] +55> + > +56> function f1() { + > +57> return +58> typeof +59> obj + > +60> } + > +61> async +62> function +63> * +64> f2() { + > +65> yield +66> 1 +67> + > +68> yield +69> obj +70> + > +71> yield +72> ( +73> obj +74> ) +75> + > +76> yield +77> [] +78> + > +79> yield +80> * +81> [] +82> + > +83> yield +84> * +85> [] +86> + > +87> yield +88> * +89> [] +90> + > +91> yield +92> + > +93> i +94> + > +95> yield +96> yield +97> + > +98> yield +99> typeof +100> obj +101> + > +102> yield +103> void +104> obj +105> + > +106> yield +107> delete +108> obj +109> . +110> a +111> + > +112> await +113> 1 +114> + > +115> await +116> obj +117> + > +118> for +119> await +120> ( +121> const +122> x +123> of +124> [] +125> ) +126> ; + > +127> return +128> yield +129> await +130> obj + > +131> } + > +132> export +133> class C {} + > +134> export +135> default +136> function() { +137> } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +3 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +4 >Emitted(1, 12) Source(1, 12) + SourceIndex(0) +5 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +6 >Emitted(1, 14) Source(2, 1) + SourceIndex(0) +7 >Emitted(1, 20) Source(2, 8) + SourceIndex(0) +8 >Emitted(1, 21) Source(2, 9) + SourceIndex(0) +9 >Emitted(1, 24) Source(2, 12) + SourceIndex(0) +10>Emitted(1, 25) Source(2, 13) + SourceIndex(0) +11>Emitted(1, 26) Source(2, 14) + SourceIndex(0) +12>Emitted(1, 27) Source(2, 15) + SourceIndex(0) +13>Emitted(1, 28) Source(3, 1) + SourceIndex(0) +14>Emitted(1, 34) Source(3, 8) + SourceIndex(0) +15>Emitted(1, 36) Source(3, 10) + SourceIndex(0) +16>Emitted(1, 37) Source(3, 11) + SourceIndex(0) +17>Emitted(1, 38) Source(3, 12) + SourceIndex(0) +18>Emitted(1, 39) Source(3, 13) + SourceIndex(0) +19>Emitted(1, 40) Source(4, 1) + SourceIndex(0) +20>Emitted(1, 45) Source(4, 6) + SourceIndex(0) +21>Emitted(1, 48) Source(4, 9) + SourceIndex(0) +22>Emitted(1, 49) Source(4, 10) + SourceIndex(0) +23>Emitted(1, 50) Source(4, 11) + SourceIndex(0) +24>Emitted(1, 51) Source(5, 1) + SourceIndex(0) +25>Emitted(1, 55) Source(5, 6) + SourceIndex(0) +26>Emitted(1, 56) Source(5, 7) + SourceIndex(0) +27>Emitted(1, 59) Source(5, 10) + SourceIndex(0) +28>Emitted(1, 60) Source(5, 11) + SourceIndex(0) +29>Emitted(1, 61) Source(5, 12) + SourceIndex(0) +30>Emitted(1, 62) Source(5, 13) + SourceIndex(0) +31>Emitted(1, 63) Source(6, 1) + SourceIndex(0) +32>Emitted(1, 67) Source(6, 6) + SourceIndex(0) +33>Emitted(1, 69) Source(6, 8) + SourceIndex(0) +34>Emitted(1, 70) Source(6, 9) + SourceIndex(0) +35>Emitted(1, 71) Source(6, 10) + SourceIndex(0) +36>Emitted(1, 72) Source(6, 11) + SourceIndex(0) +37>Emitted(1, 73) Source(7, 1) + SourceIndex(0) +38>Emitted(1, 80) Source(7, 8) + SourceIndex(0) +39>Emitted(1, 83) Source(7, 11) + SourceIndex(0) +40>Emitted(1, 84) Source(7, 12) + SourceIndex(0) +41>Emitted(1, 85) Source(7, 13) + SourceIndex(0) +42>Emitted(1, 86) Source(8, 1) + SourceIndex(0) +43>Emitted(1, 92) Source(8, 8) + SourceIndex(0) +44>Emitted(1, 93) Source(8, 9) + SourceIndex(0) +45>Emitted(1, 96) Source(8, 12) + SourceIndex(0) +46>Emitted(1, 97) Source(8, 13) + SourceIndex(0) +47>Emitted(1, 98) Source(8, 14) + SourceIndex(0) +48>Emitted(1, 99) Source(8, 15) + SourceIndex(0) +49>Emitted(1, 100) Source(9, 1) + SourceIndex(0) +50>Emitted(1, 106) Source(9, 8) + SourceIndex(0) +51>Emitted(1, 108) Source(9, 10) + SourceIndex(0) +52>Emitted(1, 109) Source(9, 11) + SourceIndex(0) +53>Emitted(1, 110) Source(9, 12) + SourceIndex(0) +54>Emitted(1, 111) Source(9, 13) + SourceIndex(0) +55>Emitted(1, 112) Source(10, 1) + SourceIndex(0) +56>Emitted(1, 126) Source(11, 5) + SourceIndex(0) +57>Emitted(1, 133) Source(11, 12) + SourceIndex(0) +58>Emitted(1, 140) Source(11, 19) + SourceIndex(0) +59>Emitted(1, 143) Source(12, 1) + SourceIndex(0) +60>Emitted(1, 144) Source(13, 1) + SourceIndex(0) +61>Emitted(1, 150) Source(13, 6) + SourceIndex(0) +62>Emitted(1, 158) Source(13, 15) + SourceIndex(0) +63>Emitted(1, 159) Source(13, 16) + SourceIndex(0) +64>Emitted(1, 164) Source(14, 5) + SourceIndex(0) +65>Emitted(1, 170) Source(14, 11) + SourceIndex(0) +66>Emitted(1, 171) Source(14, 12) + SourceIndex(0) +67>Emitted(1, 172) Source(15, 5) + SourceIndex(0) +68>Emitted(1, 178) Source(15, 11) + SourceIndex(0) +69>Emitted(1, 181) Source(15, 14) + SourceIndex(0) +70>Emitted(1, 182) Source(16, 5) + SourceIndex(0) +71>Emitted(1, 187) Source(16, 11) + SourceIndex(0) +72>Emitted(1, 188) Source(16, 12) + SourceIndex(0) +73>Emitted(1, 191) Source(16, 15) + SourceIndex(0) +74>Emitted(1, 192) Source(16, 16) + SourceIndex(0) +75>Emitted(1, 193) Source(17, 5) + SourceIndex(0) +76>Emitted(1, 198) Source(17, 11) + SourceIndex(0) +77>Emitted(1, 200) Source(17, 13) + SourceIndex(0) +78>Emitted(1, 201) Source(18, 5) + SourceIndex(0) +79>Emitted(1, 206) Source(18, 10) + SourceIndex(0) +80>Emitted(1, 207) Source(18, 12) + SourceIndex(0) +81>Emitted(1, 209) Source(18, 14) + SourceIndex(0) +82>Emitted(1, 210) Source(19, 5) + SourceIndex(0) +83>Emitted(1, 215) Source(19, 11) + SourceIndex(0) +84>Emitted(1, 216) Source(19, 12) + SourceIndex(0) +85>Emitted(1, 218) Source(19, 14) + SourceIndex(0) +86>Emitted(1, 219) Source(20, 5) + SourceIndex(0) +87>Emitted(1, 224) Source(20, 11) + SourceIndex(0) +88>Emitted(1, 225) Source(20, 13) + SourceIndex(0) +89>Emitted(1, 227) Source(20, 15) + SourceIndex(0) +90>Emitted(1, 228) Source(21, 5) + SourceIndex(0) +91>Emitted(1, 233) Source(21, 10) + SourceIndex(0) +92>Emitted(1, 234) Source(22, 5) + SourceIndex(0) +93>Emitted(1, 235) Source(22, 6) + SourceIndex(0) +94>Emitted(1, 236) Source(23, 5) + SourceIndex(0) +95>Emitted(1, 242) Source(23, 11) + SourceIndex(0) +96>Emitted(1, 247) Source(23, 16) + SourceIndex(0) +97>Emitted(1, 248) Source(24, 5) + SourceIndex(0) +98>Emitted(1, 254) Source(24, 11) + SourceIndex(0) +99>Emitted(1, 261) Source(24, 18) + SourceIndex(0) +100>Emitted(1, 264) Source(24, 21) + SourceIndex(0) +101>Emitted(1, 265) Source(25, 5) + SourceIndex(0) +102>Emitted(1, 271) Source(25, 11) + SourceIndex(0) +103>Emitted(1, 276) Source(25, 16) + SourceIndex(0) +104>Emitted(1, 279) Source(25, 19) + SourceIndex(0) +105>Emitted(1, 280) Source(26, 5) + SourceIndex(0) +106>Emitted(1, 286) Source(26, 11) + SourceIndex(0) +107>Emitted(1, 293) Source(26, 18) + SourceIndex(0) +108>Emitted(1, 296) Source(26, 21) + SourceIndex(0) +109>Emitted(1, 297) Source(26, 22) + SourceIndex(0) +110>Emitted(1, 298) Source(26, 23) + SourceIndex(0) +111>Emitted(1, 299) Source(27, 5) + SourceIndex(0) +112>Emitted(1, 305) Source(27, 11) + SourceIndex(0) +113>Emitted(1, 306) Source(27, 12) + SourceIndex(0) +114>Emitted(1, 307) Source(28, 5) + SourceIndex(0) +115>Emitted(1, 313) Source(28, 11) + SourceIndex(0) +116>Emitted(1, 316) Source(28, 14) + SourceIndex(0) +117>Emitted(1, 317) Source(29, 5) + SourceIndex(0) +118>Emitted(1, 321) Source(29, 9) + SourceIndex(0) +119>Emitted(1, 326) Source(29, 14) + SourceIndex(0) +120>Emitted(1, 327) Source(29, 16) + SourceIndex(0) +121>Emitted(1, 333) Source(29, 22) + SourceIndex(0) +122>Emitted(1, 334) Source(29, 23) + SourceIndex(0) +123>Emitted(1, 337) Source(29, 27) + SourceIndex(0) +124>Emitted(1, 339) Source(29, 29) + SourceIndex(0) +125>Emitted(1, 340) Source(29, 30) + SourceIndex(0) +126>Emitted(1, 341) Source(30, 5) + SourceIndex(0) +127>Emitted(1, 348) Source(30, 12) + SourceIndex(0) +128>Emitted(1, 354) Source(30, 18) + SourceIndex(0) +129>Emitted(1, 360) Source(30, 24) + SourceIndex(0) +130>Emitted(1, 363) Source(31, 1) + SourceIndex(0) +131>Emitted(1, 364) Source(32, 1) + SourceIndex(0) +132>Emitted(1, 371) Source(32, 7) + SourceIndex(0) +133>Emitted(1, 380) Source(33, 1) + SourceIndex(0) +134>Emitted(1, 387) Source(33, 8) + SourceIndex(0) +135>Emitted(1, 394) Source(33, 15) + SourceIndex(0) +136>Emitted(1, 406) Source(33, 28) + SourceIndex(0) +137>Emitted(1, 407) Source(33, 29) + SourceIndex(0) +--- +>>>//# sourceMappingURL=keywords.js.map=================================================================== +JsFile: statements.js +mapUrl: statements.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/statements.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/statements.js +sourceFile:../tests/cases/conformance/removeWhitespace/statements.ts +------------------------------------------------------------------- +>>>obj;fn();function fn3(){obj;fn();function f(){}return;function g(){}} +1 > +2 >^^^ +3 > ^ +4 > ^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^^ +12> ^ +13> ^^^^^^^^^^^^^ +14> ^ +15> ^^^^^^^ +16> ^^^^^^^^^^^^^ +17> ^ +18> ^ +1 > +2 >obj +3 > ; + > +4 > fn +5 > (); + > +6 > ; + > +7 > function fn3() { + > +8 > obj +9 > ; + > +10> fn +11> (); + > +12> ; + > +13> function f() { +14> } + > +15> return; + > +16> function g() { +17> } + > +18> } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(2, 1) + SourceIndex(0) +4 >Emitted(1, 7) Source(2, 3) + SourceIndex(0) +5 >Emitted(1, 9) Source(3, 1) + SourceIndex(0) +6 >Emitted(1, 10) Source(4, 1) + SourceIndex(0) +7 >Emitted(1, 25) Source(5, 5) + SourceIndex(0) +8 >Emitted(1, 28) Source(5, 8) + SourceIndex(0) +9 >Emitted(1, 29) Source(6, 5) + SourceIndex(0) +10>Emitted(1, 31) Source(6, 7) + SourceIndex(0) +11>Emitted(1, 33) Source(7, 5) + SourceIndex(0) +12>Emitted(1, 34) Source(8, 5) + SourceIndex(0) +13>Emitted(1, 47) Source(8, 19) + SourceIndex(0) +14>Emitted(1, 48) Source(9, 5) + SourceIndex(0) +15>Emitted(1, 55) Source(10, 5) + SourceIndex(0) +16>Emitted(1, 68) Source(10, 19) + SourceIndex(0) +17>Emitted(1, 69) Source(11, 1) + SourceIndex(0) +18>Emitted(1, 70) Source(11, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=statements.js.map=================================================================== +JsFile: variables.js +mapUrl: variables.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/variables.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/variables.js +sourceFile:../tests/cases/conformance/removeWhitespace/variables.ts +------------------------------------------------------------------- +>>>var a=0,b,{c}=obj,[d]=obj;let e=0,f,{g}=obj,[h]=obj; +1 > +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^^^ +20> ^ +21> ^^^^ +22> ^ +23> ^ +24> ^ +25> ^ +26> ^ +27> ^ +28> ^ +29> ^ +30> ^ +31> ^ +32> ^^^ +33> ^ +34> ^ +35> ^ +36> ^ +37> ^ +38> ^^^ +39> ^ +1 > +2 >var +3 > a +4 > = +5 > 0 +6 > , +7 > b +8 > , +9 > { +10> c +11> } +12> = +13> obj +14> , +15> [ +16> d +17> ] +18> = +19> obj +20> ; + > +21> let +22> e +23> = +24> 0 +25> , +26> f +27> , +28> { +29> g +30> } +31> = +32> obj +33> , +34> [ +35> h +36> ] +37> = +38> obj +39> ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 7) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 8) Source(1, 10) + SourceIndex(0) +6 >Emitted(1, 9) Source(1, 12) + SourceIndex(0) +7 >Emitted(1, 10) Source(1, 13) + SourceIndex(0) +8 >Emitted(1, 11) Source(1, 15) + SourceIndex(0) +9 >Emitted(1, 12) Source(1, 17) + SourceIndex(0) +10>Emitted(1, 13) Source(1, 18) + SourceIndex(0) +11>Emitted(1, 14) Source(1, 20) + SourceIndex(0) +12>Emitted(1, 15) Source(1, 23) + SourceIndex(0) +13>Emitted(1, 18) Source(1, 26) + SourceIndex(0) +14>Emitted(1, 19) Source(1, 28) + SourceIndex(0) +15>Emitted(1, 20) Source(1, 29) + SourceIndex(0) +16>Emitted(1, 21) Source(1, 30) + SourceIndex(0) +17>Emitted(1, 22) Source(1, 31) + SourceIndex(0) +18>Emitted(1, 23) Source(1, 34) + SourceIndex(0) +19>Emitted(1, 26) Source(1, 37) + SourceIndex(0) +20>Emitted(1, 27) Source(2, 1) + SourceIndex(0) +21>Emitted(1, 31) Source(2, 5) + SourceIndex(0) +22>Emitted(1, 32) Source(2, 6) + SourceIndex(0) +23>Emitted(1, 33) Source(2, 9) + SourceIndex(0) +24>Emitted(1, 34) Source(2, 10) + SourceIndex(0) +25>Emitted(1, 35) Source(2, 12) + SourceIndex(0) +26>Emitted(1, 36) Source(2, 13) + SourceIndex(0) +27>Emitted(1, 37) Source(2, 15) + SourceIndex(0) +28>Emitted(1, 38) Source(2, 17) + SourceIndex(0) +29>Emitted(1, 39) Source(2, 18) + SourceIndex(0) +30>Emitted(1, 40) Source(2, 20) + SourceIndex(0) +31>Emitted(1, 41) Source(2, 23) + SourceIndex(0) +32>Emitted(1, 44) Source(2, 26) + SourceIndex(0) +33>Emitted(1, 45) Source(2, 28) + SourceIndex(0) +34>Emitted(1, 46) Source(2, 29) + SourceIndex(0) +35>Emitted(1, 47) Source(2, 30) + SourceIndex(0) +36>Emitted(1, 48) Source(2, 31) + SourceIndex(0) +37>Emitted(1, 49) Source(2, 34) + SourceIndex(0) +38>Emitted(1, 52) Source(2, 37) + SourceIndex(0) +39>Emitted(1, 53) Source(2, 38) + SourceIndex(0) +--- +>>>//# sourceMappingURL=variables.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespaceAndComments.outDir.symbols b/tests/baselines/reference/removeWhitespaceAndComments.outDir.symbols new file mode 100644 index 0000000000000..f4c1bbb7e293d --- /dev/null +++ b/tests/baselines/reference/removeWhitespaceAndComments.outDir.symbols @@ -0,0 +1,392 @@ +=== tests/cases/conformance/removeWhitespace/global.d.ts === +declare let obj: any, i: any, fn; +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>fn : Symbol(fn, Decl(global.d.ts, 0, 29)) + +=== tests/cases/conformance/removeWhitespace/propertyAccess.ts === +obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj .a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj. a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj . a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj. +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + a + +obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + .a + +obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + . + a + +obj // comment +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + . // comment + a // comment + +obj /* comment */ +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + . /* comment */ + a /* comment */ + +1..valueOf +>1..valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1.. valueOf +>1.. valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. .valueOf +>1. .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. . valueOf +>1. . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 .valueOf +>1 .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 . valueOf +>1 . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1.. +>1.. valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. +>1. .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + .valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. +>1. . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . + valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. // comment +>1. // comment . // comment valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . // comment + valueOf // comment +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. /* comment */ +>1. /* comment */ . /* comment */ valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . /* comment */ + valueOf /* comment */ +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 +>1 .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + .valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 +>1 . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . + valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 // comment +>1 // comment . // comment valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . // comment + valueOf // comment +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 /* comment */ +>1 /* comment */ . /* comment */ valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . /* comment */ + valueOf /* comment */ +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +=== tests/cases/conformance/removeWhitespace/elementAccess.ts === +obj["a"] +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj [ "a" ] +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj [ +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + "a" ] + +obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + [ + "a" + ] + +obj // comment +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + [ // comment + "a" // comment + ] // comment + +obj /* comment */ +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + [ /* comment */ + "a" /* comment */ + ] /* comment */ + +=== tests/cases/conformance/removeWhitespace/update.ts === +i + + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i + +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i + ++ i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i + ++i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ ++ i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ ++i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i ++ + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i ++ +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i++ + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i++ +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+++i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - -- i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - --i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- -- i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- --i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i -- - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i -- -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i-- - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i-- -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i---i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +=== tests/cases/conformance/removeWhitespace/switch.ts === +switch (i) { +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + + case 0: break; + case 1: break; + default: break; +} + +=== tests/cases/conformance/removeWhitespace/keywords.ts === +delete obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +delete (obj).a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +delete [][0] +void obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +void (obj).a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +void [][0] +typeof obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +typeof (obj).a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +typeof [][0] +function f1() { +>f1 : Symbol(f1, Decl(keywords.ts, 8, 12)) + + return typeof obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +} +async function* f2() { +>f2 : Symbol(f2, Decl(keywords.ts, 11, 1)) + + yield 1 + yield obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield (obj) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield [] + yield* [] + yield *[] + yield * [] + yield + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + + yield yield + yield typeof obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield void obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield delete obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + await 1 + await obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + for await (const x of []); +>x : Symbol(x, Decl(keywords.ts, 28, 20)) + + return yield await obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +} +export class C {} +>C : Symbol(C, Decl(keywords.ts, 30, 1)) + +export default function() {} + +=== tests/cases/conformance/removeWhitespace/statements.ts === +obj; +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +fn(); +>fn : Symbol(fn, Decl(global.d.ts, 0, 29)) + +; +function fn3() { +>fn3 : Symbol(fn3, Decl(statements.ts, 2, 1)) + + obj; +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + fn(); +>fn : Symbol(fn, Decl(global.d.ts, 0, 29)) + + ; + function f() {} +>f : Symbol(f, Decl(statements.ts, 6, 5)) + + return; + function g() {} +>g : Symbol(g, Decl(statements.ts, 8, 11)) +} + +=== tests/cases/conformance/removeWhitespace/variables.ts === +var a = 0, b, { c } = obj, [d] = obj; +>a : Symbol(a, Decl(variables.ts, 0, 3)) +>b : Symbol(b, Decl(variables.ts, 0, 10)) +>c : Symbol(c, Decl(variables.ts, 0, 15)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +>d : Symbol(d, Decl(variables.ts, 0, 28)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +let e = 0, f, { g } = obj, [h] = obj; +>e : Symbol(e, Decl(variables.ts, 1, 3)) +>f : Symbol(f, Decl(variables.ts, 1, 10)) +>g : Symbol(g, Decl(variables.ts, 1, 15)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +>h : Symbol(h, Decl(variables.ts, 1, 28)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + diff --git a/tests/baselines/reference/removeWhitespaceAndComments.outDir.types b/tests/baselines/reference/removeWhitespaceAndComments.outDir.types new file mode 100644 index 0000000000000..2d892d03e0490 --- /dev/null +++ b/tests/baselines/reference/removeWhitespaceAndComments.outDir.types @@ -0,0 +1,575 @@ +=== tests/cases/conformance/removeWhitespace/global.d.ts === +declare let obj: any, i: any, fn; +>obj : any +>i : any +>fn : any + +=== tests/cases/conformance/removeWhitespace/propertyAccess.ts === +obj.a +>obj.a : any +>obj : any +>a : any + +obj .a +>obj .a : any +>obj : any +>a : any + +obj. a +>obj. a : any +>obj : any +>a : any + +obj . a +>obj . a : any +>obj : any +>a : any + +obj. +>obj. a : any +>obj : any + + a +>a : any + +obj +>obj .a : any +>obj : any + + .a +>a : any + +obj +>obj . a : any +>obj : any + + . + a +>a : any + +obj // comment +>obj // comment . // comment a : any +>obj : any + + . // comment + a // comment +>a : any + +obj /* comment */ +>obj /* comment */ . /* comment */ a : any +>obj : any + + . /* comment */ + a /* comment */ +>a : any + +1..valueOf +>1..valueOf : () => number +>1. : 1 +>valueOf : () => number + +1.. valueOf +>1.. valueOf : () => number +>1. : 1 +>valueOf : () => number + +1. .valueOf +>1. .valueOf : () => number +>1. : 1 +>valueOf : () => number + +1. . valueOf +>1. . valueOf : () => number +>1. : 1 +>valueOf : () => number + +1 .valueOf +>1 .valueOf : () => number +>1 : 1 +>valueOf : () => number + +1 . valueOf +>1 . valueOf : () => number +>1 : 1 +>valueOf : () => number + +1.. +>1.. valueOf : () => number +>1. : 1 + + valueOf +>valueOf : () => number + +1. +>1. .valueOf : () => number +>1. : 1 + + .valueOf +>valueOf : () => number + +1. +>1. . valueOf : () => number +>1. : 1 + + . + valueOf +>valueOf : () => number + +1. // comment +>1. // comment . // comment valueOf : () => number +>1. : 1 + + . // comment + valueOf // comment +>valueOf : () => number + +1. /* comment */ +>1. /* comment */ . /* comment */ valueOf : () => number +>1. : 1 + + . /* comment */ + valueOf /* comment */ +>valueOf : () => number + +1 +>1 .valueOf : () => number +>1 : 1 + + .valueOf +>valueOf : () => number + +1 +>1 . valueOf : () => number +>1 : 1 + + . + valueOf +>valueOf : () => number + +1 // comment +>1 // comment . // comment valueOf : () => number +>1 : 1 + + . // comment + valueOf // comment +>valueOf : () => number + +1 /* comment */ +>1 /* comment */ . /* comment */ valueOf : () => number +>1 : 1 + + . /* comment */ + valueOf /* comment */ +>valueOf : () => number + +=== tests/cases/conformance/removeWhitespace/elementAccess.ts === +obj["a"] +>obj["a"] : any +>obj : any +>"a" : "a" + +obj [ "a" ] +>obj [ "a" ] : any +>obj : any +>"a" : "a" + +obj [ +>obj [ "a" ] : any +>obj : any + + "a" ] +>"a" : "a" + +obj +>obj [ "a" ] : any +>obj : any + + [ + "a" +>"a" : "a" + + ] + +obj // comment +>obj // comment [ // comment "a" // comment ] : any +>obj : any + + [ // comment + "a" // comment +>"a" : "a" + + ] // comment + +obj /* comment */ +>obj /* comment */ [ /* comment */ "a" /* comment */ ] : any +>obj : any + + [ /* comment */ + "a" /* comment */ +>"a" : "a" + + ] /* comment */ + +=== tests/cases/conformance/removeWhitespace/update.ts === +i + + i +>i + + i : any +>i : any +>+ i : number +>i : any + +i + +i +>i + +i : any +>i : any +>+i : number +>i : any + +i+ + i +>i+ + i : any +>i : any +>+ i : number +>i : any + +i+ +i +>i+ +i : any +>i : any +>+i : number +>i : any + +i + ++ i +>i + ++ i : any +>i : any +>++ i : number +>i : any + +i + ++i +>i + ++i : any +>i : any +>++i : number +>i : any + +i+ ++ i +>i+ ++ i : any +>i : any +>++ i : number +>i : any + +i+ ++i +>i+ ++i : any +>i : any +>++i : number +>i : any + +i ++ + i +>i ++ + i : any +>i ++ : number +>i : any +>i : any + +i ++ +i +>i ++ +i : any +>i ++ : number +>i : any +>i : any + +i++ + i +>i++ + i : any +>i++ : number +>i : any +>i : any + +i++ +i +>i++ +i : any +>i++ : number +>i : any +>i : any + +i+++i +>i+++i : any +>i++ : number +>i : any +>i : any + +i - - i +>i - - i : number +>i : any +>- i : number +>i : any + +i - -i +>i - -i : number +>i : any +>-i : number +>i : any + +i- - i +>i- - i : number +>i : any +>- i : number +>i : any + +i- -i +>i- -i : number +>i : any +>-i : number +>i : any + +i - -- i +>i - -- i : number +>i : any +>-- i : number +>i : any + +i - --i +>i - --i : number +>i : any +>--i : number +>i : any + +i- -- i +>i- -- i : number +>i : any +>-- i : number +>i : any + +i- --i +>i- --i : number +>i : any +>--i : number +>i : any + +i -- - i +>i -- - i : number +>i -- : number +>i : any +>i : any + +i -- -i +>i -- -i : number +>i -- : number +>i : any +>i : any + +i-- - i +>i-- - i : number +>i-- : number +>i : any +>i : any + +i-- -i +>i-- -i : number +>i-- : number +>i : any +>i : any + +i---i +>i---i : number +>i-- : number +>i : any +>i : any + +=== tests/cases/conformance/removeWhitespace/switch.ts === +switch (i) { +>i : any + + case 0: break; +>0 : 0 + + case 1: break; +>1 : 1 + + default: break; +} + +=== tests/cases/conformance/removeWhitespace/keywords.ts === +delete obj.a +>delete obj.a : boolean +>obj.a : any +>obj : any +>a : any + +delete (obj).a +>delete (obj).a : boolean +>(obj).a : any +>(obj) : any +>obj : any +>a : any + +delete [][0] +>delete [][0] : boolean +>[][0] : undefined +>[] : undefined[] +>0 : 0 + +void obj.a +>void obj.a : undefined +>obj.a : any +>obj : any +>a : any + +void (obj).a +>void (obj).a : undefined +>(obj).a : any +>(obj) : any +>obj : any +>a : any + +void [][0] +>void [][0] : undefined +>[][0] : undefined +>[] : undefined[] +>0 : 0 + +typeof obj.a +>typeof obj.a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>obj.a : any +>obj : any +>a : any + +typeof (obj).a +>typeof (obj).a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>(obj).a : any +>(obj) : any +>obj : any +>a : any + +typeof [][0] +>typeof [][0] : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>[][0] : undefined +>[] : undefined[] +>0 : 0 + +function f1() { +>f1 : () => "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" + + return typeof obj +>typeof obj : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>obj : any +} +async function* f2() { +>f2 : () => AsyncIterableIterator + + yield 1 +>yield 1 : any +>1 : 1 + + yield obj +>yield obj : any +>obj : any + + yield (obj) +>yield (obj) : any +>(obj) : any +>obj : any + + yield [] +>yield [] : any +>[] : undefined[] + + yield* [] +>yield* [] : any +>[] : undefined[] + + yield *[] +>yield *[] : any +>[] : undefined[] + + yield * [] +>yield * [] : any +>[] : undefined[] + + yield +>yield : any + + i +>i : any + + yield yield +>yield yield : any +>yield : any + + yield typeof obj +>yield typeof obj : any +>typeof obj : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>obj : any + + yield void obj +>yield void obj : any +>void obj : undefined +>obj : any + + yield delete obj.a +>yield delete obj.a : any +>delete obj.a : boolean +>obj.a : any +>obj : any +>a : any + + await 1 +>await 1 : 1 +>1 : 1 + + await obj +>await obj : any +>obj : any + + for await (const x of []); +>x : any +>[] : undefined[] + + return yield await obj +>yield await obj : any +>await obj : any +>obj : any +} +export class C {} +>C : C + +export default function() {} + +=== tests/cases/conformance/removeWhitespace/statements.ts === +obj; +>obj : any + +fn(); +>fn() : any +>fn : any + +; +function fn3() { +>fn3 : () => void + + obj; +>obj : any + + fn(); +>fn() : any +>fn : any + + ; + function f() {} +>f : () => void + + return; + function g() {} +>g : () => void +} + +=== tests/cases/conformance/removeWhitespace/variables.ts === +var a = 0, b, { c } = obj, [d] = obj; +>a : number +>0 : 0 +>b : any +>c : any +>obj : any +>d : any +>obj : any + +let e = 0, f, { g } = obj, [h] = obj; +>e : number +>0 : 0 +>f : any +>g : any +>obj : any +>h : any +>obj : any + diff --git a/tests/cases/conformance/removeWhitespace/removeWhitespace.outDir.ts b/tests/cases/conformance/removeWhitespace/removeWhitespace.outDir.ts new file mode 100644 index 0000000000000..54406e64b12d3 --- /dev/null +++ b/tests/cases/conformance/removeWhitespace/removeWhitespace.outDir.ts @@ -0,0 +1,191 @@ +// @target: esnext +// @module: esnext +// @removeWhiteSpace: true +// @sourceMap: true +// @outDir: dist +// @filename: global.d.ts +declare let obj: any, i: any, fn; + +// @filename: propertyAccess.ts +obj.a +obj .a +obj. a +obj . a + +obj. + a + +obj + .a + +obj + . + a + +obj // comment + . // comment + a // comment + +obj /* comment */ + . /* comment */ + a /* comment */ + +1..valueOf +1.. valueOf +1. .valueOf +1. . valueOf +1 .valueOf +1 . valueOf + +1.. + valueOf + +1. + .valueOf + +1. + . + valueOf + +1. // comment + . // comment + valueOf // comment + +1. /* comment */ + . /* comment */ + valueOf /* comment */ + +1 + .valueOf + +1 + . + valueOf + +1 // comment + . // comment + valueOf // comment + +1 /* comment */ + . /* comment */ + valueOf /* comment */ + +// @filename: elementAccess.ts +obj["a"] +obj [ "a" ] + +obj [ + "a" ] + +obj + [ + "a" + ] + +obj // comment + [ // comment + "a" // comment + ] // comment + +obj /* comment */ + [ /* comment */ + "a" /* comment */ + ] /* comment */ + +// @filename: update.ts +i + + i +i + +i +i+ + i +i+ +i + +i + ++ i +i + ++i +i+ ++ i +i+ ++i + +i ++ + i +i ++ +i +i++ + i +i++ +i +i+++i + +i - - i +i - -i +i- - i +i- -i + +i - -- i +i - --i +i- -- i +i- --i + +i -- - i +i -- -i +i-- - i +i-- -i +i---i + +// @filename: switch.ts +switch (i) { + case 0: break; + case 1: break; + default: break; +} + +// @filename: keywords.ts +delete obj.a +delete (obj).a +delete [][0] +void obj.a +void (obj).a +void [][0] +typeof obj.a +typeof (obj).a +typeof [][0] +function f1() { + return typeof obj +} +async function* f2() { + yield 1 + yield obj + yield (obj) + yield [] + yield* [] + yield *[] + yield * [] + yield + i + yield yield + yield typeof obj + yield void obj + yield delete obj.a + await 1 + await obj + for await (const x of []); + return yield await obj +} +export class C {} +export default function() {} + +// @filename: statements.ts +obj; +fn(); +; +function fn3() { + obj; + fn(); + ; + function f() {} + return; + function g() {} +} + +// @filename: variables.ts +var a = 0, b, { c } = obj, [d] = obj; +let e = 0, f, { g } = obj, [h] = obj; + +// @filename: for.ts +for(;;){} + +// @filename: embeddedStatement.ts +{while(true);} \ No newline at end of file diff --git a/tests/cases/conformance/removeWhitespace/removeWhitespace.outFile.ts b/tests/cases/conformance/removeWhitespace/removeWhitespace.outFile.ts new file mode 100644 index 0000000000000..076eea11b7cd0 --- /dev/null +++ b/tests/cases/conformance/removeWhitespace/removeWhitespace.outFile.ts @@ -0,0 +1,16 @@ +// @target: esnext +// @module: esnext +// @removeWhiteSpace: true +// @sourceMap: true +// @outFile: combined.js +// @filename: a.ts +let a = 1; + +// @filename: b.ts +let b = 2; + +// @filename: c.ts +class C {} + +// @filename: d.ts +function d() {} diff --git a/tests/cases/conformance/removeWhitespace/removeWhitespaceAndComments.outDir.ts b/tests/cases/conformance/removeWhitespace/removeWhitespaceAndComments.outDir.ts new file mode 100644 index 0000000000000..4ac4ca251447f --- /dev/null +++ b/tests/cases/conformance/removeWhitespace/removeWhitespaceAndComments.outDir.ts @@ -0,0 +1,186 @@ +// @target: esnext +// @module: esnext +// @removeWhiteSpace: true +// @removeComments: true +// @sourceMap: true +// @outDir: dist +// @filename: global.d.ts +declare let obj: any, i: any, fn; + +// @filename: propertyAccess.ts +obj.a +obj .a +obj. a +obj . a + +obj. + a + +obj + .a + +obj + . + a + +obj // comment + . // comment + a // comment + +obj /* comment */ + . /* comment */ + a /* comment */ + +1..valueOf +1.. valueOf +1. .valueOf +1. . valueOf +1 .valueOf +1 . valueOf + +1.. + valueOf + +1. + .valueOf + +1. + . + valueOf + +1. // comment + . // comment + valueOf // comment + +1. /* comment */ + . /* comment */ + valueOf /* comment */ + +1 + .valueOf + +1 + . + valueOf + +1 // comment + . // comment + valueOf // comment + +1 /* comment */ + . /* comment */ + valueOf /* comment */ + +// @filename: elementAccess.ts +obj["a"] +obj [ "a" ] + +obj [ + "a" ] + +obj + [ + "a" + ] + +obj // comment + [ // comment + "a" // comment + ] // comment + +obj /* comment */ + [ /* comment */ + "a" /* comment */ + ] /* comment */ + +// @filename: update.ts +i + + i +i + +i +i+ + i +i+ +i + +i + ++ i +i + ++i +i+ ++ i +i+ ++i + +i ++ + i +i ++ +i +i++ + i +i++ +i +i+++i + +i - - i +i - -i +i- - i +i- -i + +i - -- i +i - --i +i- -- i +i- --i + +i -- - i +i -- -i +i-- - i +i-- -i +i---i + +// @filename: switch.ts +switch (i) { + case 0: break; + case 1: break; + default: break; +} + +// @filename: keywords.ts +delete obj.a +delete (obj).a +delete [][0] +void obj.a +void (obj).a +void [][0] +typeof obj.a +typeof (obj).a +typeof [][0] +function f1() { + return typeof obj +} +async function* f2() { + yield 1 + yield obj + yield (obj) + yield [] + yield* [] + yield *[] + yield * [] + yield + i + yield yield + yield typeof obj + yield void obj + yield delete obj.a + await 1 + await obj + for await (const x of []); + return yield await obj +} +export class C {} +export default function() {} + +// @filename: statements.ts +obj; +fn(); +; +function fn3() { + obj; + fn(); + ; + function f() {} + return; + function g() {} +} + +// @filename: variables.ts +var a = 0, b, { c } = obj, [d] = obj; +let e = 0, f, { g } = obj, [h] = obj; \ No newline at end of file From ba2e4dc866f8bc9912b05ff60d0edf60f4337646 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 6 Jul 2018 17:29:42 -0700 Subject: [PATCH 04/10] PR Feedback --- src/compiler/emitter.ts | 10 ++-------- src/compiler/sourcemap.ts | 9 +++++---- src/compiler/sourcemapDecoder.ts | 16 +++------------- src/compiler/types.ts | 6 +++--- src/services/sourcemaps.ts | 12 +++--------- 5 files changed, 16 insertions(+), 37 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 29a1077815a32..87b425f6ed404 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -461,7 +461,7 @@ namespace ts { emitSyntheticTripleSlashReferencesIfNeeded(bundle); for (const prepend of bundle.prepends) { - writeSignificantLine(); + writeLine(); print(EmitHint.Unspecified, prepend, /*sourceFile*/ undefined); } @@ -2613,7 +2613,7 @@ namespace ts { // generated line. Until we can rework the source map support in the test // harness, ensure each source file is on a new line, even when using a // whitespace-removing writer. - writeSignificantLine(); + writeLine(); const statements = node.statements; if (emitBodyWithDetachedComments) { // Emit detached comment if there are no prologue directives or if the first node is synthesized. @@ -3111,12 +3111,6 @@ namespace ts { writer.writeProperty(s); } - function writeSignificantLine() { - // writer.flush(); - // if (!writer.isAtStartOfLine()) writer.rawWrite(newLine); - writeLine(); - } - function writeLine() { writer.writeLine(); } diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index db474f6049abe..88d09ae691551 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -655,12 +655,12 @@ namespace ts { && typeof x.file === "string" && typeof x.mappings === "string" && isArray(x.sources) && every(x.sources, isString) - && (x.sourceRoot === undefined || typeof x.sourceRoot === "string") - && (x.sourcesContent === undefined || isArray(x.sourcesContent) && every(x.sourcesContent, isStringOrNull)) - && (x.names === undefined || isArray(x.names) && every(x.names, isString)); + && (x.sourceRoot === undefined || x.sourceRoot === null || typeof x.sourceRoot === "string") + && (x.sourcesContent === undefined || x.sourcesContent === null || isArray(x.sourcesContent) && every(x.sourcesContent, isStringOrNull)) + && (x.names === undefined || x.names === null || isArray(x.names) && every(x.names, isString)); } - function tryParseRawSourceMap(text: string) { + export function tryParseRawSourceMap(text: string) { try { const parsed = JSON.parse(text); if (isRawSourceMap(parsed)) { @@ -673,6 +673,7 @@ namespace ts { return undefined; } + const base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; function base64FormatEncode(inValue: number) { diff --git a/src/compiler/sourcemapDecoder.ts b/src/compiler/sourcemapDecoder.ts index 4248ac21829a4..5dae6dbd3b7c5 100644 --- a/src/compiler/sourcemapDecoder.ts +++ b/src/compiler/sourcemapDecoder.ts @@ -30,16 +30,6 @@ namespace ts { /* @internal */ namespace ts.sourcemaps { - export interface SourceMapData { - version?: number; - file?: string; - sourceRoot?: string; - sources: string[]; - sourcesContent?: (string | null)[]; - names?: string[]; - mappings: string; - } - export interface SourceMappableLocation { fileName: string; position: number; @@ -59,7 +49,7 @@ namespace ts.sourcemaps { log(text: string): void; } - export function decode(host: SourceMapDecodeHost, mapPath: string, map: SourceMapData, program?: Program, fallbackCache = createSourceFileLikeCache(host)): SourceMapper { + export function decode(host: SourceMapDecodeHost, mapPath: string, map: RawSourceMap, program?: Program, fallbackCache = createSourceFileLikeCache(host)): SourceMapper { const currentDirectory = getDirectoryPath(mapPath); const sourceRoot = map.sourceRoot || currentDirectory; let decodedMappings: ProcessedSourceMapPosition[]; @@ -156,7 +146,7 @@ namespace ts.sourcemaps { } /*@internal*/ - export function decodeMappings(map: SourceMapData): MappingsDecoder { + export function decodeMappings(map: RawSourceMap): MappingsDecoder { const state: DecoderState = { encodedText: map.mappings, currentNameIndex: undefined, @@ -190,7 +180,7 @@ namespace ts.sourcemaps { }; } - function calculateDecodedMappings(map: SourceMapData, processPosition: (position: RawSourceMapPosition) => T, host?: { log?(s: string): void }): T[] { + function calculateDecodedMappings(map: RawSourceMap, processPosition: (position: RawSourceMapPosition) => T, host?: { log?(s: string): void }): T[] { const decoder = decodeMappings(map); const positions = arrayFrom(decoder, processPosition); if (decoder.error) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 95dada4d2effa..32a64ee97fd5c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5293,11 +5293,11 @@ namespace ts { export interface RawSourceMap { version: 3; file: string; - sourceRoot?: string; + sourceRoot?: string | null; sources: string[]; - sourcesContent?: (string | null)[]; + sourcesContent?: (string | null)[] | null; mappings: string; - names?: string[]; + names?: string[] | null; } /** diff --git a/src/services/sourcemaps.ts b/src/services/sourcemaps.ts index f617d879893a2..be825564a7768 100644 --- a/src/services/sourcemaps.ts +++ b/src/services/sourcemaps.ts @@ -41,14 +41,8 @@ namespace ts { } function convertDocumentToSourceMapper(file: { sourceMapper?: sourcemaps.SourceMapper }, contents: string, mapFileName: string) { - let maps: sourcemaps.SourceMapData | undefined; - try { - maps = JSON.parse(contents); - } - catch { - // swallow error - } - if (!maps || !maps.sources || !maps.file || !maps.mappings) { + const map = tryParseRawSourceMap(contents); + if (!map || !map.sources || !map.file || !map.mappings) { // obviously invalid map return file.sourceMapper = sourcemaps.identitySourceMapper; } @@ -57,7 +51,7 @@ namespace ts { fileExists: s => host.fileExists!(s), // TODO: GH#18217 getCanonicalFileName, log, - }, mapFileName, maps, getProgram(), sourcemappedFileCache); + }, mapFileName, map, getProgram(), sourcemappedFileCache); } function getSourceMapper(fileName: string, file: SourceFileLike): sourcemaps.SourceMapper { From 9e9c6a01adeb10a13fab96b108bff4e79627ff92 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 6 Jul 2018 17:41:18 -0700 Subject: [PATCH 05/10] Fix argument to decodeMappings --- src/compiler/sourcemapDecoder.ts | 2 +- src/harness/sourceMapRecorder.ts | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/compiler/sourcemapDecoder.ts b/src/compiler/sourcemapDecoder.ts index 5dae6dbd3b7c5..b09b919e0e014 100644 --- a/src/compiler/sourcemapDecoder.ts +++ b/src/compiler/sourcemapDecoder.ts @@ -146,7 +146,7 @@ namespace ts.sourcemaps { } /*@internal*/ - export function decodeMappings(map: RawSourceMap): MappingsDecoder { + export function decodeMappings(map: Pick): MappingsDecoder { const state: DecoderState = { encodedText: map.mappings, currentNameIndex: undefined, diff --git a/src/harness/sourceMapRecorder.ts b/src/harness/sourceMapRecorder.ts index 78a71ba9fb6f7..65236e78cb7bd 100644 --- a/src/harness/sourceMapRecorder.ts +++ b/src/harness/sourceMapRecorder.ts @@ -19,11 +19,7 @@ namespace Harness.SourceMapRecorder { decodingIndex = 0; sourceMapMappings = sourceMapData.sourceMapMappings; mappings = ts.sourcemaps.decodeMappings({ - version: 3, - file: sourceMapData.sourceMapFile, sources: sourceMapData.sourceMapSources, - sourceRoot: sourceMapData.sourceMapSourceRoot, - sourcesContent: sourceMapData.sourceMapSourcesContent, mappings: sourceMapData.sourceMapMappings, names: sourceMapData.sourceMapNames }); From c01783ce6834d8c193f986afaa8fa264b90ee6d6 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 6 Jul 2018 17:50:13 -0700 Subject: [PATCH 06/10] Ensure new line between js and map files in tests --- src/harness/harness.ts | 4 ++++ .../reference/declarationMapsMultifile.js.map | 3 ++- .../declarationMapsWithSourceMap.js.map | 3 ++- .../reference/jsxFactoryIdentifier.js | 3 ++- .../reference/jsxFactoryIdentifier.js.map | 3 ++- .../reference/jsxFactoryQualifiedName.js | 3 ++- .../reference/jsxFactoryQualifiedName.js.map | 3 ++- .../reference/removeWhitespace.outDir.js | 24 ++++++++++++------- .../reference/removeWhitespace.outDir.js.map | 24 ++++++++++++------- .../removeWhitespaceAndComments.outDir.js | 18 +++++++++----- .../removeWhitespaceAndComments.outDir.js.map | 18 +++++++++----- ...eMapWithCaseSensitiveFileNamesAndOutDir.js | 3 ++- ...WithCaseSensitiveFileNamesAndOutDir.js.map | 3 ++- ...pWithNonCaseSensitiveFileNamesAndOutDir.js | 3 ++- ...hNonCaseSensitiveFileNamesAndOutDir.js.map | 3 ++- 15 files changed, 80 insertions(+), 38 deletions(-) diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 4afe48999d1b0..8cf73f2dc711b 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1649,6 +1649,7 @@ namespace Harness { let sourceMapCode = ""; result.maps.forEach(sourceMap => { + if (sourceMapCode) sourceMapCode += "\r\n"; sourceMapCode += fileOutput(sourceMap, harnessSettings); }); @@ -1676,6 +1677,9 @@ namespace Harness { let jsCode = ""; result.js.forEach(file => { + if (jsCode.length && jsCode.charCodeAt(jsCode.length - 1) !== ts.CharacterCodes.lineFeed) { + jsCode += "\r\n"; + } jsCode += fileOutput(file, harnessSettings); }); diff --git a/tests/baselines/reference/declarationMapsMultifile.js.map b/tests/baselines/reference/declarationMapsMultifile.js.map index cf1f1472a6081..80d8ac624c64a 100644 --- a/tests/baselines/reference/declarationMapsMultifile.js.map +++ b/tests/baselines/reference/declarationMapsMultifile.js.map @@ -1,3 +1,4 @@ //// [a.d.ts.map] -{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,OAAO,CAAC,CAAC,EAAE;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC;;;IAGtB,MAAM,CAAC,IAAI;CAGd"}//// [index.d.ts.map] +{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,OAAO,CAAC,CAAC,EAAE;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC;;;IAGtB,MAAM,CAAC,IAAI;CAGd"} +//// [index.d.ts.map] {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,CAAC,KAAY,CAAC;AAGpB,eAAO,IAAI,CAAC;;CAAqB,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/declarationMapsWithSourceMap.js.map b/tests/baselines/reference/declarationMapsWithSourceMap.js.map index 41114d427d00e..9a442371965dd 100644 --- a/tests/baselines/reference/declarationMapsWithSourceMap.js.map +++ b/tests/baselines/reference/declarationMapsWithSourceMap.js.map @@ -1,3 +1,4 @@ //// [bundle.js.map] -{"version":3,"file":"bundle.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/index.ts"],"names":[],"mappings":"AAAA;IAAA;IAOA,CAAC;IANG,qBAAO,GAAP,UAAQ,CAAc;QAClB,OAAO,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,CAAC;IACpB,CAAC;IACM,QAAI,GAAX;QACI,OAAO,IAAI,GAAG,EAAE,CAAC;IACrB,CAAC;IACL,UAAC;AAAD,CAAC,AAPD,IAOC;ACPD,IAAM,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;AACpB,CAAC,CAAC,OAAO,CAAC,EAAC,CAAC,EAAE,EAAE,EAAC,CAAC,CAAC;AAEnB,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAC,CAAC,EAAE,EAAE,EAAC,CAAC,CAAC"}//// [bundle.d.ts.map] +{"version":3,"file":"bundle.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/index.ts"],"names":[],"mappings":"AAAA;IAAA;IAOA,CAAC;IANG,qBAAO,GAAP,UAAQ,CAAc;QAClB,OAAO,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,CAAC;IACpB,CAAC;IACM,QAAI,GAAX;QACI,OAAO,IAAI,GAAG,EAAE,CAAC;IACrB,CAAC;IACL,UAAC;AAAD,CAAC,AAPD,IAOC;ACPD,IAAM,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;AACpB,CAAC,CAAC,OAAO,CAAC,EAAC,CAAC,EAAE,EAAE,EAAC,CAAC,CAAC;AAEnB,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAC,CAAC,EAAE,EAAE,EAAC,CAAC,CAAC"} +//// [bundle.d.ts.map] {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/index.ts"],"names":[],"mappings":"AAAA,cAAM,GAAG;IACL,OAAO,CAAC,GAAG;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC;;;IAGtB,MAAM,CAAC,IAAI;CAGd;ACPD,QAAA,MAAM,CAAC,KAAY,CAAC;AAGpB,QAAA,IAAI,CAAC;;CAAqB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/jsxFactoryIdentifier.js b/tests/baselines/reference/jsxFactoryIdentifier.js index 817ef769d5304..a5ed7e66035fd 100644 --- a/tests/baselines/reference/jsxFactoryIdentifier.js +++ b/tests/baselines/reference/jsxFactoryIdentifier.js @@ -68,7 +68,8 @@ exports.createElement = Element.createElement; function toCamelCase(text) { return text[0].toLowerCase() + text.substring(1); } -//# sourceMappingURL=Element.js.map//// [test.js] +//# sourceMappingURL=Element.js.map +//// [test.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Element_1 = require("./Element"); diff --git a/tests/baselines/reference/jsxFactoryIdentifier.js.map b/tests/baselines/reference/jsxFactoryIdentifier.js.map index ea0db5040efbc..5ecfbe9d87ec4 100644 --- a/tests/baselines/reference/jsxFactoryIdentifier.js.map +++ b/tests/baselines/reference/jsxFactoryIdentifier.js.map @@ -1,3 +1,4 @@ //// [Element.js.map] -{"version":3,"file":"Element.js","sourceRoot":"","sources":["Element.ts"],"names":[],"mappings":";;AAYA,IAAiB,OAAO,CAUvB;AAVD,WAAiB,OAAO;IACpB,SAAgB,SAAS,CAAC,EAAO;QAC7B,OAAO,EAAE,CAAC,wBAAwB,KAAK,SAAS,CAAC;IACrD,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,SAAgB,aAAa,CAAC,IAAW;QAErC,OAAO,EACN,CAAA;IACL,CAAC;IAJe,qBAAa,gBAI5B,CAAA;AACL,CAAC,EAVgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAUvB;AAEU,QAAA,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEjD,SAAS,WAAW,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"}//// [test.js.map] +{"version":3,"file":"Element.js","sourceRoot":"","sources":["Element.ts"],"names":[],"mappings":";;AAYA,IAAiB,OAAO,CAUvB;AAVD,WAAiB,OAAO;IACpB,SAAgB,SAAS,CAAC,EAAO;QAC7B,OAAO,EAAE,CAAC,wBAAwB,KAAK,SAAS,CAAC;IACrD,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,SAAgB,aAAa,CAAC,IAAW;QAErC,OAAO,EACN,CAAA;IACL,CAAC;IAJe,qBAAa,gBAI5B,CAAA;AACL,CAAC,EAVgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAUvB;AAEU,QAAA,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEjD,SAAS,WAAW,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"} +//// [test.js.map] {"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAAA,uCAAmC;AACnC,IAAI,aAAa,GAAG,iBAAO,CAAC,aAAa,CAAC;AAC1C,IAAI,CAIH,CAAC;AAEF,MAAM,CAAC;IACN,IAAI;QACH,OAAO;YACN,wBAAM,OAAO,EAAC,YAAY,GAAQ;YAClC,wBAAM,OAAO,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,GAAS;SAC9B,CAAC;IACH,CAAC;CACD"} \ No newline at end of file diff --git a/tests/baselines/reference/jsxFactoryQualifiedName.js b/tests/baselines/reference/jsxFactoryQualifiedName.js index 63b45e878dd0f..14906d7a08770 100644 --- a/tests/baselines/reference/jsxFactoryQualifiedName.js +++ b/tests/baselines/reference/jsxFactoryQualifiedName.js @@ -67,7 +67,8 @@ exports.createElement = Element.createElement; function toCamelCase(text) { return text[0].toLowerCase() + text.substring(1); } -//# sourceMappingURL=Element.js.map//// [test.js] +//# sourceMappingURL=Element.js.map +//// [test.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Element_1 = require("./Element"); diff --git a/tests/baselines/reference/jsxFactoryQualifiedName.js.map b/tests/baselines/reference/jsxFactoryQualifiedName.js.map index 4767276bd1039..619537c50ef26 100644 --- a/tests/baselines/reference/jsxFactoryQualifiedName.js.map +++ b/tests/baselines/reference/jsxFactoryQualifiedName.js.map @@ -1,3 +1,4 @@ //// [Element.js.map] -{"version":3,"file":"Element.js","sourceRoot":"","sources":["Element.ts"],"names":[],"mappings":";;AAYA,IAAiB,OAAO,CAUvB;AAVD,WAAiB,OAAO;IACpB,SAAgB,SAAS,CAAC,EAAO;QAC7B,OAAO,EAAE,CAAC,wBAAwB,KAAK,SAAS,CAAC;IACrD,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,SAAgB,aAAa,CAAC,IAAW;QAErC,OAAO,EACN,CAAA;IACL,CAAC;IAJe,qBAAa,gBAI5B,CAAA;AACL,CAAC,EAVgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAUvB;AAEU,QAAA,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEjD,SAAS,WAAW,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"}//// [test.js.map] +{"version":3,"file":"Element.js","sourceRoot":"","sources":["Element.ts"],"names":[],"mappings":";;AAYA,IAAiB,OAAO,CAUvB;AAVD,WAAiB,OAAO;IACpB,SAAgB,SAAS,CAAC,EAAO;QAC7B,OAAO,EAAE,CAAC,wBAAwB,KAAK,SAAS,CAAC;IACrD,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,SAAgB,aAAa,CAAC,IAAW;QAErC,OAAO,EACN,CAAA;IACL,CAAC;IAJe,qBAAa,gBAI5B,CAAA;AACL,CAAC,EAVgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAUvB;AAEU,QAAA,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEjD,SAAS,WAAW,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"} +//// [test.js.map] {"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAAA,uCAAmC;AAEnC,IAAI,CAIH,CAAC;AAEF,MAAM,CAAC;IACN,IAAI;QACH,OAAO;YACN,0CAAM,OAAO,EAAC,YAAY,GAAQ;YAClC,0CAAM,OAAO,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,GAAS;SAC9B,CAAC;IACH,CAAC;CACD"} \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outDir.js b/tests/baselines/reference/removeWhitespace.outDir.js index 9d52cc233859e..edd726321e9ca 100644 --- a/tests/baselines/reference/removeWhitespace.outDir.js +++ b/tests/baselines/reference/removeWhitespace.outDir.js @@ -200,24 +200,32 @@ valueOf;// comment .// comment valueOf;// comment 1/* comment */./* comment */valueOf;/* comment */ -//# sourceMappingURL=propertyAccess.js.map//// [elementAccess.js] +//# sourceMappingURL=propertyAccess.js.map +//// [elementAccess.js] obj["a"];obj["a"];obj["a"];obj["a"];obj// comment [// comment "a"// comment ];// comment obj/* comment */[/* comment */"a"/* comment */];/* comment */ -//# sourceMappingURL=elementAccess.js.map//// [update.js] +//# sourceMappingURL=elementAccess.js.map +//// [update.js] i+ +i;i+ +i;i+ +i;i+ +i;i+ ++i;i+ ++i;i+ ++i;i+ ++i;i+++i;i+++i;i+++i;i+++i;i+++i;i- -i;i- -i;i- -i;i- -i;i- --i;i- --i;i- --i;i- --i;i---i;i---i;i---i;i---i;i---i; -//# sourceMappingURL=update.js.map//// [switch.js] +//# sourceMappingURL=update.js.map +//// [switch.js] switch(i){case 0:break;case 1:break;default:break} -//# sourceMappingURL=switch.js.map//// [keywords.js] +//# sourceMappingURL=switch.js.map +//// [keywords.js] delete obj.a;delete(obj).a;delete[][0];void obj.a;void(obj).a;void[][0];typeof obj.a;typeof(obj).a;typeof[][0];function f1(){return typeof obj}async function*f2(){yield 1;yield obj;yield(obj);yield[];yield*[];yield*[];yield*[];yield;i;yield yield;yield typeof obj;yield void obj;yield delete obj.a;await 1;await obj;for await(const x of[]);return yield await obj}export class C{}export default function(){} -//# sourceMappingURL=keywords.js.map//// [statements.js] +//# sourceMappingURL=keywords.js.map +//// [statements.js] obj;fn();function fn3(){obj;fn();function f(){}return;function g(){}} -//# sourceMappingURL=statements.js.map//// [variables.js] +//# sourceMappingURL=statements.js.map +//// [variables.js] var a=0,b,{c}=obj,[d]=obj;let e=0,f,{g}=obj,[h]=obj; -//# sourceMappingURL=variables.js.map//// [for.js] +//# sourceMappingURL=variables.js.map +//// [for.js] for(;;){} -//# sourceMappingURL=for.js.map//// [embeddedStatement.js] +//# sourceMappingURL=for.js.map +//// [embeddedStatement.js] {while(true);} //# sourceMappingURL=embeddedStatement.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outDir.js.map b/tests/baselines/reference/removeWhitespace.outDir.js.map index 6e46b679c0b3b..2a8e9eefc99e4 100644 --- a/tests/baselines/reference/removeWhitespace.outDir.js.map +++ b/tests/baselines/reference/removeWhitespace.outDir.js.map @@ -1,10 +1,18 @@ //// [propertyAccess.js.map] -{"version":3,"file":"propertyAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/propertyAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAC,CACL,GAAG,CAAE,CAAC,CACN,GAAG,CAAE,CAAC,CACN,GAAG,CAAG,CAAC,CAEP,GAAG,CACC,CAAC,CAEL,GAAG,CACE,CAAC,CAEN,GAAG,CAEC,CAAC,CAEL,GAAI,UAAU;CACR,UAAU;AACZ,CAAC,CAAC,UAAU;AAEhB,GAAI,aAAa,CACX,aACF,CAAC,CAAC,aAAa;AAEnB,EAAE,CAAC,OAAO,CACV,EAAE,CAAE,OAAO,CACX,EAAE,CAAE,OAAO,CACX,EAAE,CAAG,OAAO,CACZ,CAAC,EAAE,OAAO,CACV,CAAC,EAAG,OAAO,CAEX,EAAE,CACE,OAAO,CAEX,EAAE,CACG,OAAO,CAEZ,EAAE,CAEE,OAAO,CAEX,EAAG,UAAU;CACP,UAAU;AACZ,OAAO,CAAC,UAAU;AAEtB,EAAG,aAAa,CACV,aACF,OAAO,CAAC,aAAa;AAEzB,CAAC,EACI,OAAO,CAEZ,CAAC,EAEG,OAAO,CAEX,CAAE,UAAU;CACN,UAAU;AACZ,OAAO,CAAC,UAAU;AAEtB,CAAE,aAAa,CACT,aACF,OAAO,CAAC,aAAa"}//// [elementAccess.js.map] -{"version":3,"file":"elementAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/elementAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,GAAG,CAAC,CACR,GAAG,CAAG,GAAG,CAAE,CAEX,GAAG,CACC,GAAG,CAAE,CAET,GAAG,CAEC,GAAG,CACF,CAEL,GAAI,UAAU;CACR,UAAU;AACZ,GAAI,UAAU;CACb,CAAC,UAAU;AAEhB,GAAI,aAAa,CACX,aACF,GAAI,aAAa,CAChB,CAAC,aAAa"}//// [update.js.map] -{"version":3,"file":"update.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/update.ts"],"names":[],"mappings":"AAAA,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAAA"}//// [switch.js.map] -{"version":3,"file":"switch.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/switch.ts"],"names":[],"mappings":"AAAA,OAAQ,CAAC,CAAE,CACP,KAAK,CAAC,CAAE,MACR,KAAK,CAAC,CAAE,MACR,OAAO,CAAE,KAAM,CAClB"}//// [keywords.js.map] -{"version":3,"file":"keywords.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/keywords.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,KAAK,GAAG,CAAC,CAAC,CACV,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CACZ,IAAK,EAAE,CAAC,CAAC,CAAC,CACV,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,SAAS,EAAE,GACP,OAAO,OAAO,GAClB,CACA,MAAK,QAAS,CAAE,EAAE,GACd,MAAM,CAAC,CACP,MAAM,GAAG,CACT,KAAM,CAAC,GAAG,CAAC,CACX,KAAM,EAAE,CACR,KAAK,CAAE,EAAE,CACT,KAAM,CAAC,EAAE,CACT,KAAM,CAAE,EAAE,CACV,KAAK,CACL,CAAC,CACD,MAAM,KAAK,CACX,MAAM,OAAO,GAAG,CAChB,MAAM,KAAK,GAAG,CACd,MAAM,OAAO,GAAG,CAAC,CAAC,CAClB,MAAM,CAAC,CACP,MAAM,GAAG,CACT,IAAI,KAAK,CAAE,MAAM,CAAC,GAAI,EAAE,CAAC,CACzB,OAAO,MAAM,MAAM,GACvB,CACA,OAAM,MAAO,CAAC,EACd,OAAO,OAAO,YAAa,CAAC"}//// [statements.js.map] -{"version":3,"file":"statements.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/statements.ts"],"names":[],"mappings":"AAAA,GAAG,CACH,EAAE,EACF,CACA,SAAS,GAAG,GACR,GAAG,CACH,EAAE,EACF,CACA,SAAS,CAAC,GAAI,CACd,OACA,SAAS,CAAC,GAAI,CAClB,CAAC"}//// [variables.js.map] -{"version":3,"file":"variables.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/variables.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CACpC,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CAAC"}//// [for.js.map] -{"version":3,"file":"for.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/for.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE"}//// [embeddedStatement.js.map] +{"version":3,"file":"propertyAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/propertyAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAC,CACL,GAAG,CAAE,CAAC,CACN,GAAG,CAAE,CAAC,CACN,GAAG,CAAG,CAAC,CAEP,GAAG,CACC,CAAC,CAEL,GAAG,CACE,CAAC,CAEN,GAAG,CAEC,CAAC,CAEL,GAAI,UAAU;CACR,UAAU;AACZ,CAAC,CAAC,UAAU;AAEhB,GAAI,aAAa,CACX,aACF,CAAC,CAAC,aAAa;AAEnB,EAAE,CAAC,OAAO,CACV,EAAE,CAAE,OAAO,CACX,EAAE,CAAE,OAAO,CACX,EAAE,CAAG,OAAO,CACZ,CAAC,EAAE,OAAO,CACV,CAAC,EAAG,OAAO,CAEX,EAAE,CACE,OAAO,CAEX,EAAE,CACG,OAAO,CAEZ,EAAE,CAEE,OAAO,CAEX,EAAG,UAAU;CACP,UAAU;AACZ,OAAO,CAAC,UAAU;AAEtB,EAAG,aAAa,CACV,aACF,OAAO,CAAC,aAAa;AAEzB,CAAC,EACI,OAAO,CAEZ,CAAC,EAEG,OAAO,CAEX,CAAE,UAAU;CACN,UAAU;AACZ,OAAO,CAAC,UAAU;AAEtB,CAAE,aAAa,CACT,aACF,OAAO,CAAC,aAAa"} +//// [elementAccess.js.map] +{"version":3,"file":"elementAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/elementAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,GAAG,CAAC,CACR,GAAG,CAAG,GAAG,CAAE,CAEX,GAAG,CACC,GAAG,CAAE,CAET,GAAG,CAEC,GAAG,CACF,CAEL,GAAI,UAAU;CACR,UAAU;AACZ,GAAI,UAAU;CACb,CAAC,UAAU;AAEhB,GAAI,aAAa,CACX,aACF,GAAI,aAAa,CAChB,CAAC,aAAa"} +//// [update.js.map] +{"version":3,"file":"update.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/update.ts"],"names":[],"mappings":"AAAA,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAAA"} +//// [switch.js.map] +{"version":3,"file":"switch.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/switch.ts"],"names":[],"mappings":"AAAA,OAAQ,CAAC,CAAE,CACP,KAAK,CAAC,CAAE,MACR,KAAK,CAAC,CAAE,MACR,OAAO,CAAE,KAAM,CAClB"} +//// [keywords.js.map] +{"version":3,"file":"keywords.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/keywords.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,KAAK,GAAG,CAAC,CAAC,CACV,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CACZ,IAAK,EAAE,CAAC,CAAC,CAAC,CACV,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,SAAS,EAAE,GACP,OAAO,OAAO,GAClB,CACA,MAAK,QAAS,CAAE,EAAE,GACd,MAAM,CAAC,CACP,MAAM,GAAG,CACT,KAAM,CAAC,GAAG,CAAC,CACX,KAAM,EAAE,CACR,KAAK,CAAE,EAAE,CACT,KAAM,CAAC,EAAE,CACT,KAAM,CAAE,EAAE,CACV,KAAK,CACL,CAAC,CACD,MAAM,KAAK,CACX,MAAM,OAAO,GAAG,CAChB,MAAM,KAAK,GAAG,CACd,MAAM,OAAO,GAAG,CAAC,CAAC,CAClB,MAAM,CAAC,CACP,MAAM,GAAG,CACT,IAAI,KAAK,CAAE,MAAM,CAAC,GAAI,EAAE,CAAC,CACzB,OAAO,MAAM,MAAM,GACvB,CACA,OAAM,MAAO,CAAC,EACd,OAAO,OAAO,YAAa,CAAC"} +//// [statements.js.map] +{"version":3,"file":"statements.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/statements.ts"],"names":[],"mappings":"AAAA,GAAG,CACH,EAAE,EACF,CACA,SAAS,GAAG,GACR,GAAG,CACH,EAAE,EACF,CACA,SAAS,CAAC,GAAI,CACd,OACA,SAAS,CAAC,GAAI,CAClB,CAAC"} +//// [variables.js.map] +{"version":3,"file":"variables.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/variables.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CACpC,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CAAC"} +//// [for.js.map] +{"version":3,"file":"for.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/for.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE"} +//// [embeddedStatement.js.map] {"version":3,"file":"embeddedStatement.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/embeddedStatement.ts"],"names":[],"mappings":"AAAA,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespaceAndComments.outDir.js b/tests/baselines/reference/removeWhitespaceAndComments.outDir.js index 6b4534d283394..d05461354a33c 100644 --- a/tests/baselines/reference/removeWhitespaceAndComments.outDir.js +++ b/tests/baselines/reference/removeWhitespaceAndComments.outDir.js @@ -183,16 +183,22 @@ let e = 0, f, { g } = obj, [h] = obj; //// [propertyAccess.js] obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf; -//# sourceMappingURL=propertyAccess.js.map//// [elementAccess.js] +//# sourceMappingURL=propertyAccess.js.map +//// [elementAccess.js] obj["a"];obj["a"];obj["a"];obj["a"];obj["a"];obj["a"]; -//# sourceMappingURL=elementAccess.js.map//// [update.js] +//# sourceMappingURL=elementAccess.js.map +//// [update.js] i+ +i;i+ +i;i+ +i;i+ +i;i+ ++i;i+ ++i;i+ ++i;i+ ++i;i+++i;i+++i;i+++i;i+++i;i+++i;i- -i;i- -i;i- -i;i- -i;i- --i;i- --i;i- --i;i- --i;i---i;i---i;i---i;i---i;i---i; -//# sourceMappingURL=update.js.map//// [switch.js] +//# sourceMappingURL=update.js.map +//// [switch.js] switch(i){case 0:break;case 1:break;default:break} -//# sourceMappingURL=switch.js.map//// [keywords.js] +//# sourceMappingURL=switch.js.map +//// [keywords.js] delete obj.a;delete(obj).a;delete[][0];void obj.a;void(obj).a;void[][0];typeof obj.a;typeof(obj).a;typeof[][0];function f1(){return typeof obj}async function*f2(){yield 1;yield obj;yield(obj);yield[];yield*[];yield*[];yield*[];yield;i;yield yield;yield typeof obj;yield void obj;yield delete obj.a;await 1;await obj;for await(const x of[]);return yield await obj}export class C{}export default function(){} -//# sourceMappingURL=keywords.js.map//// [statements.js] +//# sourceMappingURL=keywords.js.map +//// [statements.js] obj;fn();function fn3(){obj;fn();function f(){}return;function g(){}} -//# sourceMappingURL=statements.js.map//// [variables.js] +//# sourceMappingURL=statements.js.map +//// [variables.js] var a=0,b,{c}=obj,[d]=obj;let e=0,f,{g}=obj,[h]=obj; //# sourceMappingURL=variables.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespaceAndComments.outDir.js.map b/tests/baselines/reference/removeWhitespaceAndComments.outDir.js.map index 01abe35866865..83145f6f3e762 100644 --- a/tests/baselines/reference/removeWhitespaceAndComments.outDir.js.map +++ b/tests/baselines/reference/removeWhitespaceAndComments.outDir.js.map @@ -1,8 +1,14 @@ //// [propertyAccess.js.map] -{"version":3,"file":"propertyAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/propertyAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAC,CACL,GAAG,CAAE,CAAC,CACN,GAAG,CAAE,CAAC,CACN,GAAG,CAAG,CAAC,CAEP,GAAG,CACC,CAAC,CAEL,GAAG,CACE,CAAC,CAEN,GAAG,CAEC,CAAC,CAEL,GAAG,CAEC,CAAC,CAEL,GAAG,CAEC,CAAC,CAEL,EAAE,CAAC,OAAO,CACV,EAAE,CAAE,OAAO,CACX,EAAE,CAAE,OAAO,CACX,EAAE,CAAG,OAAO,CACZ,CAAC,EAAE,OAAO,CACV,CAAC,EAAG,OAAO,CAEX,EAAE,CACE,OAAO,CAEX,EAAE,CACG,OAAO,CAEZ,EAAE,CAEE,OAAO,CAEX,EAAE,CAEE,OAAO,CAEX,EAAE,CAEE,OAAO,CAEX,CAAC,EACI,OAAO,CAEZ,CAAC,EAEG,OAAO,CAEX,CAAC,EAEG,OAAO,CAEX,CAAC,EAEG,OAAO,CAAA"}//// [elementAccess.js.map] -{"version":3,"file":"elementAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/elementAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,GAAG,CAAC,CACR,GAAG,CAAG,GAAG,CAAE,CAEX,GAAG,CACC,GAAG,CAAE,CAET,GAAG,CAEC,GAAG,CACF,CAEL,GAAG,CAEC,GAAG,CACF,CAEL,GAAG,CAEC,GAAG,CACF,CAAA"}//// [update.js.map] -{"version":3,"file":"update.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/update.ts"],"names":[],"mappings":"AAAA,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAAA"}//// [switch.js.map] -{"version":3,"file":"switch.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/switch.ts"],"names":[],"mappings":"AAAA,OAAQ,CAAC,CAAE,CACP,KAAK,CAAC,CAAE,MACR,KAAK,CAAC,CAAE,MACR,OAAO,CAAE,KAAM,CAClB"}//// [keywords.js.map] -{"version":3,"file":"keywords.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/keywords.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,KAAK,GAAG,CAAC,CAAC,CACV,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CACZ,IAAK,EAAE,CAAC,CAAC,CAAC,CACV,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,SAAS,EAAE,GACP,OAAO,OAAO,GAClB,CACA,MAAK,QAAS,CAAE,EAAE,GACd,MAAM,CAAC,CACP,MAAM,GAAG,CACT,KAAM,CAAC,GAAG,CAAC,CACX,KAAM,EAAE,CACR,KAAK,CAAE,EAAE,CACT,KAAM,CAAC,EAAE,CACT,KAAM,CAAE,EAAE,CACV,KAAK,CACL,CAAC,CACD,MAAM,KAAK,CACX,MAAM,OAAO,GAAG,CAChB,MAAM,KAAK,GAAG,CACd,MAAM,OAAO,GAAG,CAAC,CAAC,CAClB,MAAM,CAAC,CACP,MAAM,GAAG,CACT,IAAI,KAAK,CAAE,MAAM,CAAC,GAAI,EAAE,CAAC,CACzB,OAAO,MAAM,MAAM,GACvB,CACA,OAAM,MAAO,CAAC,EACd,OAAO,OAAO,YAAa,CAAC"}//// [statements.js.map] -{"version":3,"file":"statements.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/statements.ts"],"names":[],"mappings":"AAAA,GAAG,CACH,EAAE,EACF,CACA,SAAS,GAAG,GACR,GAAG,CACH,EAAE,EACF,CACA,SAAS,CAAC,GAAI,CACd,OACA,SAAS,CAAC,GAAI,CAClB,CAAC"}//// [variables.js.map] +{"version":3,"file":"propertyAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/propertyAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAC,CACL,GAAG,CAAE,CAAC,CACN,GAAG,CAAE,CAAC,CACN,GAAG,CAAG,CAAC,CAEP,GAAG,CACC,CAAC,CAEL,GAAG,CACE,CAAC,CAEN,GAAG,CAEC,CAAC,CAEL,GAAG,CAEC,CAAC,CAEL,GAAG,CAEC,CAAC,CAEL,EAAE,CAAC,OAAO,CACV,EAAE,CAAE,OAAO,CACX,EAAE,CAAE,OAAO,CACX,EAAE,CAAG,OAAO,CACZ,CAAC,EAAE,OAAO,CACV,CAAC,EAAG,OAAO,CAEX,EAAE,CACE,OAAO,CAEX,EAAE,CACG,OAAO,CAEZ,EAAE,CAEE,OAAO,CAEX,EAAE,CAEE,OAAO,CAEX,EAAE,CAEE,OAAO,CAEX,CAAC,EACI,OAAO,CAEZ,CAAC,EAEG,OAAO,CAEX,CAAC,EAEG,OAAO,CAEX,CAAC,EAEG,OAAO,CAAA"} +//// [elementAccess.js.map] +{"version":3,"file":"elementAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/elementAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,GAAG,CAAC,CACR,GAAG,CAAG,GAAG,CAAE,CAEX,GAAG,CACC,GAAG,CAAE,CAET,GAAG,CAEC,GAAG,CACF,CAEL,GAAG,CAEC,GAAG,CACF,CAEL,GAAG,CAEC,GAAG,CACF,CAAA"} +//// [update.js.map] +{"version":3,"file":"update.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/update.ts"],"names":[],"mappings":"AAAA,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAAA"} +//// [switch.js.map] +{"version":3,"file":"switch.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/switch.ts"],"names":[],"mappings":"AAAA,OAAQ,CAAC,CAAE,CACP,KAAK,CAAC,CAAE,MACR,KAAK,CAAC,CAAE,MACR,OAAO,CAAE,KAAM,CAClB"} +//// [keywords.js.map] +{"version":3,"file":"keywords.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/keywords.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,KAAK,GAAG,CAAC,CAAC,CACV,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CACZ,IAAK,EAAE,CAAC,CAAC,CAAC,CACV,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,SAAS,EAAE,GACP,OAAO,OAAO,GAClB,CACA,MAAK,QAAS,CAAE,EAAE,GACd,MAAM,CAAC,CACP,MAAM,GAAG,CACT,KAAM,CAAC,GAAG,CAAC,CACX,KAAM,EAAE,CACR,KAAK,CAAE,EAAE,CACT,KAAM,CAAC,EAAE,CACT,KAAM,CAAE,EAAE,CACV,KAAK,CACL,CAAC,CACD,MAAM,KAAK,CACX,MAAM,OAAO,GAAG,CAChB,MAAM,KAAK,GAAG,CACd,MAAM,OAAO,GAAG,CAAC,CAAC,CAClB,MAAM,CAAC,CACP,MAAM,GAAG,CACT,IAAI,KAAK,CAAE,MAAM,CAAC,GAAI,EAAE,CAAC,CACzB,OAAO,MAAM,MAAM,GACvB,CACA,OAAM,MAAO,CAAC,EACd,OAAO,OAAO,YAAa,CAAC"} +//// [statements.js.map] +{"version":3,"file":"statements.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/statements.ts"],"names":[],"mappings":"AAAA,GAAG,CACH,EAAE,EACF,CACA,SAAS,GAAG,GACR,GAAG,CACH,EAAE,EACF,CACA,SAAS,CAAC,GAAI,CACd,OACA,SAAS,CAAC,GAAI,CAClB,CAAC"} +//// [variables.js.map] {"version":3,"file":"variables.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/variables.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CACpC,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js index 7b7abae996c67..490f38acf4452 100644 --- a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js +++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js @@ -18,7 +18,8 @@ var c = /** @class */ (function () { } return c; }()); -//# sourceMappingURL=app.js.map//// [app2.js] +//# sourceMappingURL=app.js.map +//// [app2.js] var d = /** @class */ (function () { function d() { } diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map index 7a172c4e0a7f9..b517b5694b0ae 100644 --- a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map +++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map @@ -1,3 +1,4 @@ //// [app.js.map] -{"version":3,"file":"app.js","sourceRoot":"","sources":["../testFiles/app.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wIAAwI;AACxI;IAAA;IACA,CAAC;IAAD,QAAC;AAAD,CAAC,AADD,IACC"}//// [app2.js.map] +{"version":3,"file":"app.js","sourceRoot":"","sources":["../testFiles/app.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wIAAwI;AACxI;IAAA;IACA,CAAC;IAAD,QAAC;AAAD,CAAC,AADD,IACC"} +//// [app2.js.map] {"version":3,"file":"app2.js","sourceRoot":"","sources":["../testFiles/app2.ts"],"names":[],"mappings":"AAAA;IAAA;IACA,CAAC;IAAD,QAAC;AAAD,CAAC,AADD,IACC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js index 3487a70dc7bb3..6e49d774aa982 100644 --- a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js +++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js @@ -18,7 +18,8 @@ var c = /** @class */ (function () { } return c; }()); -//# sourceMappingURL=app.js.map//// [app2.js] +//# sourceMappingURL=app.js.map +//// [app2.js] var d = /** @class */ (function () { function d() { } diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map index 5025ed2212ac2..ef9951d251933 100644 --- a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map +++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map @@ -1,3 +1,4 @@ //// [app.js.map] -{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,0GAA0G;AAC1G;IAAA;IACA,CAAC;IAAD,QAAC;AAAD,CAAC,AADD,IACC"}//// [app2.js.map] +{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,0GAA0G;AAC1G;IAAA;IACA,CAAC;IAAD,QAAC;AAAD,CAAC,AADD,IACC"} +//// [app2.js.map] {"version":3,"file":"app2.js","sourceRoot":"","sources":["app2.ts"],"names":[],"mappings":"AAAA;IAAA;IACA,CAAC;IAAD,QAAC;AAAD,CAAC,AADD,IACC"} \ No newline at end of file From 0654e6c7c5204d5e300dd353c6cdb8bfe5ebf85e Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 6 Jul 2018 18:40:47 -0700 Subject: [PATCH 07/10] Ensure default os-invariant value for newLine in project tests --- src/compiler/sourcemapDecoder.ts | 4 ++-- src/testRunner/projectsRunner.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/sourcemapDecoder.ts b/src/compiler/sourcemapDecoder.ts index b09b919e0e014..1640d39c52d98 100644 --- a/src/compiler/sourcemapDecoder.ts +++ b/src/compiler/sourcemapDecoder.ts @@ -72,7 +72,7 @@ namespace ts.sourcemaps { if (!maps[targetIndex] || comparePaths(loc.fileName, maps[targetIndex].sourcePath, sourceRoot) !== 0) { return loc; } - return { fileName: toPath(map.file!, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].emittedPosition }; // Closest pos + return { fileName: toPath(map.file, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].emittedPosition }; // Closest pos } function getOriginalPosition(loc: SourceMappableLocation): SourceMappableLocation { @@ -129,7 +129,7 @@ namespace ts.sourcemaps { function processPosition(position: RawSourceMapPosition): ProcessedSourceMapPosition { const sourcePath = map.sources[position.sourceIndex]; return { - emittedPosition: getPositionOfLineAndCharacterUsingName(map.file!, currentDirectory, position.emittedLine, position.emittedColumn), + emittedPosition: getPositionOfLineAndCharacterUsingName(map.file, currentDirectory, position.emittedLine, position.emittedColumn), sourcePosition: getPositionOfLineAndCharacterUsingName(sourcePath, sourceRoot, position.sourceLine, position.sourceColumn), sourcePath, // TODO: Consider using `name` field to remap the expected identifier to scan for renames to handle another tool renaming oout output diff --git a/src/testRunner/projectsRunner.ts b/src/testRunner/projectsRunner.ts index f3b4a0bca235e..62a186d4526a2 100644 --- a/src/testRunner/projectsRunner.ts +++ b/src/testRunner/projectsRunner.ts @@ -431,6 +431,7 @@ namespace project { skipDefaultLibCheck: false, moduleResolution: ts.ModuleResolutionKind.Classic, module: moduleKind, + newLine: ts.NewLineKind.CarriageReturnLineFeed, mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? vpath.resolve(vfs.srcFolder, testCase.mapRoot) : testCase.mapRoot, From 5f29303f9381f51833541a63882712594ec9d973 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 9 Jul 2018 13:15:35 -0700 Subject: [PATCH 08/10] gulpfile/jakefile updates --- Gulpfile.js | 15 +-- Jakefile.js | 256 +++++++++++++++++++++++++++------------------------- 2 files changed, 141 insertions(+), 130 deletions(-) diff --git a/Gulpfile.js b/Gulpfile.js index a66543e2e5e2c..b31462755adb1 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -12,7 +12,6 @@ const sourcemaps = require("gulp-sourcemaps"); const del = require("del"); const fold = require("travis-fold"); const rename = require("gulp-rename"); -const through2 = require("through2"); const mkdirp = require("./scripts/build/mkdirp"); const gulp = require("./scripts/build/gulp"); const getDirSize = require("./scripts/build/getDirSize"); @@ -140,7 +139,7 @@ gulp.task(typescriptServicesProject, /*help*/ false, () => { "removeComments": false, "stripInternal": true, "declarationMap": false, - "outFile": "typescriptServices.js" + "outFile": "typescriptServices.out.js" // must align with same task in jakefile. We fix this name below. } }); }); @@ -150,11 +149,13 @@ const typescriptServicesDts = "built/local/typescriptServices.d.ts"; gulp.task(typescriptServicesJs, /*help*/ false, ["lib", "generate-diagnostics", typescriptServicesProject], () => project.compile(typescriptServicesProject, { js: files => files - .pipe(prepend.file(copyright)), + .pipe(prepend.file(copyright)) + .pipe(rename("typescriptServices.js")), dts: files => files .pipe(removeSourceMaps()) .pipe(prepend.file(copyright)) .pipe(convertConstEnums()) + .pipe(rename("typescriptServices.d.ts")) }), { aliases: [typescriptServicesDts] }); @@ -234,7 +235,7 @@ gulp.task(tsserverlibraryProject, /*help*/ false, () => { "removeComments": false, "stripInternal": true, "declarationMap": false, - "outFile": "tsserverlibrary.js" + "outFile": "tsserverlibrary.out.js" // must align with same task in jakefile. We fix this name below. } }); }); @@ -244,12 +245,14 @@ const tsserverlibraryDts = "built/local/tsserverlibrary.d.ts"; gulp.task(tsserverlibraryJs, /*help*/ false, useCompilerDeps.concat([tsserverlibraryProject]), () => project.compile(tsserverlibraryProject, { js: files => files - .pipe(prepend.file(copyright)), + .pipe(prepend.file(copyright)) + .pipe(rename("tsserverlibrary.js")), dts: files => files .pipe(removeSourceMaps()) .pipe(prepend.file(copyright)) .pipe(convertConstEnums()) - .pipe(append("\nexport = ts;\nexport as namespace ts;")), + .pipe(append("\nexport = ts;\nexport as namespace ts;")) + .pipe(rename("tsserverlibrary.d.ts")), typescript: useCompiler }), { aliases: [tsserverlibraryDts] }); diff --git a/Jakefile.js b/Jakefile.js index 74e8a603c619c..1dc4be82faec3 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -10,6 +10,8 @@ const ts = require("./lib/typescript"); const del = require("del"); const getDirSize = require("./scripts/build/getDirSize"); const { base64VLQFormatEncode } = require("./scripts/build/sourcemaps"); +const needsUpdate = require("./scripts/build/needsUpdate"); +const { flatten } = require("./scripts/build/project"); // add node_modules to path so we don't need global modules, prefer the modules by adding them first var nodeModulesPathPrefix = path.resolve("./node_modules/.bin/") + path.delimiter; @@ -65,10 +67,14 @@ Paths.typesMapOutput = "built/local/typesMap.json"; Paths.typescriptFile = "built/local/typescript.js"; Paths.servicesFile = "built/local/typescriptServices.js"; Paths.servicesDefinitionFile = "built/local/typescriptServices.d.ts"; +Paths.servicesOutFile = "built/local/typescriptServices.out.js"; +Paths.servicesDefinitionOutFile = "built/local/typescriptServices.out.d.ts"; Paths.typescriptDefinitionFile = "built/local/typescript.d.ts"; Paths.typescriptStandaloneDefinitionFile = "built/local/typescript_standalone.d.ts"; Paths.tsserverLibraryFile = "built/local/tsserverlibrary.js"; Paths.tsserverLibraryDefinitionFile = "built/local/tsserverlibrary.d.ts"; +Paths.tsserverLibraryOutFile = "built/local/tsserverlibrary.out.js"; +Paths.tsserverLibraryDefinitionOutFile = "built/local/tsserverlibrary.out.d.ts"; Paths.baselines = {}; Paths.baselines.local = "tests/baselines/local"; Paths.baselines.localTest262 = "tests/baselines/test262/local"; @@ -103,7 +109,9 @@ const ConfigFileFor = { runjs: "src/testRunner", lint: "scripts/tslint", scripts: "scripts", - all: "src" + all: "src", + typescriptServices: "built/local/typescriptServices.tsconfig.json", + tsserverLibrary: "built/local/tsserverlibrary.tsconfig.json", }; const ExpectedLKGFiles = [ @@ -126,13 +134,18 @@ desc("Builds the full compiler and services"); task(TaskNames.local, [ TaskNames.buildFoldStart, TaskNames.coreBuild, + Paths.servicesDefinitionFile, + Paths.typescriptFile, + Paths.typescriptDefinitionFile, + Paths.typescriptStandaloneDefinitionFile, + Paths.tsserverLibraryDefinitionFile, TaskNames.localize, TaskNames.buildFoldEnd ]); task("default", [TaskNames.local]); -const RunTestsPrereqs = [TaskNames.lib, Paths.servicesDefinitionFile, Paths.tsserverLibraryDefinitionFile]; +const RunTestsPrereqs = [TaskNames.lib, Paths.servicesDefinitionFile, Paths.typescriptDefinitionFile, Paths.tsserverLibraryDefinitionFile]; desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... d[ebug]=true."); task(TaskNames.runtestsParallel, RunTestsPrereqs, function () { tsbuild([ConfigFileFor.runjs], true, () => { @@ -174,6 +187,9 @@ task(TaskNames.lkg, [ TaskNames.release, TaskNames.local, Paths.servicesDefinitionFile, + Paths.typescriptFile, + Paths.typescriptDefinitionFile, + Paths.typescriptStandaloneDefinitionFile, Paths.tsserverLibraryDefinitionFile, Paths.releaseCompiler, ...libraryTargets @@ -335,108 +351,146 @@ file(Paths.diagnosticInformationMap, [Paths.diagnosticMessagesJson], function () }); }, { async: true }); -// tsserverlibrary.d.ts -file(Paths.tsserverLibraryDefinitionFile, [TaskNames.coreBuild], function() { - const files = []; - recur(`src/tsserver/tsconfig.json`); - - const config = { - extends: "../../src/tsserver/tsconfig.json", +file(ConfigFileFor.tsserverLibrary, [], function () { + flatten("src/tsserver/tsconfig.json", ConfigFileFor.tsserverLibrary, { + exclude: ["src/tsserver/server.ts"], compilerOptions: { "removeComments": false, "stripInternal": true, "declarationMap": false, - "outFile": "tsserverlibrary.js" - }, - files - }; - - const configFilePath = `built/local/tsserverlibrary.tsconfig.json`; - fs.writeFileSync(configFilePath, JSON.stringify(config, undefined, 2)); - - const previousTime = getModifiedTime(Paths.tsserverLibraryFile); - tsbuild(configFilePath, false, () => { - if (previousTime !== getModifiedTime(Paths.tsserverLibraryFile)) { - prependCopyright(Paths.tsserverLibraryFile, Paths.tsserverLibraryFile, /*fixSourceMaps*/ true); - prependCopyright(Paths.tsserverLibraryDefinitionFile, Paths.tsserverLibraryDefinitionFile, /*fixSourceMaps*/ false); - const libraryDefinitionContent = readFileSync(Paths.tsserverLibraryDefinitionFile); - const libraryDefinitionContentWithoutConstEnums = removeConstModifierFromEnumDeclarations(libraryDefinitionContent); - fs.writeFileSync(Paths.tsserverLibraryDefinitionFile, libraryDefinitionContentWithoutConstEnums + "\nexport = ts;\nexport as namespace ts;"); + "outFile": "tsserverlibrary.out.js" } - complete(); - }); + }) +}); - function recur(configPath) { - const cfgFile = readJson(configPath); - if (cfgFile.references) { - for (const ref of cfgFile.references) { - recur(path.join(path.dirname(configPath), ref.path, "tsconfig.json")); +// tsserverlibrary.js +// tsserverlibrary.d.ts +file(Paths.tsserverLibraryFile, [TaskNames.coreBuild, ConfigFileFor.tsserverLibrary], function() { + tsbuild(ConfigFileFor.tsserverLibrary, false, () => { + if (needsUpdate([Paths.tsserverLibraryOutFile, Paths.tsserverLibraryDefinitionOutFile], [Paths.tsserverLibraryFile, Paths.tsserverLibraryDefinitionFile])) { + const copyright = readFileSync(Paths.copyright); + + let libraryDefinitionContent = readFileSync(Paths.tsserverLibraryDefinitionOutFile); + libraryDefinitionContent = copyright + removeConstModifierFromEnumDeclarations(libraryDefinitionContent); + libraryDefinitionContent += "\nexport = ts;\nexport as namespace ts;"; + fs.writeFileSync(Paths.tsserverLibraryDefinitionFile, libraryDefinitionContent, "utf8"); + + let libraryContent = readFileSync(Paths.tsserverLibraryOutFile); + libraryContent = copyright + libraryContent; + fs.writeFileSync(Paths.tsserverLibraryFile, libraryContent, "utf8"); + + // adjust source map for tsserverlibrary.js + let libraryMapContent = readFileSync(Paths.tsserverLibraryOutFile + ".map"); + const map = JSON.parse(libraryMapContent); + const lineStarts = /**@type {*}*/(ts).computeLineStarts(copyright); + let prependMappings = ""; + for (let i = 1; i < lineStarts.length; i++) { + prependMappings += ";"; } + + const offset = copyright.length - lineStarts[lineStarts.length - 1]; + if (offset > 0) { + prependMappings += base64VLQFormatEncode(offset) + ","; + } + + const outputMap = { + version: map.version, + file: map.file, + sources: map.sources, + sourceRoot: map.sourceRoot, + mappings: prependMappings + map.mappings, + names: map.names, + sourcesContent: map.sourcesContent + }; + + libraryMapContent = JSON.stringify(outputMap); + fs.writeFileSync(Paths.tsserverLibraryFile + ".map", libraryMapContent); } - for (const file of cfgFile.files) { - // don't include server.ts - if (configPath === "src/tsserver/tsconfig.json" && file === "server.ts") continue; - files.push(path.join(`../../`, path.dirname(configPath), file)); - } - } + complete(); + }); }, { async: true }); +task(Paths.tsserverLibraryDefinitionFile, [Paths.tsserverLibraryFile]); -// typescriptservices.d.ts -file(Paths.servicesDefinitionFile, [TaskNames.coreBuild], function() { - // Generate a config file - const files = []; - recur(`src/services/tsconfig.json`); - - const config = { - extends: "../../src/tsconfig-base", +file(ConfigFileFor.typescriptServices, [], function () { + flatten("src/services/tsconfig.json", ConfigFileFor.typescriptServices, { compilerOptions: { "removeComments": false, "stripInternal": true, "declarationMap": false, - "outFile": "typescriptServices.js" - }, - files - }; + "outFile": "typescriptServices.out.js" + } + }); +}); - const configFilePath = `built/local/typescriptServices.tsconfig.json`; - fs.writeFileSync(configFilePath, JSON.stringify(config, undefined, 2)); +// typescriptServices.js +// typescriptServices.d.ts +file(Paths.servicesFile, [TaskNames.coreBuild, ConfigFileFor.typescriptServices], function() { + tsbuild(ConfigFileFor.typescriptServices, false, () => { + if (needsUpdate([Paths.servicesOutFile, Paths.servicesDefinitionOutFile], [Paths.servicesFile, Paths.servicesDefinitionFile])) { + const copyright = readFileSync(Paths.copyright); - const previousTime = getModifiedTime(Paths.servicesDefinitionFile); - tsbuild(configFilePath, false, () => { - if (previousTime !== getModifiedTime(Paths.servicesDefinitionFile)) { - prependCopyright(Paths.servicesFile, Paths.servicesFile, /*fixSourceMaps*/ true); - prependCopyright(Paths.servicesDefinitionFile, Paths.servicesDefinitionFile, /*fixSourceMaps*/ false); + let servicesDefinitionContent = readFileSync(Paths.servicesDefinitionOutFile); + servicesDefinitionContent = copyright + removeConstModifierFromEnumDeclarations(servicesDefinitionContent); + fs.writeFileSync(Paths.servicesDefinitionFile, servicesDefinitionContent, "utf8"); - const servicesDefinitionContent = readFileSync(Paths.servicesDefinitionFile); - const servicesDefinitionContentWithoutConstEnums = removeConstModifierFromEnumDeclarations(servicesDefinitionContent); - fs.writeFileSync(Paths.servicesDefinitionFile, servicesDefinitionContentWithoutConstEnums); + let servicesContent = readFileSync(Paths.servicesOutFile); + servicesContent = copyright + servicesContent; + fs.writeFileSync(Paths.servicesFile, servicesContent, "utf8"); - // Also build typescript.js, typescript.js.map, and typescript.d.ts - jake.cpR(Paths.servicesFile, Paths.typescriptFile); - if (fs.existsSync(Paths.servicesFile + ".map")) { - jake.cpR(Paths.servicesFile + ".map", Paths.typescriptFile + ".map"); + // adjust source map for typescriptServices.js + let servicesMapContent = readFileSync(Paths.servicesOutFile + ".map"); + const map = JSON.parse(servicesMapContent); + const lineStarts = /**@type {*}*/(ts).computeLineStarts(copyright); + let prependMappings = ""; + for (let i = 1; i < lineStarts.length; i++) { + prependMappings += ";"; + } + + const offset = copyright.length - lineStarts[lineStarts.length - 1]; + if (offset > 0) { + prependMappings += base64VLQFormatEncode(offset) + ","; } - fs.writeFileSync(Paths.typescriptDefinitionFile, servicesDefinitionContentWithoutConstEnums + "\r\nexport = ts;", { encoding: "utf-8" }); - // And typescript_standalone.d.ts - fs.writeFileSync(Paths.typescriptStandaloneDefinitionFile, servicesDefinitionContentWithoutConstEnums.replace(/declare (namespace|module) ts(\..+)? \{/g, 'declare module "typescript" {'), { encoding: "utf-8"}); + const outputMap = { + version: map.version, + file: map.file, + sources: map.sources, + sourceRoot: map.sourceRoot, + mappings: prependMappings + map.mappings, + names: map.names, + sourcesContent: map.sourcesContent + }; + + servicesMapContent = JSON.stringify(outputMap); + fs.writeFileSync(Paths.servicesFile + ".map", servicesMapContent); } complete(); }); - - function recur(configPath) { - const cfgFile = readJson(configPath); - if (cfgFile.references) { - for (const ref of cfgFile.references) { - recur(path.join(path.dirname(configPath), ref.path, "tsconfig.json")); - } - } - for (const file of cfgFile.files) { - files.push(path.join(`../../`, path.dirname(configPath), file)); +}, { async: true }); +task(Paths.servicesDefinitionFile, [Paths.servicesFile]); + +// typescript.js +// typescript.d.ts +file(Paths.typescriptFile, [Paths.servicesFile], function() { + if (needsUpdate([Paths.servicesFile, Paths.servicesDefinitionFile], [Paths.typescriptFile, Paths.typescriptDefinitionFile])) { + jake.cpR(Paths.servicesFile, Paths.typescriptFile); + if (fs.existsSync(Paths.servicesFile + ".map")) { + jake.cpR(Paths.servicesFile + ".map", Paths.typescriptFile + ".map"); } + const content = readFileSync(Paths.servicesDefinitionFile); + fs.writeFileSync(Paths.typescriptDefinitionFile, content + "\r\nexport = ts;", { encoding: "utf-8" }); } -}, { async: true }); +}); +task(Paths.typescriptDefinitionFile, [Paths.typescriptFile]); + +// typescript_standalone.d.ts +file(Paths.typescriptStandaloneDefinitionFile, [Paths.servicesDefinitionFile], function() { + if (needsUpdate(Paths.servicesDefinitionFile, Paths.typescriptStandaloneDefinitionFile)) { + const content = readFileSync(Paths.servicesDefinitionFile); + fs.writeFileSync(Paths.typescriptStandaloneDefinitionFile, content.replace(/declare (namespace|module) ts(\..+)? \{/g, 'declare module "typescript" {'), { encoding: "utf-8"}); + } +}); function getLibraryTargets() { /** @type {{ libs: string[], paths?: Record, sources?: Record }} */ @@ -811,50 +865,4 @@ function getDiffTool() { */ function removeConstModifierFromEnumDeclarations(text) { return text.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, '$1$2enum $3 {$4'); -} - -function prependCopyright(src, dest, fixSourceMaps) { - const copyright = readFileSync(Paths.copyright); - const content = readFileSync(src); - const contentWithCopyright = copyright + content; - fs.writeFileSync(dest, contentWithCopyright); - if (fixSourceMaps) { - try { - const mapContent = readFileSync(src + ".map"); - const map = JSON.parse(mapContent); - const lineStarts = /**@type {*}*/(ts).computeLineStarts(copyright); - let prependMappings = ""; - for (let i = 1; i < lineStarts.length; i++) { - prependMappings += ";"; - } - const offset = copyright.length - lineStarts[lineStarts.length - 1]; - if (offset > 0) { - prependMappings += base64VLQFormatEncode(offset) + ","; - } - const outputLibraryMap = { - version: map.version, - file: map.file, - sources: map.sources, - sourceRoot: map.sourceRoot, - mappings: prependMappings + map.mappings, - names: map.names, - sourcesContent: map.sourcesContent - }; - const outputLibraryMapContent = JSON.stringify(outputLibraryMap); - fs.writeFileSync(dest + ".map", outputLibraryMapContent); - } - catch (e) { - // ignore - } - } -} - -function getModifiedTime(file) { - try { - const stats = fs.statSync(file); - return stats.mtimeMs; - } - catch (e) { - return undefined; - } } \ No newline at end of file From 57a68e062fde195ab82220666af2b03e8b5935bb Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 10 Jul 2018 16:26:33 -0700 Subject: [PATCH 09/10] PR Feedback --- src/compiler/sourcemap.ts | 82 +++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 88d09ae691551..a24cc5c148bf2 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -376,17 +376,13 @@ namespace ts { let nameToNameIndexMap: Map | undefined; // Last recorded and encoded mappings - let generatedLine = 0; - let generatedCharacter = 0; - let sourceIndex = 0; - let sourceLine = 0; - let sourceCharacter = 0; - let nameIndex = 0; - - let hasPending = false; - let hasPendingSource = false; - let hasPendingName = false; - let hasMapping = false; + let lastGeneratedLine = 0; + let lastGeneratedCharacter = 0; + let lastSourceIndex = 0; + let lastSourceLine = 0; + let lastSourceCharacter = 0; + let lastNameIndex = 0; + let hasLast = false; let pendingGeneratedLine = 0; let pendingGeneratedCharacter = 0; @@ -394,6 +390,9 @@ namespace ts { let pendingSourceLine = 0; let pendingSourceCharacter = 0; let pendingNameIndex = 0; + let hasPending = false; + let hasPendingSource = false; + let hasPendingName = false; return { addSource, @@ -467,12 +466,16 @@ namespace ts { } function addMapping(generatedLine: number, generatedCharacter: number, sourceIndex?: number, sourceLine?: number, sourceCharacter?: number, nameIndex?: number) { + Debug.assert(generatedLine >= pendingGeneratedLine, "generatedLine cannot backtrack"); + Debug.assert(generatedCharacter >= 0, "generatedCharacter cannot be negative"); + Debug.assert(sourceIndex === undefined || sourceIndex >= 0, "sourceIndex cannot be negative"); + Debug.assert(sourceLine === undefined || sourceLine >= 0, "sourceLine cannot be negative"); + Debug.assert(sourceCharacter === undefined || sourceCharacter >= 0, "sourceCharacter cannot be negative"); enter(); // If this location wasn't recorded or the location in source is going backwards, record the mapping if (isNewGeneratedPosition(generatedLine, generatedCharacter) || isBacktrackingSourcePosition(sourceIndex, sourceLine, sourceCharacter)) { commitPendingMapping(); - Debug.assert(generatedLine >= pendingGeneratedLine, "Cannot backtrack generated lines."); pendingGeneratedLine = generatedLine; pendingGeneratedCharacter = generatedCharacter; hasPendingSource = false; @@ -481,7 +484,6 @@ namespace ts { } if (sourceIndex !== undefined && sourceLine !== undefined && sourceCharacter !== undefined) { - Debug.assert(sourceIndex !== -1, "No source was set for this mapping."); pendingSourceIndex = sourceIndex; pendingSourceLine = sourceLine; pendingSourceCharacter = sourceCharacter; @@ -495,6 +497,8 @@ namespace ts { } function appendSourceMap(generatedLine: number, generatedCharacter: number, map: RawSourceMap, sourceMapPath: string) { + Debug.assert(generatedLine >= pendingGeneratedLine, "generatedLine cannot backtrack"); + Debug.assert(generatedCharacter >= 0, "generatedCharacter cannot be negative"); enter(); // First, decode the old component sourcemap const sourceIndexToNewSourceIndexMap: number[] = []; @@ -538,13 +542,13 @@ namespace ts { } function shouldCommitMapping() { - return !hasMapping - || generatedLine !== pendingGeneratedLine - || generatedCharacter !== pendingGeneratedCharacter - || sourceIndex !== pendingSourceIndex - || sourceLine !== pendingSourceLine - || sourceCharacter !== pendingSourceCharacter - || nameIndex !== pendingNameIndex; + return !hasLast + || lastGeneratedLine !== pendingGeneratedLine + || lastGeneratedCharacter !== pendingGeneratedCharacter + || lastSourceIndex !== pendingSourceIndex + || lastSourceLine !== pendingSourceLine + || lastSourceCharacter !== pendingSourceCharacter + || lastNameIndex !== pendingNameIndex; } // Encoding for sourcemap span @@ -554,54 +558,50 @@ namespace ts { } enter(); - Debug.assert(pendingGeneratedCharacter >= 0, "lastRecordedGeneratedCharacter was negative"); - Debug.assert(pendingSourceIndex >= 0, "lastRecordedSourceIndex was negative"); - Debug.assert(pendingSourceLine >= 0, "lastRecordedSourceLine was negative"); - Debug.assert(pendingSourceCharacter >= 0, "lastRecordedSourceCharacter was negative"); // Line/Comma delimiters - if (generatedLine < pendingGeneratedLine) { + if (lastGeneratedLine < pendingGeneratedLine) { // Emit line delimiters do { sourceMapData.sourceMapMappings += ";"; - generatedLine++; - generatedCharacter = 0; + lastGeneratedLine++; + lastGeneratedCharacter = 0; } - while (generatedLine < pendingGeneratedLine); + while (lastGeneratedLine < pendingGeneratedLine); } else { - Debug.assertEqual(generatedLine, pendingGeneratedLine, "generatedLine cannot backtrack"); + Debug.assertEqual(lastGeneratedLine, pendingGeneratedLine, "generatedLine cannot backtrack"); // Emit comma to separate the entry - if (hasMapping) { + if (hasLast) { sourceMapData.sourceMapMappings += ","; } } // 1. Relative generated character - sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingGeneratedCharacter - generatedCharacter); - generatedCharacter = pendingGeneratedCharacter; + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingGeneratedCharacter - lastGeneratedCharacter); + lastGeneratedCharacter = pendingGeneratedCharacter; if (hasPendingSource) { // 2. Relative sourceIndex - sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingSourceIndex - sourceIndex); - sourceIndex = pendingSourceIndex; + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingSourceIndex - lastSourceIndex); + lastSourceIndex = pendingSourceIndex; // 3. Relative source line - sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingSourceLine - sourceLine); - sourceLine = pendingSourceLine; + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingSourceLine - lastSourceLine); + lastSourceLine = pendingSourceLine; // 4. Relative source character - sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingSourceCharacter - sourceCharacter); - sourceCharacter = pendingSourceCharacter; + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingSourceCharacter - lastSourceCharacter); + lastSourceCharacter = pendingSourceCharacter; if (hasPendingName) { // 5. Relative nameIndex - sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingNameIndex - nameIndex); - nameIndex = pendingNameIndex; + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingNameIndex - lastNameIndex); + lastNameIndex = pendingNameIndex; } } - hasMapping = true; + hasLast = true; exit(); } From 108b1b4a714e95e099d1d34d3806eae16ac20fbc Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 1 Aug 2018 16:17:08 -0700 Subject: [PATCH 10/10] Update diagnostic message code --- src/compiler/diagnosticMessages.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 0518fd8689768..82321569f9ce9 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3662,7 +3662,7 @@ "Do not emit insignificant whitespace or insignificant trailing semicolons to output.": { "category": "Message", - "code": 6205 + "code": 6206 },