diff --git a/Gulpfile.js b/Gulpfile.js
index db7bb76d34..cda840dba0 100644
--- a/Gulpfile.js
+++ b/Gulpfile.js
@@ -1,161 +1,125 @@
///
// @ts-check
-const cp = require("child_process");
const path = require("path");
+const log = require("fancy-log"); // was `require("gulp-util").log (see https://github.com/gulpjs/gulp-util)
const fs = require("fs");
const child_process = require("child_process");
-const originalGulp = require("gulp");
-const helpMaker = require("gulp-help");
const runSequence = require("run-sequence");
-const concat = require("gulp-concat");
-const clone = require("gulp-clone");
const newer = require("gulp-newer");
-const tsc = require("gulp-typescript");
-const tsc_oop = require("./scripts/build/gulp-typescript-oop");
-const getDirSize = require("./scripts/build/getDirSize");
const insert = require("gulp-insert");
+const { append } = require("gulp-insert");
const sourcemaps = require("gulp-sourcemaps");
-const Q = require("q");
const del = require("del");
-const mkdirP = require("mkdirp");
-const minimist = require("minimist");
const browserify = require("browserify");
const through2 = require("through2");
-const merge2 = require("merge2");
-const os = require("os");
const fold = require("travis-fold");
-const ts = require("./lib/typescript");
-const gulp = helpMaker(originalGulp);
+const rename = require("gulp-rename");
+const concat = require("gulp-concat");
+const convertMap = require("convert-source-map");
+const sorcery = require("sorcery");
+const Vinyl = require("vinyl");
+const mkdirp = require("./scripts/build/mkdirp");
+const gulp = require("./scripts/build/gulp");
+const getDirSize = require("./scripts/build/getDirSize");
+const project = require("./scripts/build/project");
+const replace = require("./scripts/build/replace");
+const convertConstEnums = require("./scripts/build/convertConstEnum");
+const makeLibraryTargets = require("./scripts/build/lib");
+const needsUpdate = require("./scripts/build/needsUpdate");
+const getDiffTool = require("./scripts/build/getDiffTool");
+const baselineAccept = require("./scripts/build/baselineAccept");
+const cmdLineOptions = require("./scripts/build/options");
+const { execAsync } = require("./scripts/build/exec");
+const { runConsoleTests, cleanTestDirs, writeTestConfigFile, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline } = require("./scripts/build/tests");
Error.stackTraceLimit = 1000;
-/**
- * This regexp exists to capture our const enums and replace them with normal enums in our public API
- * - this is fine since we compile with preserveConstEnums, and ensures our consumers are not locked
- * to the TS version they compile with.
- */
-const constEnumCaptureRegexp = /^(\s*)(export )?const enum (\S+) {(\s*)$/gm;
-const constEnumReplacement = "$1$2enum $3 {$4";
+// Constants
+const host = cmdLineOptions.host;
+const copyright = "CopyrightNotice.txt";
+const libraryTargets = makeLibraryTargets([copyright]);
-const cmdLineOptions = minimist(process.argv.slice(2), {
- boolean: ["debug", "inspect", "light", "colors", "lint", "soft", "fix"],
- string: ["browser", "tests", "host", "reporter", "stackTraceLimit", "timeout"],
- alias: {
- "b": "browser",
- "d": "debug", "debug-brk": "debug",
- "i": "inspect", "inspect-brk": "inspect",
- "t": "tests", "test": "tests",
- "ru": "runners", "runner": "runners",
- "r": "reporter",
- "c": "colors", "color": "colors",
- "w": "workers",
- "f": "fix",
- },
- default: {
- soft: false,
- colors: process.env.colors || process.env.color || true,
- debug: process.env.debug || process.env["debug-brk"] || process.env.d,
- inspect: process.env.inspect || process.env["inspect-brk"] || process.env.i,
- host: process.env.TYPESCRIPT_HOST || process.env.host || "node",
- browser: process.env.browser || process.env.b || (os.platform() === "win32" ? "edge" : "chrome"),
- timeout: process.env.timeout || 40000,
- tests: process.env.test || process.env.tests || process.env.t,
- runners: process.env.runners || process.env.runner || process.env.ru,
- light: process.env.light === undefined || process.env.light !== "false",
- reporter: process.env.reporter || process.env.r,
- lint: process.env.lint || true,
- fix: process.env.fix || process.env.f,
- workers: process.env.workerCount || os.cpus().length,
+// Compile using the LKG compiler
+project.addTypeScript("lkg", "./lib/typescript.js");
+project.addTypeScript("default", "lkg");
+
+const scriptsProject = "scripts/tsconfig.json";
+const configurePrereleaseJs = "scripts/configurePrerelease.js";
+const processDiagnosticMessagesJs = "scripts/processDiagnosticMessages.js";
+const generateLocalizedDiagnosticMessagesJs = "scripts/generateLocalizedDiagnosticMessages.js";
+const buildProtocolJs = "scripts/buildProtocol.js";
+const produceLKGJs = "scripts/produceLKG.js";
+const word2mdJs = "scripts/word2md.js";
+gulp.task("scripts", /*help*/ false, [project(scriptsProject)], undefined, {
+ aliases: [
+ configurePrereleaseJs,
+ processDiagnosticMessagesJs,
+ generateLocalizedDiagnosticMessagesJs,
+ produceLKGJs,
+ buildProtocolJs,
+ word2mdJs
+ ]
+});
+gulp.task("clean-scripts", /*help*/ false, [project.clean(scriptsProject)]);
+
+// Nightly management tasks
+gulp.task(
+ "configure-nightly",
+ "Runs scripts/configurePrerelease.ts to prepare a build for nightly publishing",
+ [configurePrereleaseJs],
+ () => execAsync(host, [configurePrereleaseJs, "dev", "package.json", "src/compiler/core.ts"]));
+
+gulp.task(
+ "publish-nightly",
+ "Runs `npm publish --tag next` to create a new nightly build on npm",
+ ["LKG"],
+ () => runSequence("clean", "useDebugMode", "runtests-parallel",
+ () => execAsync("npm", ["publish", "--tag", "next"])));
+
+const importDefinitelyTypedTestsProject = "scripts/importDefinitelyTypedTests/tsconfig.json";
+const importDefinitelyTypedTestsJs = "scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.js";
+gulp.task(importDefinitelyTypedTestsJs, /*help*/ false, [project(importDefinitelyTypedTestsProject)]);
+gulp.task("clean:" + importDefinitelyTypedTestsJs, /*help*/ false, [project.clean(importDefinitelyTypedTestsProject)]);
+
+gulp.task(
+ "importDefinitelyTypedTests",
+ "Runs scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts to copy DT's tests to the TS-internal RWC tests",
+ [importDefinitelyTypedTestsJs],
+ () => execAsync(host, [importDefinitelyTypedTestsJs, "./", "../DefinitelyTyped"]));
+
+gulp.task(
+ "lib",
+ "Builds the library targets",
+ libraryTargets);
+
+// The generated diagnostics map; built for the compiler and for the "generate-diagnostics" task
+const diagnosticInformationMapTs = "src/compiler/diagnosticInformationMap.generated.ts";
+const diagnosticMessagesJson = "src/compiler/diagnosticMessages.json";
+const diagnosticMessagesGeneratedJson = "src/compiler/diagnosticMessages.generated.json";
+gulp.task(diagnosticInformationMapTs, /*help*/ false, [processDiagnosticMessagesJs], () => {
+ if (needsUpdate(diagnosticMessagesJson, [diagnosticMessagesGeneratedJson, diagnosticInformationMapTs])) {
+ return execAsync(host, [processDiagnosticMessagesJs, diagnosticMessagesJson]);
}
});
+gulp.task("clean:" + diagnosticInformationMapTs, /*help*/ false, () => del([diagnosticInformationMapTs, diagnosticMessagesGeneratedJson]));
-const noop = () => {}; // tslint:disable-line no-empty
-/**
- * @param {string} cmd
- * @param {string[]} args
- * @param {() => void} complete
- * @param {(e: *, status: number) => void} error
- */
-function exec(cmd, args, complete = noop, error = noop) {
- console.log(`${cmd} ${args.join(" ")}`);
- // TODO (weswig): Update child_process types to add windowsVerbatimArguments to the type definition
- 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 });
- ex.on("exit", (code) => code === 0 ? complete() : error(/*e*/ undefined, code));
- ex.on("error", error);
-}
+const builtGeneratedDiagnosticMessagesJson = "built/local/diagnosticMessages.generated.json";
+gulp.task(builtGeneratedDiagnosticMessagesJson, /*help*/ false, [diagnosticInformationMapTs], () =>
+ gulp.src([diagnosticMessagesGeneratedJson], { base: "src/compiler" })
+ .pipe(newer(builtGeneratedDiagnosticMessagesJson))
+ .pipe(gulp.dest("built/local")));
-/**
- * @param {string} cmd
- */
-function possiblyQuote(cmd) {
- return cmd.indexOf(" ") >= 0 ? `"${cmd}"` : cmd;
-}
-
-/**
- * @param diagnostics {ts.Diagnostic[]}
- * @param [pretty] {boolean}
- */
-function diagnosticsToString(diagnostics, pretty) {
- const host = {
- getCurrentDirectory() { return process.cwd(); },
- getCanonicalFileName(fileName) { return fileName; },
- getNewLine() { return os.EOL; }
- };
- return pretty ? ts.formatDiagnosticsWithColorAndContext(diagnostics, host) :
- ts.formatDiagnostics(diagnostics, host);
-}
-
-/** @param diagnostics {ts.Diagnostic[]} */
-function reportDiagnostics(diagnostics) {
- console.log(diagnosticsToString(diagnostics, process.stdout.isTTY));
-}
-
-/** @param jsonPath {string} */
-function readJson(jsonPath) {
- const jsonText = fs.readFileSync(jsonPath, "utf8");
- const result = ts.parseConfigFileTextToJson(jsonPath, jsonText);
- if (result.error) {
- reportDiagnostics([result.error]);
- throw new Error("An error occurred during parse.");
- }
- return result.config;
-}
-
-let useDebugMode = true;
-let host = cmdLineOptions.host;
-
-// Constants
-const compilerDirectory = "src/compiler/";
-const harnessDirectory = "src/harness/";
-const libraryDirectory = "src/lib/";
-const scriptsDirectory = "scripts/";
-const docDirectory = "doc/";
-const lclDirectory = "src/loc/lcl";
-
-const builtDirectory = "built/";
-const builtLocalDirectory = "built/local/";
-const lkgDirectory = "lib/";
-
-const copyright = "CopyrightNotice.txt";
-
-const compilerFilename = "tsc.js";
-const lkgCompiler = path.join(lkgDirectory, compilerFilename);
-const builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
-
-const nodeModulesPathPrefix = path.resolve("./node_modules/.bin/");
-const isWin = /^win/.test(process.platform);
-const mocha = path.join(nodeModulesPathPrefix, "mocha") + (isWin ? ".cmd" : "");
-
-/** @type {{ libs: string[], paths?: Record, sources?: Record }} */
-const libraries = readJson("./src/lib/libs.json");
+gulp.task(
+ "generate-diagnostics",
+ "Generates a diagnostic file in TypeScript based on an input JSON file",
+ [diagnosticInformationMapTs]);
+// Localize diagnostics
/**
* .lcg file is what localization team uses to know what messages to localize.
- * The file is always generated in 'enu\diagnosticMessages.generated.json.lcg'
+ * The file is always generated in 'enu/diagnosticMessages.generated.json.lcg'
*/
-const generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessages.generated.json.lcg");
+const generatedLCGFile = "built/local/enu/diagnosticMessages.generated.json.lcg";
/**
* The localization target produces the two following transformations:
@@ -165,750 +129,269 @@ const generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessag
* generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json
*/
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"]
- .map(f => path.join(builtLocalDirectory, f, "diagnosticMessages.generated.json"))
+ .map(f => `built/local/${f}/diagnosticMessages.generated.json`)
.concat(generatedLCGFile);
-const libraryTargets = libraries.libs.map(lib => {
- const relativeSources = ["header.d.ts"].concat(libraries.sources && libraries.sources[lib] || [lib + ".d.ts"]);
- const relativeTarget = libraries.paths && libraries.paths[lib] || ("lib." + lib + ".d.ts");
- const sources = [copyright].concat(relativeSources.map(s => path.join(libraryDirectory, s)));
- const target = path.join(builtLocalDirectory, relativeTarget);
- gulp.task(target, /*help*/ false, [], () =>
- gulp.src(sources)
- .pipe(newer(target))
- .pipe(concat(target, { newLine: "\n\n" }))
- .pipe(gulp.dest(".")));
- return target;
+gulp.task(generatedLCGFile, /*help*/ false, [generateLocalizedDiagnosticMessagesJs, diagnosticInformationMapTs], (done) => {
+ if (needsUpdate(diagnosticMessagesGeneratedJson, generatedLCGFile)) {
+ return execAsync(host, [generateLocalizedDiagnosticMessagesJs, "src/loc/lcl", "built/local", diagnosticMessagesGeneratedJson], { ignoreExitCode: true });
+ }
});
-const configurePreleleaseJs = path.join(scriptsDirectory, "configurePrerelease.js");
-const configurePreleleaseTs = path.join(scriptsDirectory, "configurePrerelease.ts");
-const packageJson = "package.json";
-const versionFile = path.join(compilerDirectory, "core.ts");
+gulp.task("localize", /*help*/ false, [generatedLCGFile]);
-/**
- * @param {string | string[]} source
- * @param {string | string[]} dest
- * @returns {boolean}
- */
-function needsUpdate(source, dest) {
- if (typeof source === "string" && typeof dest === "string") {
- if (fs.existsSync(dest)) {
- const {mtime: outTime} = fs.statSync(dest);
- const {mtime: inTime} = fs.statSync(source);
- if (+inTime <= +outTime) {
- return false;
- }
+const typescriptServicesProject = "built/local/typescriptServices.tsconfig.json";
+gulp.task(typescriptServicesProject, /*help*/ false, () => {
+ // NOTE: flatten services so that we can properly strip @internal
+ project.flatten("src/services/tsconfig.json", typescriptServicesProject, {
+ compilerOptions: {
+ "stripInternal": true,
+ "outFile": "typescriptServices.js"
}
- }
- else if (typeof source === "string" && typeof dest !== "string") {
- const {mtime: inTime} = fs.statSync(source);
- for (const filepath of dest) {
- if (fs.existsSync(filepath)) {
- const {mtime: outTime} = fs.statSync(filepath);
- if (+inTime > +outTime) {
- return true;
- }
- }
- else {
- return true;
- }
- }
- return false;
- }
- else if (typeof source !== "string" && typeof dest === "string") {
- if (fs.existsSync(dest)) {
- const {mtime: outTime} = fs.statSync(dest);
- for (const filepath of source) {
- if (fs.existsSync(filepath)) {
- const {mtime: inTime} = fs.statSync(filepath);
- if (+inTime > +outTime) {
- return true;
- }
- }
- else {
- return true;
- }
- }
- return false;
- }
- }
- else if (typeof source !== "string" && typeof dest !== "string") {
- for (let i = 0; i < source.length; i++) {
- if (!dest[i]) {
- continue;
- }
- if (fs.existsSync(dest[i])) {
- const {mtime: outTime} = fs.statSync(dest[i]);
- const {mtime: inTime} = fs.statSync(source[i]);
- if (+inTime > +outTime) {
- return true;
- }
- }
- else {
- return true;
- }
- }
- return false;
- }
- return true;
-}
-
-/**
- * @param {tsc.Settings} base
- * @param {boolean=} useBuiltCompiler
- * @returns {tsc.Settings}
- */
-function getCompilerSettings(base, useBuiltCompiler) {
- const copy = /** @type {tsc.Settings} */ ({});
- for (const key in base) {
- copy[key] = base[key];
- }
- copy.strictNullChecks = true;
- if (!useDebugMode) {
- if (copy.removeComments === undefined) copy.removeComments = true;
- }
- copy.newLine = "lf";
- if (useBuiltCompiler === true) {
- copy.typescript = /** @type {*} */ (require("./built/local/typescript.js"));
- }
- else if (useBuiltCompiler === false) {
- copy.typescript = /** @type {*} */ (require("./lib/typescript.js"));
- }
- return copy;
-}
-
-gulp.task(configurePreleleaseJs, /*help*/ false, [], () => {
- /** @type {tsc.Settings} */
- const settings = {
- declaration: false,
- removeComments: true,
- noResolve: false,
- stripInternal: false,
- module: "commonjs"
- };
- return gulp.src(configurePreleleaseTs)
- .pipe(sourcemaps.init())
- .pipe(tsc(settings))
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest("./scripts"));
-});
-
-
-// Nightly management tasks
-gulp.task("configure-nightly", "Runs scripts/configurePrerelease.ts to prepare a build for nightly publishing", [configurePreleleaseJs], (done) => {
- exec(host, [configurePreleleaseJs, "dev", packageJson, versionFile], done, done);
-});
-gulp.task("publish-nightly", "Runs `npm publish --tag next` to create a new nightly build on npm", ["LKG"], () => {
- return runSequence("clean", "useDebugMode", "runtests-parallel", (done) => {
- exec("npm", ["publish", "--tag", "next"], done, done);
});
+})
+
+const typescriptServicesJs = "built/local/typescriptServices.js";
+const typescriptServicesDts = "built/local/typescriptServices.d.ts";
+const typescriptServicesProjectTask = project.defer(typescriptServicesProject, {
+ dts: files => files.pipe(convertConstEnums()),
+ release: { compilerOptions: { removeComments: true } }
});
-const importDefinitelyTypedTestsDirectory = path.join(scriptsDirectory, "importDefinitelyTypedTests");
-const importDefinitelyTypedTestsJs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.js");
-const importDefinitelyTypedTestsTs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.ts");
+gulp.task(typescriptServicesJs, /*help*/ false, ["lib", "generate-diagnostics", typescriptServicesProject], typescriptServicesProjectTask, { aliases: [typescriptServicesDts] });
-gulp.task(importDefinitelyTypedTestsJs, /*help*/ false, [], () => {
- /** @type {tsc.Settings} */
- const settings = getCompilerSettings({
- declaration: false,
- removeComments: true,
- noResolve: false,
- stripInternal: false,
- outFile: importDefinitelyTypedTestsJs
- }, /*useBuiltCompiler*/ false);
- return gulp.src(importDefinitelyTypedTestsTs)
- .pipe(sourcemaps.init())
- .pipe(tsc(settings))
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest("."));
-});
+const typescriptJs = "built/local/typescript.js";
+gulp.task(typescriptJs, /*help*/ false, [typescriptServicesJs], () =>
+ gulp.src([typescriptServicesJs], { base: "built/local" })
+ .pipe(newer(typescriptJs))
+ .pipe(rename("typescript.js"))
+ .pipe(gulp.dest("built/local")))
-gulp.task("importDefinitelyTypedTests", "Runs scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts to copy DT's tests to the TS-internal RWC tests", [importDefinitelyTypedTestsJs], (done) => {
- exec(host, [importDefinitelyTypedTestsJs, "./", "../DefinitelyTyped"], done, done);
-});
+const typescriptDts = "built/local/typescript.d.ts";
+gulp.task(typescriptDts, /*help*/ false, [typescriptServicesDts], () =>
+ gulp.src([typescriptServicesDts], { base: "built/local" })
+ .pipe(newer(typescriptDts))
+ .pipe(append("\nexport = ts;"))
+ .pipe(rename("typescript.d.ts"))
+ .pipe(gulp.dest("built/local")));
-gulp.task("lib", "Builds the library targets", libraryTargets);
+const typescriptStandaloneDts = "built/local/typescript_standalone.d.ts";
+gulp.task(typescriptStandaloneDts, /*help*/ false, [typescriptServicesDts], () =>
+ gulp.src([typescriptServicesDts], { base: "built/local" })
+ .pipe(newer(typescriptStandaloneDts))
+ .pipe(replace(/declare (namespace|module) ts/g, 'declare module "typescript"'))
+ .pipe(rename("typescript_standalone.d.ts"))
+ .pipe(gulp.dest("built/local")));
+// build all 'typescriptServices'-related outputs
+gulp.task("typescriptServices", /*help*/ false, [typescriptServicesJs, typescriptServicesDts, typescriptJs, typescriptDts, typescriptStandaloneDts]);
-// Generate diagnostics
-const processDiagnosticMessagesJs = path.join(scriptsDirectory, "processDiagnosticMessages.js");
-const processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnosticMessages.ts");
-const diagnosticMessagesJson = path.join(compilerDirectory, "diagnosticMessages.json");
-const diagnosticInfoMapTs = path.join(compilerDirectory, "diagnosticInformationMap.generated.ts");
-const generatedDiagnosticMessagesJSON = path.join(compilerDirectory, "diagnosticMessages.generated.json");
-const builtGeneratedDiagnosticMessagesJSON = path.join(builtLocalDirectory, "diagnosticMessages.generated.json");
+// Add the "built" compiler with a dependency on the built version of the compiler.
+project.addTypeScript("built", "./built/local/typescriptServices.js", [typescriptServicesJs]);
-// processDiagnosticMessages script
-gulp.task(processDiagnosticMessagesJs, /*help*/ false, [], () => {
- const diagsProject = tsc.createProject('./scripts/processDiagnosticMessages.tsconfig.json');
- return diagsProject.src()
- .pipe(newer(processDiagnosticMessagesJs))
- .pipe(diagsProject())
- .pipe(gulp.dest(scriptsDirectory));
-});
+const tscProject = "src/tsc/tsconfig.json";
+const tscJs = "built/local/tsc.js";
+gulp.task(tscJs, /*help*/ false, [project(tscProject, { typescript: "built", release: { compilerOptions: { removeComments: true } } })]);
-// The generated diagnostics map; built for the compiler and for the "generate-diagnostics" task
-gulp.task(diagnosticInfoMapTs, [processDiagnosticMessagesJs], (done) => {
- if (needsUpdate(diagnosticMessagesJson, [generatedDiagnosticMessagesJSON, diagnosticInfoMapTs])) {
- exec(host, [processDiagnosticMessagesJs, diagnosticMessagesJson], done, done);
- }
- else {
- done();
- }
-});
+const cancellationTokenProject = "src/cancellationToken/tsconfig.json";
+const cancellationTokenJs = "built/local/cancellationToken.js";
+gulp.task(cancellationTokenJs, /*help*/ false, [project(cancellationTokenProject, { typescript: "built", release: { compilerOptions: { removeComments: true } } })]);
-gulp.task(builtGeneratedDiagnosticMessagesJSON, [diagnosticInfoMapTs], (done) => {
- if (fs.existsSync(builtLocalDirectory) && needsUpdate(generatedDiagnosticMessagesJSON, builtGeneratedDiagnosticMessagesJSON)) {
- fs.writeFileSync(builtGeneratedDiagnosticMessagesJSON, fs.readFileSync(generatedDiagnosticMessagesJSON));
- }
- done();
-});
+const typingsInstallerProject = "src/typingsInstaller/tsconfig.json";
+const typingsInstallerJs = "built/local/typingsInstaller.js";
+gulp.task(typingsInstallerJs, /*help*/ false, [project(typingsInstallerProject, { typescript: "built", release: { compilerOptions: { removeComments: true } } })]);
-gulp.task("generate-diagnostics", "Generates a diagnostic file in TypeScript based on an input JSON file", [diagnosticInfoMapTs]);
+const tsserverProject = "src/tsserver/tsconfig.json";
+const tsserverJs = "built/local/tsserver.js";
+gulp.task(tsserverJs, /*help*/ false, [project(tsserverProject, { typescript: "built", release: { compilerOptions: { removeComments: true } } })]);
-// Localize diagnostics script
-const generateLocalizedDiagnosticMessagesJs = path.join(scriptsDirectory, "generateLocalizedDiagnosticMessages.js");
-const generateLocalizedDiagnosticMessagesTs = path.join(scriptsDirectory, "generateLocalizedDiagnosticMessages.ts");
+const watchGuardProject = "src/watchGuard/tsconfig.json";
+const watchGuardJs = "built/local/watchGuard.js";
+gulp.task(watchGuardJs, /*help*/ false, [project(watchGuardProject, { typescript: "built", release: { compilerOptions: { removeComments: true } } })]);
-gulp.task(generateLocalizedDiagnosticMessagesJs, /*help*/ false, [], () => {
- /** @type {tsc.Settings} */
- const settings = getCompilerSettings({
- target: "es5",
- declaration: false,
- removeComments: true,
- noResolve: false,
- stripInternal: false,
- types: ["node", "xml2js"]
- }, /*useBuiltCompiler*/ false);
- return gulp.src(generateLocalizedDiagnosticMessagesTs)
- .pipe(newer(generateLocalizedDiagnosticMessagesJs))
- .pipe(sourcemaps.init())
- .pipe(tsc(settings))
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest(scriptsDirectory));
-});
+const typesMapJson = "built/local/typesMap.json";
+gulp.task(typesMapJson, /*help*/ false, [], () =>
+ gulp.src("src/server/typesMap.json")
+ .pipe(newer(typesMapJson))
+ .pipe(insert.transform(contents => (JSON.parse(contents), contents)))
+ .pipe(gulp.dest("built/local")));
-// Localize diagnostics
-gulp.task(generatedLCGFile, [generateLocalizedDiagnosticMessagesJs, diagnosticInfoMapTs], (done) => {
- if (fs.existsSync(builtLocalDirectory) && needsUpdate(generatedDiagnosticMessagesJSON, generatedLCGFile)) {
- exec(host, [generateLocalizedDiagnosticMessagesJs, lclDirectory, builtLocalDirectory, generatedDiagnosticMessagesJSON], done, done);
- }
-});
+const tsserverlibraryDts = "built/local/tsserverlibrary.d.ts";
+gulp.task(tsserverlibraryDts, /*help*/ false, [tsserverJs], () =>
+ gulp.src(["built/local/compiler.d.ts", "built/local/jsTyping.d.ts", "built/local/services.d.ts", "built/local/server.d.ts"], { base: "built/local" })
+ .pipe(convertConstEnums())
+ .pipe(concat("tsserverlibrary.d.ts", { newLine: "\n" }))
+ .pipe(append("\nexport = ts;\nexport as namespace ts;"))
+ .pipe(gulp.dest("built/local")));
-gulp.task("localize", [generatedLCGFile]);
+gulp.task(
+ "lssl",
+ "Builds language service server library",
+ [tsserverlibraryDts]);
-const servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
-const standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
-const nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
-const nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
-const nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_standalone.d.ts");
+gulp.task(
+ "local",
+ "Builds the full compiler and services",
+ [tscJs, "typescriptServices", tsserverJs, builtGeneratedDiagnosticMessagesJson, tsserverlibraryDts, "localize"]);
-/** @type {string} */
-let copyrightContent;
-/**
- * @param {boolean} outputCopyright
- */
-function prependCopyright(outputCopyright = !useDebugMode) {
- return insert.prepend(outputCopyright ? (copyrightContent || (copyrightContent = fs.readFileSync(copyright).toString())) : "");
-}
-
-function getCompilerPath(useBuiltCompiler) {
- return useBuiltCompiler ? "./built/local/typescript.js" : "./lib/typescript.js";
-}
-
-gulp.task(builtLocalCompiler, /*help*/ false, [servicesFile], () => {
- const localCompilerProject = tsc.createProject("src/compiler/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ true));
- return localCompilerProject.src()
- .pipe(newer(builtLocalCompiler))
- .pipe(sourcemaps.init())
- .pipe(localCompilerProject())
- .pipe(prependCopyright())
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest("src/compiler"));
-});
-
-gulp.task(servicesFile, /*help*/ false, ["lib", "generate-diagnostics"], () => {
- const servicesProject = tsc_oop.createProject("src/services/tsconfig.json", getCompilerSettings({ removeComments: false }), { typescript: getCompilerPath(/*useBuiltCompiler*/ false) });
- const {js, dts} = servicesProject.src()
- .pipe(newer(servicesFile))
- .pipe(sourcemaps.init())
- .pipe(servicesProject());
- const completedJs = js.pipe(prependCopyright())
- .pipe(sourcemaps.write("."));
- const completedDts = dts.pipe(prependCopyright(/*outputCopyright*/ true))
- .pipe(insert.transform((contents, file) => {
- file.path = standaloneDefinitionsFile;
- return contents.replace(constEnumCaptureRegexp, constEnumReplacement);
- }));
- return merge2([
- completedJs,
- completedJs.pipe(clone())
- .pipe(insert.transform((content, file) => (file.path = nodePackageFile, content))),
- completedDts,
- completedDts.pipe(clone())
- .pipe(insert.transform((content, file) => {
- file.path = nodeDefinitionsFile;
- return content + "\nexport = ts;";
- }))
- .pipe(gulp.dest("src/services")),
- completedDts.pipe(clone())
- .pipe(insert.transform((content, file) => {
- file.path = nodeStandaloneDefinitionsFile;
- return content.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
- }))
- ]).pipe(gulp.dest("src/services"));
-});
-
-// cancellationToken.js
-const cancellationTokenJs = path.join(builtLocalDirectory, "cancellationToken.js");
-gulp.task(cancellationTokenJs, /*help*/ false, [servicesFile], () => {
- const cancellationTokenProject = tsc.createProject("src/server/cancellationToken/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ true));
- return cancellationTokenProject.src()
- .pipe(newer(cancellationTokenJs))
- .pipe(sourcemaps.init())
- .pipe(cancellationTokenProject())
- .pipe(prependCopyright())
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest(builtLocalDirectory));
-});
-
-// typingsInstallerFile.js
-const typingsInstallerJs = path.join(builtLocalDirectory, "typingsInstaller.js");
-gulp.task(typingsInstallerJs, /*help*/ false, [servicesFile], () => {
- const cancellationTokenProject = tsc.createProject("src/server/typingsInstaller/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ true));
- return cancellationTokenProject.src()
- .pipe(newer(typingsInstallerJs))
- .pipe(sourcemaps.init())
- .pipe(cancellationTokenProject())
- .pipe(prependCopyright())
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest("src/server/typingsInstaller"));
-});
-
-const serverFile = path.join(builtLocalDirectory, "tsserver.js");
-
-gulp.task(serverFile, /*help*/ false, [servicesFile, typingsInstallerJs, cancellationTokenJs], () => {
- const serverProject = tsc.createProject("src/server/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ true));
- return serverProject.src()
- .pipe(newer(serverFile))
- .pipe(sourcemaps.init())
- .pipe(serverProject())
- .pipe(prependCopyright())
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest("src/server"));
-});
-
-const typesMapJson = path.join(builtLocalDirectory, "typesMap.json");
-const tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
-const tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
-
-gulp.task(tsserverLibraryFile, /*help*/ false, [servicesFile, typesMapJson], (done) => {
- const serverLibraryProject = tsc_oop.createProject("src/server/tsconfig.library.json", getCompilerSettings({ removeComments: false }), { typescript: getCompilerPath(/*useBuiltCompiler*/ true) });
- /** @type {{ js: NodeJS.ReadableStream, dts: NodeJS.ReadableStream }} */
- const {js, dts} = serverLibraryProject.src()
- .pipe(sourcemaps.init())
- .pipe(newer(/** @type {*} */({ dest: tsserverLibraryFile, extra: ["src/compiler/**/*.ts", "src/services/**/*.ts"] })))
- .pipe(serverLibraryProject());
-
- return merge2([
- js.pipe(prependCopyright())
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest("src/server")),
- dts.pipe(prependCopyright(/*outputCopyright*/ true))
- .pipe(insert.transform((content) => {
- return content.replace(constEnumCaptureRegexp, constEnumReplacement) + "\nexport = ts;\nexport as namespace ts;";
- }))
- .pipe(gulp.dest("src/server"))
- ]);
-});
-
-gulp.task(typesMapJson, /*help*/ false, [], () => {
- return gulp.src("src/server/typesMap.json")
- .pipe(insert.transform((contents, file) => {
- JSON.parse(contents);
- return contents;
- }))
- .pipe(gulp.dest(builtLocalDirectory));
-});
-
-gulp.task("lssl", "Builds language service server library", [tsserverLibraryFile]);
-gulp.task("local", "Builds the full compiler and services", [builtLocalCompiler, servicesFile, serverFile, builtGeneratedDiagnosticMessagesJSON, tsserverLibraryFile, "localize"]);
-gulp.task("tsc", "Builds only the compiler", [builtLocalCompiler]);
+gulp.task(
+ "tsc",
+ "Builds only the compiler",
+ [tscJs]);
// Generate Markdown spec
-const word2mdJs = path.join(scriptsDirectory, "word2md.js");
-const word2mdTs = path.join(scriptsDirectory, "word2md.ts");
-const specWord = path.join(docDirectory, "TypeScript Language Specification.docx");
-const specMd = path.join(docDirectory, "spec.md");
+const specMd = "doc/spec.md";
+gulp.task(specMd, /*help*/ false, [word2mdJs], () =>
+ execAsync("cscript", ["//nologo", word2mdJs, path.resolve(specMd), path.resolve("doc/TypeScript Language Specification.docx")]));
-gulp.task(word2mdJs, /*help*/ false, [], () => {
- /** @type {tsc.Settings} */
- const settings = getCompilerSettings({
- outFile: word2mdJs
- }, /*useBuiltCompiler*/ false);
- return gulp.src(word2mdTs)
- .pipe(newer(word2mdJs))
- .pipe(sourcemaps.init())
- .pipe(tsc(settings))
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest("."));
-});
-
-gulp.task(specMd, /*help*/ false, [word2mdJs], (done) => {
- const specWordFullPath = path.resolve(specWord);
- const specMDFullPath = path.resolve(specMd);
- const cmd = "cscript //nologo " + word2mdJs + " \"" + specWordFullPath + "\" " + "\"" + specMDFullPath + "\"";
- console.log(cmd);
- cp.exec(cmd, done);
-});
-
-gulp.task("generate-spec", "Generates a Markdown version of the Language Specification", [specMd]);
-
-gulp.task("clean", "Cleans the compiler output, declare files, and tests", [], () => {
- return del([builtDirectory]);
-});
-
-gulp.task("useDebugMode", /*help*/ false, [], (done) => { useDebugMode = true; done(); });
-gulp.task("dontUseDebugMode", /*help*/ false, [], (done) => { useDebugMode = false; done(); });
-
-gulp.task("VerifyLKG", /*help*/ false, [], () => {
- const expectedFiles = [builtLocalCompiler, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, typingsInstallerJs, cancellationTokenJs].concat(libraryTargets);
- const missingFiles = expectedFiles.
- concat(localizationTargets).
- filter(f => !fs.existsSync(f));
- if (missingFiles.length > 0) {
- throw new Error("Cannot replace the LKG unless all built targets are present in directory " + builtLocalDirectory +
- ". The following files are missing:\n" + missingFiles.join("\n"));
- }
- // Copy all the targets into the LKG directory
- return gulp.src([...expectedFiles, path.join(builtLocalDirectory, "**"), `!${path.join(builtLocalDirectory, "tslint")}`, `!${path.join(builtLocalDirectory, "*.*")}`]).pipe(gulp.dest(lkgDirectory));
-});
-
-gulp.task("LKGInternal", /*help*/ false, ["lib", "local"]);
-
-gulp.task("LKG", "Makes a new LKG out of the built js files", ["clean", "dontUseDebugMode"], () => {
- const sizeBefore = getDirSize(lkgDirectory);
- const seq = runSequence("LKGInternal", "VerifyLKG");
- const sizeAfter = getDirSize(lkgDirectory);
- if (sizeAfter > (sizeBefore * 1.10)) {
- throw new Error("The lib folder increased by 10% or more. This likely indicates a bug.");
- }
- return seq;
-});
+gulp.task(
+ "generate-spec",
+ "Generates a Markdown version of the Language Specification",
+ [specMd]);
+gulp.task(
+ "LKG",
+ "Makes a new LKG out of the built js files",
+ () => runSequence("clean-built", "dontUseDebugMode", ["scripts", "local", cancellationTokenJs, typingsInstallerJs, watchGuardJs],
+ () => {
+ const expectedFiles = [
+ tscJs,
+ typescriptServicesJs,
+ tsserverJs,
+ typescriptJs,
+ typescriptDts,
+ typescriptServicesDts,
+ tsserverlibraryDts,
+ tsserverlibraryDts,
+ typingsInstallerJs,
+ cancellationTokenJs
+ ].concat(libraryTargets);
+ const missingFiles = expectedFiles
+ .concat(localizationTargets)
+ .filter(f => !fs.existsSync(f));
+ if (missingFiles.length > 0) {
+ throw new Error("Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n" + missingFiles.join("\n"));
+ }
+ const sizeBefore = getDirSize("lib");
+ return execAsync(host, [produceLKGJs]).then(() => {
+ const sizeAfter = getDirSize("lib");
+ if (sizeAfter > (sizeBefore * 1.10)) {
+ throw new Error("The lib folder increased by 10% or more. This likely indicates a bug.");
+ }
+ });
+ }));
// Task to build the tests infrastructure using the built compiler
-const run = path.join(builtLocalDirectory, "run.js");
-gulp.task(run, /*help*/ false, [servicesFile, tsserverLibraryFile], () => {
- const testProject = tsc_oop.createProject("src/harness/tsconfig.json", getCompilerSettings({}), { typescript: getCompilerPath(/*useBuiltCompiler*/ true) });
- return testProject.src()
- .pipe(newer(run))
- .pipe(sourcemaps.init())
- .pipe(testProject())
- .pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: "." }))
- .pipe(gulp.dest("src/harness"));
-});
+const testRunnerProject = "src/testRunner/tsconfig.json";
+const runJs = "built/local/run.js";
+gulp.task(runJs, /*help*/ false, [project(testRunnerProject, { typescript: "built", deps: [tsserverlibraryDts] })]);
-const internalTests = "internal/";
+gulp.task(
+ "tests",
+ "Builds the test infrastructure using the built compiler",
+ [runJs]);
-const localBaseline = "tests/baselines/local/";
-const refBaseline = "tests/baselines/reference/";
+gulp.task(
+ "tests-debug",
+ "Builds the test sources and automation in debug mode",
+ () => runSequence("useDebugMode", "tests"));
-const localRwcBaseline = path.join(internalTests, "baselines/rwc/local");
-const refRwcBaseline = path.join(internalTests, "baselines/rwc/reference");
+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));
-const localTest262Baseline = path.join(internalTests, "baselines/test262/local");
-
-gulp.task("tests", "Builds the test infrastructure using the built compiler", [run]);
-gulp.task("tests-debug", "Builds the test sources and automation in debug mode", () => {
- return runSequence("useDebugMode", "tests");
-});
-
-function deleteTemporaryProjectOutput() {
- return del(path.join(localBaseline, "projectOutput/"));
-}
-
-/** @type {string} */
-let savedNodeEnv;
-function setNodeEnvToDevelopment() {
- savedNodeEnv = process.env.NODE_ENV;
- process.env.NODE_ENV = "development";
-}
-
-function restoreSavedNodeEnv() {
- process.env.NODE_ENV = savedNodeEnv;
-}
-
-/**
- * @param {string} defaultReporter
- * @param {boolean} runInParallel
- * @param {(e?: any) => void} done
- */
-function runConsoleTests(defaultReporter, runInParallel, done) {
- const lintFlag = cmdLineOptions.lint;
- cleanTestDirs((err) => {
- if (err) { console.error(err); failWithStatus(err, 1); }
- let testTimeout = cmdLineOptions.timeout;
- const debug = cmdLineOptions.debug;
- const inspect = cmdLineOptions.inspect;
- const tests = cmdLineOptions.tests;
- const runners = cmdLineOptions.runners;
- const light = cmdLineOptions.light;
- const stackTraceLimit = cmdLineOptions.stackTraceLimit;
- const testConfigFile = "test.config";
- 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) {
- writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout);
- }
-
- const colors = cmdLineOptions.colors;
- const reporter = cmdLineOptions.reporter || defaultReporter;
-
- // 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) {
- const args = [];
- args.push("-R", reporter);
- 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(run);
- setNodeEnvToDevelopment();
- exec(mocha, args, lintThenFinish, finish);
-
- }
- else {
- // run task to load all tests and partition them between workers
- setNodeEnvToDevelopment();
- exec(host, [run], lintThenFinish, finish);
- }
- });
-
- /**
- * @param {any=} err
- * @param {number=} status
- */
- function failWithStatus(err, status) {
- if (err || status) {
- process.exit(typeof status === "number" ? status : 2);
- }
- done();
- }
-
- function lintThenFinish() {
- if (lintFlag) {
- runSequence("lint", finish);
- }
- else {
- finish();
- }
- }
-
- /**
- * @param {any=} error
- * @param {number=} errorStatus
- */
- function finish(error, errorStatus) {
- restoreSavedNodeEnv();
- deleteTestConfig().then(deleteTemporaryProjectOutput).then(() => {
- if (error !== undefined || errorStatus !== undefined) {
- failWithStatus(error, errorStatus);
- }
- else {
- done();
- }
- });
- }
-
- function deleteTestConfig() {
- return del("test.config");
- }
-}
-
-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"], (done) => {
- runConsoleTests("min", /*runInParallel*/ true, done);
-});
-gulp.task("runtests",
+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"],
- (done) => {
- runConsoleTests("mocha-fivemat-progress-reporter", /*runInParallel*/ false, done);
- });
+ () => runConsoleTests(runJs, "mocha-fivemat-progress-reporter", /*runInParallel*/ false));
-const nodeServerOutFile = "tests/webTestServer.js";
-const nodeServerInFile = "tests/webTestServer.ts";
-gulp.task(nodeServerOutFile, /*help*/ false, [servicesFile], () => {
- /** @type {tsc.Settings} */
- const settings = getCompilerSettings({ module: "commonjs", target: "es2015" }, /*useBuiltCompiler*/ true);
- return gulp.src(nodeServerInFile)
- .pipe(newer(nodeServerOutFile))
- .pipe(sourcemaps.init())
- .pipe(tsc(settings))
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest(path.dirname(nodeServerOutFile)));
-});
-
-const convertMap = require("convert-source-map");
-const sorcery = require("sorcery");
-const Vinyl = require("vinyl");
+const webTestServerProject = "tests/webTestServer.tsconfig.json";
+const webTestServerJs = "tests/webTestServer.js";
+gulp.task(webTestServerJs, /*help*/ false, [project(webTestServerProject, { typescript: "built", release: { compilerOptions: { removeComments: true } } })])
+gulp.task("clean:" + webTestServerJs, /*help*/ false, [project.clean(webTestServerProject, { typescript: "built" })])
const bundlePath = path.resolve("built/local/bundle.js");
-gulp.task("browserify", "Runs browserify on run.js to produce a file suitable for running tests in the browser", [servicesFile], (done) => {
- const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({ outFile: bundlePath, inlineSourceMap: true }, /*useBuiltCompiler*/ true));
- /** @type {*} */
- let originalMap;
- /** @type {string} */
- let prebundledContent;
- browserify(testProject.src()
- .pipe(newer(bundlePath))
- .pipe(sourcemaps.init())
- .pipe(testProject())
- .pipe(through2.obj((file, enc, next) => {
- if (originalMap) {
- throw new Error("Should only recieve one file!");
- }
- console.log(`Saving sourcemaps for ${file.path}`);
- originalMap = file.sourceMap;
- prebundledContent = file.contents.toString();
- // Make paths absolute to help sorcery deal with all the terrible paths being thrown around
- originalMap.sources = originalMap.sources.map(s => path.resolve(path.join("src/harness", s)));
- // browserify names input files this when they are streamed in, so this is what it puts in the sourcemap
- originalMap.file = "built/local/_stream_0.js";
-
- next(/*err*/ undefined, file.contents);
- }))
- .on("error", err => {
- return done(err);
- }), { debug: true, basedir: __dirname }) // Attach error handler to inner stream
- .bundle((err, contents) => {
- if (err) {
- if (err.message.match(/Cannot find module '.*_stream_0.js'/)) {
- return done(); // Browserify errors when we pass in no files when `newer` filters the input, we should count that as a success, though
+// TODO(rbuckton)
+gulp.task(
+ "browserify",
+ "Runs browserify on run.js to produce a file suitable for running tests in the browser",
+ [runJs],
+ (done) => {
+ /** @type {*} */
+ let originalMap;
+ /** @type {string} */
+ let prebundledContent;
+ browserify(gulp.src([runJs])
+ .pipe(newer(bundlePath))
+ .pipe(sourcemaps.init({ loadMaps: true }))
+ .pipe(through2.obj((file, enc, next) => {
+ if (originalMap) {
+ throw new Error("Should only recieve one file!");
}
+ log(`Saving sourcemaps for ${file.path}`);
+ originalMap = file.sourceMap;
+ prebundledContent = file.contents.toString();
+ // Make paths absolute to help sorcery deal with all the terrible paths being thrown around
+ originalMap.sources = originalMap.sources.map(s => path.resolve(path.join("src/harness", s)));
+ // browserify names input files this when they are streamed in, so this is what it puts in the sourcemap
+ originalMap.file = "built/local/_stream_0.js";
+
+ next(/*err*/ undefined, file.contents);
+ }))
+ .on("error", err => {
return done(err);
- }
- const stringContent = contents.toString();
- const file = new Vinyl({ contents, path: bundlePath });
- console.log(`Fixing sourcemaps for ${file.path}`);
- // assumes contents is a Buffer, since that's what browserify yields
- const maps = convertMap.fromSource(stringContent).toObject();
- delete maps.sourceRoot;
- maps.sources = maps.sources.map(s => path.resolve(s === "_stream_0.js" ? "built/local/_stream_0.js" : s));
- // Strip browserify's inline comments away (could probably just let sorcery do this, but then we couldn't fix the paths)
- file.contents = new Buffer(convertMap.removeComments(stringContent));
- const chain = sorcery.loadSync(bundlePath, {
- content: {
- "built/local/_stream_0.js": prebundledContent,
- [bundlePath]: stringContent
- },
- sourcemaps: {
- "built/local/_stream_0.js": originalMap,
- [bundlePath]: maps,
- "node_modules/source-map-support/source-map-support.js": undefined,
+ }), { debug: true, basedir: __dirname }) // Attach error handler to inner stream
+ .bundle((err, contents) => {
+ if (err) {
+ if (err.message.match(/Cannot find module '.*_stream_0.js'/)) {
+ return done(); // Browserify errors when we pass in no files when `newer` filters the input, we should count that as a success, though
+ }
+ return done(err);
}
- });
- const finalMap = chain.apply();
- file.sourceMap = finalMap;
+ const stringContent = contents.toString();
+ const file = new Vinyl({ contents, path: bundlePath });
+ log(`Fixing sourcemaps for ${file.path}`);
+ // assumes contents is a Buffer, since that's what browserify yields
+ const maps = convertMap.fromSource(stringContent).toObject();
+ delete maps.sourceRoot;
+ maps.sources = maps.sources.map(s => path.resolve(s === "_stream_0.js" ? "built/local/_stream_0.js" : s));
+ // Strip browserify's inline comments away (could probably just let sorcery do this, but then we couldn't fix the paths)
+ file.contents = new Buffer(convertMap.removeComments(stringContent));
+ const chain = sorcery.loadSync(bundlePath, {
+ content: {
+ "built/local/_stream_0.js": prebundledContent,
+ [bundlePath]: stringContent
+ },
+ sourcemaps: {
+ "built/local/_stream_0.js": originalMap,
+ [bundlePath]: maps,
+ "node_modules/source-map-support/source-map-support.js": undefined,
+ }
+ });
+ const finalMap = chain.apply();
+ file.sourceMap = finalMap;
- const stream = through2.obj((file, enc, callback) => {
- return callback(/*err*/ undefined, file);
+ const stream = through2.obj((file, enc, callback) => {
+ return callback(/*err*/ undefined, file);
+ });
+ stream.pipe(sourcemaps.write(".", { includeContent: false }))
+ .pipe(gulp.dest("."))
+ .on("end", done)
+ .on("error", done);
+ stream.write(file);
+ stream.end();
});
- stream.pipe(sourcemaps.write(".", { includeContent: false }))
- .pipe(gulp.dest("."))
- .on("end", done)
- .on("error", done);
- stream.write(file);
- stream.end();
- });
-});
-
-/**
- * @param {(e?: any) => void} done
- */
-function cleanTestDirs(done) {
- // Clean the local baselines & Rwc baselines directories
- del([
- localBaseline,
- localRwcBaseline,
- ]).then(() => {
- mkdirP(localRwcBaseline, (err) => {
- if (err) done(err);
- mkdirP(localTest262Baseline, () => {
- if (err) done(err);
- mkdirP(localBaseline, (err) => done(err));
- });
- });
});
-}
-/**
- * used to pass data from jake command line directly to run.js
- * @param {string} tests
- * @param {string} runners
- * @param {boolean} light
- * @param {string=} taskConfigsFolder
- * @param {number=} workerCount
- * @param {string=} stackTraceLimit
- * @param {number=} timeout
- */
-function writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, timeout) {
- const testConfigContents = JSON.stringify({
- test: tests ? [tests] : undefined,
- runner: runners ? runners.split(",") : undefined,
- light,
- workerCount,
- stackTraceLimit,
- taskConfigsFolder,
- noColor: !cmdLineOptions.colors,
- timeout,
- });
- console.log("Running tests with config: " + testConfigContents);
- fs.writeFileSync("test.config", testConfigContents);
-}
-
-
-gulp.task("runtests-browser", "Runs the tests using the built run.js file like 'gulp runtests'. Syntax is gulp runtests-browser. Additional optional parameters --tests=[regex], --browser=[chrome|IE]", ["browserify", nodeServerOutFile], (done) => {
- cleanTestDirs((err) => {
- if (err) { console.error(err); done(err); process.exit(1); }
- host = "node";
+gulp.task(
+ "runtests-browser",
+ "Runs the tests using the built run.js file like 'gulp runtests'. Syntax is gulp runtests-browser. Additional optional parameters --tests=[regex], --browser=[chrome|IE]",
+ ["browserify", webTestServerJs],
+ () => cleanTestDirs().then(() => {
const tests = cmdLineOptions.tests;
const runners = cmdLineOptions.runners;
const light = cmdLineOptions.light;
@@ -919,180 +402,141 @@ gulp.task("runtests-browser", "Runs the tests using the built run.js file like '
if (tests || runners || light) {
writeTestConfigFile(tests, runners, light);
}
-
- const args = [nodeServerOutFile];
+ const args = [webTestServerJs];
if (cmdLineOptions.browser) {
args.push(cmdLineOptions.browser);
}
if (tests) {
args.push(JSON.stringify(tests));
}
- exec(host, args, done, done);
- });
-});
+ return execAsync("node", args);
+ }));
-gulp.task("generate-code-coverage", "Generates code coverage data via istanbul", ["tests"], (done) => {
- const testTimeout = cmdLineOptions.timeout;
- exec("istanbul", ["cover", "node_modules/mocha/bin/_mocha", "--", "-R", "min", "-t", testTimeout.toString(), run], done, done);
-});
+gulp.task(
+ "generate-code-coverage",
+ "Generates code coverage data via istanbul",
+ ["tests"],
+ () => execAsync("istanbul", ["cover", "node_modules/mocha/bin/_mocha", "--", "-R", "min", "-t", "" + cmdLineOptions.testTimeout, runJs]));
-function getDiffTool() {
- const program = process.env.DIFF;
- if (!program) {
- console.error("Add the 'DIFF' environment variable to the path of the program you want to use.");
- process.exit(1);
- }
- return program;
-}
+gulp.task(
+ "diff",
+ "Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable",
+ () => execAsync(getDiffTool(), [refBaseline, localBaseline], { ignoreExitCode: true }));
-gulp.task("diff", "Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable", (done) => {
- exec(getDiffTool(), [refBaseline, localBaseline], done, done);
-});
-gulp.task("diff-rwc", "Diffs the RWC baselines using the diff tool specified by the 'DIFF' environment variable", (done) => {
- exec(getDiffTool(), [refRwcBaseline, localRwcBaseline], done, done);
-});
+gulp.task(
+ "diff-rwc",
+ "Diffs the RWC baselines using the diff tool specified by the 'DIFF' environment variable",
+ () => execAsync(getDiffTool(), [refRwcBaseline, localRwcBaseline], { ignoreExitCode: true }));
-gulp.task("baseline-accept", "Makes the most recent test results the new baseline, overwriting the old baseline", () => {
- return baselineAccept("");
-});
+gulp.task(
+ "baseline-accept",
+ "Makes the most recent test results the new baseline, overwriting the old baseline",
+ () => baselineAccept());
-function baselineAccept(subfolder = "") {
- return merge2(baselineCopy(subfolder), baselineDelete(subfolder));
-}
-
-function baselineCopy(subfolder = "") {
- return gulp.src([`tests/baselines/local/${subfolder}/**`, `!tests/baselines/local/${subfolder}/**/*.delete`])
- .pipe(gulp.dest(refBaseline));
-}
-
-function baselineDelete(subfolder = "") {
- return gulp.src(["tests/baselines/local/**/*.delete"])
- .pipe(insert.transform((content, fileObj) => {
- const target = path.join(refBaseline, fileObj.relative.substr(0, fileObj.relative.length - ".delete".length));
- del.sync(target);
- del.sync(fileObj.path);
- return "";
- }));
-}
-
-gulp.task("baseline-accept-rwc", "Makes the most recent rwc test results the new baseline, overwriting the old baseline", () => {
- return baselineAccept("rwc");
-});
-
-
-gulp.task("baseline-accept-test262", "Makes the most recent test262 test results the new baseline, overwriting the old baseline", () => {
- return baselineAccept("test262");
-});
+gulp.task(
+ "baseline-accept-rwc",
+ "Makes the most recent rwc test results the new baseline, overwriting the old baseline",
+ () => baselineAccept("rwc"));
+gulp.task(
+ "baseline-accept-test262",
+ "Makes the most recent test262 test results the new baseline, overwriting the old baseline",
+ () => baselineAccept("test262"));
// Webhost
-const webhostPath = "tests/webhost/webtsc.ts";
-const webhostJsPath = "tests/webhost/webtsc.js";
-gulp.task(webhostJsPath, /*help*/ false, [servicesFile], () => {
- const settings = getCompilerSettings({
- outFile: webhostJsPath
- }, /*useBuiltCompiler*/ true);
- return gulp.src(webhostPath)
- .pipe(newer(webhostJsPath))
- .pipe(sourcemaps.init())
- .pipe(tsc(settings))
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest(path.dirname(webhostJsPath)));
-});
-
-gulp.task("webhost", "Builds the tsc web host", [webhostJsPath], () => {
- return gulp.src(path.join(builtLocalDirectory, "lib.d.ts")).pipe(gulp.dest("tests/webhost/"));
-});
+const webtscProject = "tests/webhost/webtsc.tsconfig.json";
+const webtscJs = "tests/webhost/webtsc.js";
+gulp.task(webtscJs, /*help*/ false, [project(webtscProject, { typescript: "built", release: { compilerOptions: { removeComments: true } } })]);
+gulp.task("clean:" + webtscJs, /*help*/ false, [project.clean(webtscProject, { typescript: "built" })]);
+gulp.task("webhost", "Builds the tsc web host", [webtscJs], () =>
+ gulp.src("built/local/lib.d.ts")
+ .pipe(gulp.dest("tests/webhost/")));
// Perf compiler
-const perftscPath = "tests/perftsc.ts";
-const perftscJsPath = "built/local/perftsc.js";
-gulp.task(perftscJsPath, /*help*/ false, [servicesFile], () => {
- const settings = getCompilerSettings({
- outFile: perftscJsPath
- }, /*useBuiltCompiler*/ true);
- return gulp.src(perftscPath)
- .pipe(newer(perftscJsPath))
- .pipe(sourcemaps.init())
- .pipe(tsc(settings))
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest("."));
-});
-
-gulp.task("perftsc", "Builds augmented version of the compiler for perf tests", [perftscJsPath]);
+const perftscProject = "tests/perftsc.tsconfig.json";
+const perftscJs = "built/local/perftsc.js";
+gulp.task(perftscJs, /*help*/ false, [project(perftscProject, { typescript: "built", release: { compilerOptions: { removeComments: true } } })]);
+gulp.task("clean:" + perftscJs, /*help*/ false, [project.clean(perftscProject, { typescript: "built" })]);
+gulp.task(
+ "perftsc",
+ "Builds augmented version of the compiler for perf tests",
+ [perftscJs]);
// Instrumented compiler
-const loggedIOpath = path.join(harnessDirectory, "loggedIO.ts");
-const loggedIOJsPath = path.join(builtLocalDirectory, "loggedIO.js");
-gulp.task(loggedIOJsPath, /*help*/ false, [], (done) => {
- const temp = path.join(builtLocalDirectory, "temp");
- mkdirP(temp, (err) => {
- if (err) { console.error(err); done(err); process.exit(1); }
- exec(host, [lkgCompiler, "--types", "--target es5", "--lib es5", "--outdir", temp, loggedIOpath], () => {
- fs.renameSync(path.join(temp, "/harness/loggedIO.js"), loggedIOJsPath);
- del(temp).then(() => done(), done);
- }, done);
+const loggedIOTs = "src/harness/loggedIO.ts";
+const loggedIOJs = "built/local/loggedIO.js";
+gulp.task(loggedIOJs, /*help*/ false, [], (done) => {
+ return mkdirp("built/local/temp")
+ .then(() => execAsync(host, ["lib/tsc.js", "--types", "--target es5", "--lib es5", "--outdir", "built/local/temp", loggedIOTs]))
+ .then(() => { fs.renameSync(path.join("built/local/temp", "/harness/loggedIO.js"), loggedIOJs); })
+ .then(() => del("built/local/temp"));
+});
+
+const instrumenterProject = "src/instrumenter/tsconfig.json";
+const instrumenterJs = "built/local/instrumenter.js";
+gulp.task(instrumenterJs, /*help*/ false, [project(instrumenterProject)]);
+gulp.task("clean:" + instrumenterJs, /*help*/ false, [project.clean(instrumenterProject)]);
+
+gulp.task(
+ "tsc-instrumented",
+ "Builds an instrumented tsc.js - run with --test=[testname]",
+ ["local", loggedIOJs, instrumenterJs, typescriptServicesJs],
+ () => execAsync(host, [instrumenterJs, "record", cmdLineOptions.tests || "iocapture", "built/local"]));
+
+gulp.task(
+ "update-sublime",
+ "Updates the sublime plugin's tsserver",
+ ["local", tsserverJs],
+ () =>
+ gulp.src([tsserverJs, tsserverJs + ".map"])
+ .pipe(gulp.dest("../TypeScript-Sublime-Plugin/tsserver/")));
+
+gulp.task(
+ "build-rules",
+ "Compiles tslint rules to js",
+ [project("scripts/tslint/tsconfig.json")]);
+
+gulp.task("clean-rules", /*help*/ false, [project.clean("scripts/tslint/tsconfig.json")]);
+
+gulp.task(
+ "lint",
+ "Runs tslint on the compiler sources. Optional arguments are: --f[iles]=regex",
+ ["build-rules"],
+ () => {
+ if (fold.isTravis()) console.log(fold.start("lint"));
+ for (const project of ["scripts/tslint/tsconfig.json", "src/tsconfig-base.json"]) {
+ const cmd = `node node_modules/tslint/bin/tslint --project ${project} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish${cmdLineOptions.fix ? " --fix" : ""}`;
+ log("Linting: " + cmd);
+ child_process.execSync(cmd, { stdio: [0, 1, 2] });
+ }
+ if (fold.isTravis()) console.log(fold.end("lint"));
});
-});
-const instrumenterPath = path.join(harnessDirectory, "instrumenter.ts");
-const instrumenterJsPath = path.join(builtLocalDirectory, "instrumenter.js");
-gulp.task(instrumenterJsPath, /*help*/ false, [servicesFile], () => {
- const settings = getCompilerSettings({
- module: "commonjs",
- target: "es5",
- lib: [
- "es6",
- "dom",
- "scripthost"
- ]
- }, /*useBuiltCompiler*/ true);
- return gulp.src(instrumenterPath)
- .pipe(newer(instrumenterJsPath))
- .pipe(sourcemaps.init())
- .pipe(tsc(settings))
- .pipe(sourcemaps.write(builtLocalDirectory))
- .pipe(gulp.dest(builtLocalDirectory));
-});
+gulp.task(
+ "default",
+ "Runs 'local'",
+ ["local"]);
-gulp.task("tsc-instrumented", "Builds an instrumented tsc.js - run with --test=[testname]", ["local", loggedIOJsPath, instrumenterJsPath, servicesFile], (done) => {
- const test = cmdLineOptions.tests || "iocapture";
- exec(host, [instrumenterJsPath, "record", test, builtLocalCompiler], done, done);
-});
+gulp.task(
+ "watch",
+ "Watches the src/ directory for changes and executes runtests-parallel.",
+ [],
+ () => gulp.watch("src/**/*.*", ["runtests-parallel"]));
-gulp.task("update-sublime", "Updates the sublime plugin's tsserver", ["local", serverFile], () => {
- return gulp.src([serverFile, serverFile + ".map"]).pipe(gulp.dest("../TypeScript-Sublime-Plugin/tsserver/"));
-});
-
-gulp.task("build-rules", "Compiles tslint rules to js", () => {
- const settings = getCompilerSettings({ module: "commonjs", lib: ["es6"] }, /*useBuiltCompiler*/ false);
- const dest = path.join(builtLocalDirectory, "tslint");
- return gulp.src("scripts/tslint/**/*.ts")
- .pipe(newer({
- dest,
- ext: ".js"
- }))
- .pipe(sourcemaps.init())
- .pipe(tsc(settings))
- .pipe(sourcemaps.write("."))
- .pipe(gulp.dest(dest));
-});
-
-gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are: --f[iles]=regex", ["build-rules"], () => {
- if (fold.isTravis()) console.log(fold.start("lint"));
- for (const project of ["scripts/tslint/tsconfig.json", "src/tsconfig-base.json"]) {
- const cmd = `node node_modules/tslint/bin/tslint --project ${project} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish${cmdLineOptions.fix ? " --fix" : ""}`;
- console.log("Linting: " + cmd);
- child_process.execSync(cmd, { stdio: [0, 1, 2] });
- }
- if (fold.isTravis()) console.log(fold.end("lint"));
-});
-
-gulp.task("default", "Runs 'local'", ["local"]);
-
-gulp.task("watch", "Watches the src/ directory for changes and executes runtests-parallel.", [], () => {
- gulp.watch("src/**/*.*", ["runtests-parallel"]);
-});
+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-rules",
+ "clean-built"
+ ]);
\ No newline at end of file
diff --git a/Jakefile.js b/Jakefile.js
index 9b3876ea13..944814e925 100644
--- a/Jakefile.js
+++ b/Jakefile.js
@@ -29,6 +29,7 @@ const TaskNames = {
buildFoldEnd: "build-fold-end",
generateDiagnostics: "generate-diagnostics",
coreBuild: "core-build",
+ tsc: "tsc",
lkg: "LKG",
release: "release",
lssl: "lssl",
@@ -50,6 +51,7 @@ Paths.builtLocalCompiler = "built/local/tsc.js";
Paths.builtLocalTSServer = "built/local/tsserver.js";
Paths.builtLocalRun = "built/local/run.js";
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.typescriptDefinitionFile = "built/local/typescript.d.ts";
@@ -267,6 +269,12 @@ task(TaskNames.clean, function () {
desc("Generates the LCG file for localization");
task("localize", [Paths.generatedLCGFile]);
+task(TaskNames.tsc, [Paths.diagnosticInformationMap, TaskNames.lib], function () {
+ tsbuild(ConfigFileFor.tsc, true, () => {
+ complete();
+ });
+}, { async: true });
+
task(TaskNames.coreBuild, [Paths.diagnosticInformationMap, TaskNames.lib], function () {
tsbuild(ConfigFileFor.all, true, () => {
complete();
@@ -339,8 +347,13 @@ 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
+ fs.copyFileSync(Paths.servicesFile, Paths.typescriptFile);
+ if (fs.existsSync(Paths.servicesFile + ".map")) {
+ fs.copyFileSync(Paths.servicesFile + ".map", Paths.typescriptFile + ".map");
+ }
- // Also build typescript.d.ts
fs.writeFileSync(Paths.typescriptDefinitionFile, servicesContentWithoutConstEnums + "\r\nexport = ts", { encoding: "utf-8" });
// And typescript_standalone.d.ts
fs.writeFileSync(Paths.typescriptStandaloneDefinitionFile, servicesContentWithoutConstEnums.replace(/declare (namespace|module) ts(\..+)? \{/g, 'declare module "typescript" {'), { encoding: "utf-8"});
diff --git a/lib/cancellationToken.js b/lib/cancellationToken.js
index d63145f3fc..1757efbb9b 100644
--- a/lib/cancellationToken.js
+++ b/lib/cancellationToken.js
@@ -70,4 +70,5 @@ function createCancellationToken(args) {
}
}
module.exports = createCancellationToken;
-//# sourceMappingURL=cancellationToken.js.map
\ No newline at end of file
+
+//# sourceMappingURL=cancellationToken.js.map
diff --git a/lib/cs/diagnosticMessages.generated.json b/lib/cs/diagnosticMessages.generated.json
index 7984aafd56..e5e989e667 100644
--- a/lib/cs/diagnosticMessages.generated.json
+++ b/lib/cs/diagnosticMessages.generated.json
@@ -49,6 +49,8 @@
"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Deklarace oboru názvů nemůže být umístěná před třídou nebo funkcí, se kterou se slučuje.",
"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235": "Deklarace oboru názvů je povolená jenom v oboru názvů nebo v modulu.",
"A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038": "Import stylu oboru názvů není možné vyvolat nebo konstruovat a způsobí selhání za běhu.",
+ "A_non_dry_build_would_build_project_0_6357": "Build nedodržující princip DRY by vytvořil projekt {0}.",
+ "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "Build nedodržující princip DRY by odstranil následující soubory: {0}",
"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "Inicializátor parametru je povolený jenom v implementaci funkce nebo konstruktoru.",
"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "Vlastnost parametru se nedá deklarovat pomocí parametru rest.",
"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "Vlastnost parametru je povolená jenom v implementaci konstruktoru.",
@@ -100,6 +102,7 @@
"Add_all_missing_members_95022": "Přidat všechny chybějící členy",
"Add_all_missing_super_calls_95039": "Přidat všechna chybějící volání pomocí super",
"Add_async_modifier_to_containing_function_90029": "Přidat modifikátor async do obsahující funkce",
+ "Add_braces_to_arrow_function_95059": "Přidat složené závorky k funkci šipky",
"Add_definite_assignment_assertion_to_property_0_95020": "Přidat kontrolní výraz jednoznačného přiřazení k vlastnosti {0}",
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Přidat kontrolní výrazy jednoznačného přiřazení do všech neinicializovaných vlastností",
"Add_index_signature_for_property_0_90017": "Přidat signaturu indexu pro vlastnost {0}",
@@ -107,6 +110,7 @@
"Add_initializers_to_all_uninitialized_properties_95027": "Přidat inicializátory do všech neinicializovaných vlastností",
"Add_missing_super_call_90001": "Přidat chybějící volání metody super()",
"Add_missing_typeof_95052": "Přidat chybějící typeof",
+ "Add_or_remove_braces_in_an_arrow_function_95058": "Přidat nebo odebrat složené závorky ve funkci šipky",
"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037": "Přidat kvalifikátor do všech nerozpoznaných proměnných odpovídajících názvu členu",
"Add_to_all_uncalled_decorators_95044": "Přidat () do všech nevolaných dekorátorů",
"Add_ts_ignore_to_all_error_messages_95042": "Přidat @ts-ignore do všech chybových zpráv",
@@ -189,6 +193,9 @@
"Binary_digit_expected_1177": "Očekává se binární číslice.",
"Binding_element_0_implicitly_has_an_1_type_7031": "Element vazby {0} má implicitně typ {1}.",
"Block_scoped_variable_0_used_before_its_declaration_2448": "Proměnná bloku {0} se používá před vlastní deklarací.",
+ "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Sestavit všechny projekty včetně těch, které se zdají aktuální",
+ "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Sestavit jeden nebo více projektů a jejich závislosti, pokud jsou zastaralé",
+ "Building_project_0_6358": "Sestavuje se projekt {0}...",
"Call_decorator_expression_90028": "Zavolat výraz dekorátoru",
"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020": "Signatura volání s chybějící anotací návratového typu má implicitně návratový typ any.",
"Call_target_does_not_contain_any_signatures_2346": "Cíl volání neobsahuje žádné signatury.",
@@ -304,6 +311,7 @@
"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Dekorátory nejde použít na víc přístupových objektů get/set se stejným názvem.",
"Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Výchozí export modulu má nebo používá privátní název {0}.",
"Delete_all_unused_declarations_95024": "Odstranit všechny nepoužívané deklarace",
+ "Delete_the_outputs_of_all_projects_6365": "Odstranit výstupy všech projektů",
"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Zastaralé] Použijte místo toho --jsxFactory. Určí objekt vyvolaný pro createElement při cílení na generování JSX react.",
"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Zastaralé] Použijte místo toho --outFile. Zřetězí a vygeneruje výstup do jednoho souboru.",
"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Zastaralé] Použijte místo toho --skipLibCheck. Přeskočí kontrolu typů výchozích souborů deklarací knihovny.",
@@ -354,6 +362,7 @@
"Enable_strict_checking_of_property_initialization_in_classes_6187": "Povolí striktní kontrolu inicializace vlastností ve třídách.",
"Enable_strict_null_checks_6113": "Povolte striktní kontroly hodnot null.",
"Enable_tracing_of_the_name_resolution_process_6085": "Povolte trasování procesu překladu IP adres.",
+ "Enable_verbose_logging_6366": "Povolit podrobné protokolování",
"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037": "Povolí interoperabilitu generování mezi moduly CommonJS a ES prostřednictvím vytváření objektů oboru názvů pro všechny importy. Implikuje allowSyntheticDefaultImports.",
"Enables_experimental_support_for_ES7_async_functions_6068": "Zapíná experimentální podporu asynchronních funkcí ES7.",
"Enables_experimental_support_for_ES7_decorators_6065": "Povolí experimentální podporu pro dekorátory ES7.",
@@ -615,10 +624,12 @@
"Option_0_cannot_be_specified_without_specifying_option_1_5052": "Možnost {0} nejde zadat bez možnosti {1}.",
"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "Možnost {0} nejde zadat bez možnosti {1} nebo {2}.",
"Option_0_should_have_array_of_strings_as_a_value_6103": "Hodnota možnosti {0} by měla být pole řetězců.",
+ "Option_build_must_be_the_first_command_line_argument_6369": "Možnost --build musí být prvním argumentem příkazového řádku.",
"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "Možnost isolatedModules jde použít jenom v případě, že je poskytnutá možnost --module nebo že možnost target je ES2015 nebo vyšší verze.",
"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "Možnost paths se nedá použít bez zadání možnosti --baseUrl.",
"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042": "Možnost project se na příkazovém řádku nedá kombinovat se zdrojovým souborem.",
"Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070": "Možnost --resolveJsonModule se nedá zadat bez strategie překladu modulu node.",
+ "Options_0_and_1_cannot_be_combined_6370": "Možnosti {0} a {1} nejde kombinovat.",
"Options_Colon_6027": "Možnosti:",
"Output_directory_for_generated_declaration_files_6166": "Výstupní adresář pro vygenerované soubory deklarace",
"Output_file_0_from_project_1_does_not_exist_6309": "Výstupní soubor {0} z projektu {1} neexistuje.",
@@ -666,7 +677,15 @@
"Print_names_of_generated_files_part_of_the_compilation_6154": "Část kompilace, při které se vypisují názvy generovaných souborů",
"Print_the_compiler_s_version_6019": "Vytisknout verzi kompilátoru",
"Print_this_message_6017": "Vytisknout tuto zprávu",
+ "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Projekt {0} nejde sestavit, protože jeho závislost {1} obsahuje chyby.",
+ "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Projekt {0} je zastaralý, protože jeho závislost {1} je zastaralá.",
+ "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Projekt {0} je zastaralý, protože nejstarší výstup {1} je starší než nejnovější vstup {2}.",
+ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Projekt {0} je zastaralý, protože výstupní soubor {1} neexistuje.",
+ "Project_0_is_up_to_date_6361": "Projekt {0} je aktuální.",
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Projekt {0} je aktuální, protože nejnovější vstup {1} je starší než nejstarší výstup {2}.",
+ "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Projekt {0} je aktualizovaný soubory .d.ts z jeho závislostí.",
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Odkazy projektu nemůžou tvořit cyklický graf. Zjistil se cyklus: {0}",
+ "Projects_in_this_build_Colon_0_6355": "Projekty v tomto sestavení: {0}",
"Projects_to_reference_6300": "Projekty, které se mají odkazovat",
"Property_0_does_not_exist_on_const_enum_1_2479": "Vlastnost {0} ve výčtu const {1} neexistuje.",
"Property_0_does_not_exist_on_type_1_2339": "Vlastnost {0} v typu {1} neexistuje.",
@@ -718,6 +737,7 @@
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "Odkazovaný projekt {0} musí mít nastavení \"composite\": true.",
"Remove_all_unreachable_code_95051": "Odebrat veškerý nedosažitelný kód",
"Remove_all_unused_labels_95054": "Odebrat všechny nepoužívané popisky",
+ "Remove_braces_from_arrow_function_95060": "Odebrat složené závorky z funkce šipky",
"Remove_declaration_for_Colon_0_90004": "Odebrat deklaraci pro {0}",
"Remove_destructuring_90009": "Odebrat destrukci",
"Remove_import_from_0_90005": "Odebrat import z {0}",
@@ -780,8 +800,11 @@
"Show_all_compiler_options_6169": "Zobrazí všechny možnosti kompilátoru.",
"Show_diagnostic_information_6149": "Zobrazí diagnostické informace.",
"Show_verbose_diagnostic_information_6150": "Zobrazí podrobné diagnostické informace.",
+ "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Zobrazit, co by se sestavilo (nebo odstranilo, pokud je zadaná možnost --clean)",
"Signature_0_must_be_a_type_predicate_1224": "Signatura {0} musí být predikát typu.",
"Skip_type_checking_of_declaration_files_6012": "Přeskočit kontrolu typu souborů deklarace",
+ "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Sestavení projektu {0} se přeskakuje, protože jeho závislost {1} obsahuje chyby.",
+ "Skipping_clean_because_not_all_projects_could_be_located_6371": "Vyčištění se přeskakuje, protože některé projekty se nepodařilo najít.",
"Source_Map_Options_6175": "Možnosti zdrojového mapování",
"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382": "Specializovaná signatura přetížení nejde přiřadit žádnému nespecializovanému podpisu.",
"Specifier_of_dynamic_import_cannot_be_spread_element_1325": "Specifikátor dynamického importu nemůže být elementem Spread.",
@@ -957,6 +980,7 @@
"Unterminated_template_literal_1160": "Neukončený literál šablony",
"Untyped_function_calls_may_not_accept_type_arguments_2347": "Volání netypové funkce nemusí přijmout argumenty typu.",
"Unused_label_7028": "Nepoužívaný popisek",
+ "Updating_output_timestamps_of_project_0_6359": "Aktualizují se výstupní časová razítka projektu {0}...",
"Use_synthetic_default_member_95016": "Použije syntetického výchozího člena.",
"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "Použití řetězce v příkazu for...of se podporuje jenom v ECMAScript 5 nebo vyšší verzi.",
"VERSION_6036": "VERZE",
@@ -1017,6 +1041,7 @@
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "Inicializátor člena výčtu const se vyhodnotil na nepovolenou hodnotu NaN.",
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "Výčty const se dají použít jenom ve výrazech přístupu k vlastnosti nebo indexu nebo na pravé straně deklarace importu, přiřazení exportu nebo dotazu na typ.",
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "Příkaz delete nejde volat u identifikátoru ve striktním režimu.",
+ "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "odstranit toto – projekt {0} je aktuální, protože byl sestaven dříve",
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "Deklarace enum se dají použít jen v souboru .ts.",
"export_can_only_be_used_in_a_ts_file_8003": "Možnost export= se dá použít jenom v souboru .ts.",
"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668": "Modifikátor export se nedá použít u ambientních modulů a rozšíření modulů, protože jsou vždy viditelné.",
diff --git a/lib/de/diagnosticMessages.generated.json b/lib/de/diagnosticMessages.generated.json
index 3f0933fad8..99b3594c8f 100644
--- a/lib/de/diagnosticMessages.generated.json
+++ b/lib/de/diagnosticMessages.generated.json
@@ -49,8 +49,8 @@
"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Eine Namespacedeklaration darf nicht vor der Klasse oder Funktion positioniert werden, mit der sie zusammengeführt wird.",
"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235": "Eine Namespacedeklaration ist nur in einem Namespace oder Modul zulässig.",
"A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038": "Ein Import im Namespacestil kann nicht aufgerufen oder erstellt werden und verursacht zur Laufzeit einen Fehler.",
- "A_non_dry_build_would_build_project_0_6357": "A non-dry build would build project '{0}'",
- "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "A non-dry build would delete the following files: {0}",
+ "A_non_dry_build_would_build_project_0_6357": "Bei einem echten Build würde das Projekt \"{0}\" erstellt.",
+ "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "Bei einem echten Build würden die folgenden Dateien gelöscht: {0}",
"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "Ein Parameterinitialisierer ist nur in einer Funktions- oder Konstruktorimplementierung zulässig.",
"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "Eine Parametereigenschaft darf nicht mithilfe eines rest-Parameters deklariert werden.",
"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "Eine Parametereigenschaft ist nur in einer Konstruktorimplementierung zulässig.",
@@ -102,6 +102,7 @@
"Add_all_missing_members_95022": "Alle fehlenden Member hinzufügen",
"Add_all_missing_super_calls_95039": "Alle fehlenden super-Aufrufe hinzufügen",
"Add_async_modifier_to_containing_function_90029": "Async-Modifizierer zur enthaltenden Funktion hinzufügen",
+ "Add_braces_to_arrow_function_95059": "Geschweifte Klammern zu Pfeilfunktion hinzufügen",
"Add_definite_assignment_assertion_to_property_0_95020": "Definitive Zuweisungsassertion zu Eigenschaft \"{0}\" hinzufügen",
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Allen nicht initialisierten Eigenschaften definitive Zuweisungsassertionen hinzufügen",
"Add_index_signature_for_property_0_90017": "Indexsignatur für die Eigenschaft \"{0}\" hinzufügen",
@@ -109,6 +110,7 @@
"Add_initializers_to_all_uninitialized_properties_95027": "Allen nicht initialisierten Eigenschaften Initialisierer hinzufügen",
"Add_missing_super_call_90001": "Fehlenden super()-Aufruf hinzufügen",
"Add_missing_typeof_95052": "Fehlenden \"typeof\" hinzufügen",
+ "Add_or_remove_braces_in_an_arrow_function_95058": "Geschweifte Klammern zu einer Pfeilfunktion hinzufügen oder daraus entfernen",
"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037": "Allen nicht aufgelösten Variablen, die einem Membernamen entsprechen, Qualifizierer hinzufügen",
"Add_to_all_uncalled_decorators_95044": "Allen nicht aufgerufenen Decorators \"()\" hinzufügen",
"Add_ts_ignore_to_all_error_messages_95042": "Allen Fehlermeldungen \"@ts-ignore\" hinzufügen",
@@ -191,9 +193,9 @@
"Binary_digit_expected_1177": "Es wurde eine Binärzahl erwartet.",
"Binding_element_0_implicitly_has_an_1_type_7031": "Das Bindungselement \"{0}\" weist implizit einen Typ \"{1}\" auf.",
"Block_scoped_variable_0_used_before_its_declaration_2448": "Die blockbezogene Variable \"{0}\" wurde vor ihrer Deklaration verwendet.",
- "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Build all projects, including those that appear to be up to date",
- "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Build one or more projects and their dependencies, if out of date",
- "Building_project_0_6358": "Building project '{0}'...",
+ "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Alle Projekte erstellen, einschließlich solcher, die anscheinend auf dem neuesten Stand sind",
+ "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Mindestens ein Projekt und die zugehörigen Abhängigkeiten erstellen, wenn veraltet",
+ "Building_project_0_6358": "Projekt \"{0}\" wird erstellt...",
"Call_decorator_expression_90028": "Decorator-Ausdruck aufrufen",
"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020": "Eine Aufrufsignatur ohne Rückgabetypanmerkung weist implizit einen any-Rückgabetyp auf.",
"Call_target_does_not_contain_any_signatures_2346": "Das Aufrufziel enthält keine Signaturen.",
@@ -309,7 +311,7 @@
"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Decorators dürfen nicht auf mehrere get-/set-Zugriffsmethoden mit dem gleichen Namen angewendet werden.",
"Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Der Standardexport des Moduls besitzt oder verwendet den privaten Namen \"{0}\".",
"Delete_all_unused_declarations_95024": "Alle nicht verwendeten Deklarationen löschen",
- "Delete_the_outputs_of_all_projects_6365": "Delete the outputs of all projects",
+ "Delete_the_outputs_of_all_projects_6365": "Ausgaben aller Projekte löschen",
"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Veraltet] Verwenden Sie stattdessen \"--jsxFactory\". Geben Sie das Objekt an, das für \"createElement\" aufgerufen wurde, wenn das Ziel die JSX-Ausgabe \"react\" ist.",
"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Veraltet] Verwenden Sie stattdessen \"--outFile\". Verketten und Ausgeben in eine einzige Datei",
"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Veraltet] Verwenden Sie stattdessen \"--skipLibCheck\". Überspringen Sie die Typüberprüfung der Standardbibliothek-Deklarationsdateien.",
@@ -360,7 +362,7 @@
"Enable_strict_checking_of_property_initialization_in_classes_6187": "Aktivieren Sie die strenge Überprüfung der Eigenschafteninitialisierung in Klassen.",
"Enable_strict_null_checks_6113": "Strenge NULL-Überprüfungen aktivieren.",
"Enable_tracing_of_the_name_resolution_process_6085": "Ablaufverfolgung des Namensauflösungsvorgangs aktivieren.",
- "Enable_verbose_logging_6366": "Enable verbose logging",
+ "Enable_verbose_logging_6366": "Ausführliche Protokollierung aktivieren",
"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037": "Ermöglicht Ausgabeinteroperabilität zwischen CommonJS- und ES-Modulen durch die Erstellung von Namespaceobjekten für alle Importe. Impliziert \"AllowSyntheticDefaultImports\".",
"Enables_experimental_support_for_ES7_async_functions_6068": "Ermöglicht experimentelle Unterstützung für asynchrone ES7-Funktionen.",
"Enables_experimental_support_for_ES7_decorators_6065": "Ermöglicht experimentelle Unterstützung für asynchrone ES7-Decorators.",
@@ -622,12 +624,12 @@
"Option_0_cannot_be_specified_without_specifying_option_1_5052": "Die Option \"{0}\" darf nicht ohne die Option \"{1}\" angegeben werden.",
"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "Die Option \"{0}\" kann nicht ohne die Option \"{1}\" oder \"{2}\" angegeben werden.",
"Option_0_should_have_array_of_strings_as_a_value_6103": "Die Option \"{0}\" muss ein Zeichenfolgenarray als Wert aufweisen.",
- "Option_build_must_be_the_first_command_line_argument_6369": "Option '--build' must be the first command line argument.",
+ "Option_build_must_be_the_first_command_line_argument_6369": "Die Option \"--build\" muss das erste Befehlszeilenargument sein.",
"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "Die Option \"isolatedModules\" kann nur verwendet werden, wenn entweder die Option \"--module\" angegeben ist oder die Option \"target\" den Wert \"ES2015\" oder höher aufweist.",
"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "Die \"path\"-Option kann nicht ohne Angabe der \"-baseUrl\"-Option angegeben werden.",
"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042": "Die Option \"project\" darf nicht mit Quelldateien in einer Befehlszeile kombiniert werden.",
"Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070": "Die Option \"--resolveJsonModule\" kann nicht ohne die Modulauflösungsstrategie \"node\" angegeben werden.",
- "Options_0_and_1_cannot_be_combined_6370": "Options '{0}' and '{1}' cannot be combined.",
+ "Options_0_and_1_cannot_be_combined_6370": "Die Optionen \"{0}\" und \"{1}\" können nicht kombiniert werden.",
"Options_Colon_6027": "Optionen:",
"Output_directory_for_generated_declaration_files_6166": "Ausgabeverzeichnis für erstellte Deklarationsdateien.",
"Output_file_0_from_project_1_does_not_exist_6309": "Die Ausgabedatei \"{0}\" aus dem Projekt \"{1}\" ist nicht vorhanden.",
@@ -675,15 +677,15 @@
"Print_names_of_generated_files_part_of_the_compilation_6154": "Drucknamen des generierten Dateiteils der Kompilierung.",
"Print_the_compiler_s_version_6019": "Die Version des Compilers ausgeben.",
"Print_this_message_6017": "Diese Nachricht ausgeben.",
- "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Project '{0}' can't be built because its dependency '{1}' has errors",
- "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Project '{0}' is out of date because its dependency '{1}' is out of date",
- "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'",
- "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Project '{0}' is out of date because output file '{1}' does not exist",
- "Project_0_is_up_to_date_6361": "Project '{0}' is up to date",
- "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'",
- "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Project '{0}' is up to date with .d.ts files from its dependencies",
+ "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Projekt \"{0}\" kann nicht erstellt werden, weil die Abhängigkeit \"{1}\" Fehler enthält.",
+ "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Projekt \"{0}\" ist veraltet, weil die Abhängigkeit \"{1}\" veraltet ist.",
+ "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Projekt \"{0}\" ist veraltet, weil die älteste Ausgabe \"{1}\" älter ist als die neueste Eingabe \"{2}\".",
+ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Projekt \"{0}\" ist veraltet, weil die Ausgabedatei \"{1}\" nicht vorhanden ist.",
+ "Project_0_is_up_to_date_6361": "Projekt \"{0}\" ist auf dem neuesten Stand.",
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Projekt \"{0}\" ist auf dem neuesten Stand, weil die neueste Eingabe \"{1}\" älter ist als die älteste Ausgabe \"{2}\".",
+ "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Projekt \"{0}\" ist mit .d.ts-Dateien aus den zugehörigen Abhängigkeiten auf dem neuesten Stand.",
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Projektverweise dürfen keinen kreisförmigen Graphen bilden. Zyklus erkannt: {0}",
- "Projects_in_this_build_Colon_0_6355": "Projects in this build: {0}",
+ "Projects_in_this_build_Colon_0_6355": "Projekte in diesem Build: {0}",
"Projects_to_reference_6300": "Zu referenzierende Projekte",
"Property_0_does_not_exist_on_const_enum_1_2479": "Die Eigenschaft \"{0}\" ist für die const-Enumeration \"{1}\" nicht vorhanden.",
"Property_0_does_not_exist_on_type_1_2339": "Die Eigenschaft \"{0}\" ist für den Typ \"{1}\" nicht vorhanden.",
@@ -735,6 +737,7 @@
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "Das referenzierte Projekt \"{0}\" muss für die Einstellung \"composite\" den Wert TRUE aufweisen.",
"Remove_all_unreachable_code_95051": "Gesamten nicht erreichbaren Code entfernen",
"Remove_all_unused_labels_95054": "Alle nicht verwendeten Bezeichnungen entfernen",
+ "Remove_braces_from_arrow_function_95060": "Geschweifte Klammern aus Pfeilfunktion entfernen",
"Remove_declaration_for_Colon_0_90004": "Deklaration entfernen für: {0}",
"Remove_destructuring_90009": "Destrukturierung entfernen",
"Remove_import_from_0_90005": "Import aus \"{0}\" entfernen",
@@ -797,11 +800,11 @@
"Show_all_compiler_options_6169": "Alle Compileroptionen anzeigen.",
"Show_diagnostic_information_6149": "Diagnoseinformationen anzeigen.",
"Show_verbose_diagnostic_information_6150": "Ausführliche Diagnoseinformationen anzeigen.",
- "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Show what would be built (or deleted, if specified with '--clean')",
+ "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Anzeigen, was erstellt würde (oder gelöscht würde, wenn mit \"--clean\" angegeben)",
"Signature_0_must_be_a_type_predicate_1224": "Die Signatur \"{0}\" muss ein Typprädikat sein.",
"Skip_type_checking_of_declaration_files_6012": "Überspringen Sie die Typüberprüfung von Deklarationsdateien.",
- "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Skipping build of project '{0}' because its dependency '{1}' has errors",
- "Skipping_clean_because_not_all_projects_could_be_located_6371": "Skipping clean because not all projects could be located",
+ "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Das Erstellen von Projekt \"{0}\" wird übersprungen, weil die Abhängigkeit \"{1}\" einen Fehler aufweist.",
+ "Skipping_clean_because_not_all_projects_could_be_located_6371": "Das Bereinigen wird übersprungen, weil nicht alle Projekte gefunden werden konnten.",
"Source_Map_Options_6175": "Quellzuordnungsoptionen",
"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382": "Eine spezialisierte Überladungssignatur kann keiner nicht spezialisierten Signatur zugewiesen werden.",
"Specifier_of_dynamic_import_cannot_be_spread_element_1325": "Der Spezifizierer des dynamischen Imports darf kein Spread-Element sein.",
@@ -977,7 +980,7 @@
"Unterminated_template_literal_1160": "Nicht abgeschlossenes Vorlagenliteral.",
"Untyped_function_calls_may_not_accept_type_arguments_2347": "Nicht typisierte Funktionsaufrufe dürfen keine Typargumente annehmen.",
"Unused_label_7028": "Nicht verwendete Bezeichnung.",
- "Updating_output_timestamps_of_project_0_6359": "Updating output timestamps of project '{0}'...",
+ "Updating_output_timestamps_of_project_0_6359": "Ausgabezeitstempel von Projekt \"{0}\" werden aktualisiert...",
"Use_synthetic_default_member_95016": "Verwenden Sie den synthetischen Member \"default\".",
"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "Das Verwenden einer Zeichenfolge in einer for...of-Anweisung wird nur in ECMAScript 5 oder höher unterstützt.",
"VERSION_6036": "VERSION",
@@ -1038,7 +1041,7 @@
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "Der const-Enumerationsmemberinitialisierer wurde in den unzulässigen Wert \"NaN\" ausgewertet.",
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "const-Enumerationen können nur in Eigenschaften- bzw. Indexzugriffsausdrücken oder auf der rechten Seite einer Importdeklaration oder Exportzuweisung verwendet werden.",
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "\"delete\" kann für einen Bezeichner im Strict-Modus nicht aufgerufen werden.",
- "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "delete this - Project '{0}' is up to date because it was previously built",
+ "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "Dies löschen – Projekt \"{0}\" ist auf dem neuesten Stand, da es bereits zuvor erstellt wurde",
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "enum-Deklarationen können nur in einer TS-Datei verwendet werden.",
"export_can_only_be_used_in_a_ts_file_8003": "\"export=\" kann nur in einer TS-Datei verwendet werden.",
"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668": "Der Modifizierer \"export\" kann nicht auf Umgebungsmodule und Modulerweiterungen angewendet werden, da diese immer sichtbar sind.",
diff --git a/lib/enu/diagnosticMessages.generated.json.lcg b/lib/enu/diagnosticMessages.generated.json.lcg
index 3eb93d439d..7199fab2a5 100644
--- a/lib/enu/diagnosticMessages.generated.json.lcg
+++ b/lib/enu/diagnosticMessages.generated.json.lcg
@@ -303,12 +303,6 @@
- -
-
-
-
-
-
-
@@ -5637,6 +5631,12 @@
+ -
+
+
+
+
+
-
diff --git a/lib/es/diagnosticMessages.generated.json b/lib/es/diagnosticMessages.generated.json
index f11f5c292e..7ff3b1ecfc 100644
--- a/lib/es/diagnosticMessages.generated.json
+++ b/lib/es/diagnosticMessages.generated.json
@@ -49,8 +49,8 @@
"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Una declaración de espacio de nombres no se puede situar antes que una clase o función con la que se combina.",
"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235": "Una declaración de espacio de nombres solo se permite en un espacio de nombres o en un módulo.",
"A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038": "No se puede llamar o construir una importación de estilo de espacio de nombres, y provocará un error en tiempo de ejecución.",
- "A_non_dry_build_would_build_project_0_6357": "A non-dry build would build project '{0}'",
- "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "A non-dry build would delete the following files: {0}",
+ "A_non_dry_build_would_build_project_0_6357": "Una compilación no DRY compilaría el proyecto \"{0}\"",
+ "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "Una compilación no DRY eliminaría los siguientes archivos: {0}",
"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "Un inicializador de parámetros solo se permite en una implementación de función o de constructor.",
"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "Una propiedad de parámetro no se puede declarar mediante un parámetro rest.",
"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "Una propiedad de parámetro solo se permite en una implementación de constructor.",
@@ -102,6 +102,7 @@
"Add_all_missing_members_95022": "Agregar todos los miembros que faltan",
"Add_all_missing_super_calls_95039": "Agregar todas las llamadas a super que faltan",
"Add_async_modifier_to_containing_function_90029": "Agregar el modificador async a la función contenedora",
+ "Add_braces_to_arrow_function_95059": "Agregar llaves a la función de flecha",
"Add_definite_assignment_assertion_to_property_0_95020": "Agregar aserción de asignación definitiva a la propiedad \"{0}\"",
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Agregar aserciones de asignación definitiva a todas las propiedades sin inicializar",
"Add_index_signature_for_property_0_90017": "Agregar una signatura de índice para la propiedad \"{0}\"",
@@ -109,6 +110,7 @@
"Add_initializers_to_all_uninitialized_properties_95027": "Agregar inicializadores a todas las propiedades sin inicializar",
"Add_missing_super_call_90001": "Agregar la llamada a \"super()\" que falta",
"Add_missing_typeof_95052": "Agregar el elemento \"typeof\" que falta",
+ "Add_or_remove_braces_in_an_arrow_function_95058": "Agregar o quitar llaves en una función de flecha",
"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037": "Agregar un calificador a todas las variables no resueltas que coincidan con un nombre de miembro",
"Add_to_all_uncalled_decorators_95044": "Agregar \"()\" a todos los elementos Decorator a los que no se llama",
"Add_ts_ignore_to_all_error_messages_95042": "Agregar \"@ts-ignore\" a todos los mensajes de error",
@@ -191,9 +193,9 @@
"Binary_digit_expected_1177": "Se esperaba un dígito binario.",
"Binding_element_0_implicitly_has_an_1_type_7031": "El elemento de enlace '{0}' tiene un tipo '{1}' implícito.",
"Block_scoped_variable_0_used_before_its_declaration_2448": "Variable con ámbito de bloque '{0}' usada antes de su declaración.",
- "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Build all projects, including those that appear to be up to date",
- "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Build one or more projects and their dependencies, if out of date",
- "Building_project_0_6358": "Building project '{0}'...",
+ "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Compilar todos los proyectos, incluidos los que aparecen actualizados",
+ "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Generar uno o varios proyectos y sus dependencias, si no están actualizados",
+ "Building_project_0_6358": "Compilando el proyecto \"{0}\"...",
"Call_decorator_expression_90028": "Llamar a la expresión decorador",
"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020": "La signatura de llamada, que carece de una anotación de tipo de valor devuelto, tiene implícitamente un tipo de valor devuelto \"any\".",
"Call_target_does_not_contain_any_signatures_2346": "El destino de llamada no contiene signaturas.",
@@ -309,7 +311,7 @@
"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "No se pueden aplicar elementos Decorator a varios descriptores de acceso get o set con el mismo nombre.",
"Default_export_of_the_module_has_or_is_using_private_name_0_4082": "La exportación predeterminada del módulo tiene o usa el nombre privado '{0}'.",
"Delete_all_unused_declarations_95024": "Eliminar todas las declaraciones sin usar",
- "Delete_the_outputs_of_all_projects_6365": "Delete the outputs of all projects",
+ "Delete_the_outputs_of_all_projects_6365": "Eliminar las salidas de todos los proyectos",
"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[En desuso] Use \"--jsxFactory\" en su lugar. Especifique el objeto invocado para createElement cuando el destino sea la emisión de JSX \"react\"",
"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[En desuso] Use \"--outFile\" en su lugar. Concatena y emite la salida en un solo archivo.",
"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[En desuso] Use \"--skipLibCheck\" en su lugar. Omite la comprobación de tipos de los archivos de declaración de biblioteca predeterminados.",
@@ -360,7 +362,7 @@
"Enable_strict_checking_of_property_initialization_in_classes_6187": "Habilite la comprobación estricta de inicialización de propiedades en las clases.",
"Enable_strict_null_checks_6113": "Habilitar comprobaciones estrictas de elementos nulos.",
"Enable_tracing_of_the_name_resolution_process_6085": "Habilitar seguimiento del proceso de resolución de nombres.",
- "Enable_verbose_logging_6366": "Enable verbose logging",
+ "Enable_verbose_logging_6366": "Habilitar el registro detallado",
"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037": "Permite emitir interoperabilidad entre módulos CommonJS y ES mediante la creación de objetos de espacio de nombres para todas las importaciones. Implica \"allowSyntheticDefaultImports\".",
"Enables_experimental_support_for_ES7_async_functions_6068": "Habilita la compatibilidad experimental con las funciones asincrónicas de ES7.",
"Enables_experimental_support_for_ES7_decorators_6065": "Habilita la compatibilidad experimental con los elementos Decorator de ES7.",
@@ -622,12 +624,12 @@
"Option_0_cannot_be_specified_without_specifying_option_1_5052": "La opción '{0}' no se puede especificar sin la opción '{1}'.",
"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "La opción \"{0}\" no se puede especificar sin la opción \"{1}\" o la opción \"{2}\".",
"Option_0_should_have_array_of_strings_as_a_value_6103": "La opción '{0}' debe tener una matriz de cadenas como valor.",
- "Option_build_must_be_the_first_command_line_argument_6369": "Option '--build' must be the first command line argument.",
+ "Option_build_must_be_the_first_command_line_argument_6369": "La opción \"--build\" debe ser el primer argumento de la línea de comandos.",
"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "La opción \"isolatedModules\" solo se puede usar cuando se proporciona la opción \"--module\" o si la opción \"target\" es \"ES2015\" o una versión posterior.",
"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "La opción 'paths' no se puede usar sin especificar la opción '--baseUrl'.",
"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042": "La opción \"project\" no se puede combinar con archivos de origen en una línea de comandos.",
"Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070": "No se puede especificar la opción \"--resolveJsonModule\" sin la estrategia de resolución de módulos \"node\".",
- "Options_0_and_1_cannot_be_combined_6370": "Options '{0}' and '{1}' cannot be combined.",
+ "Options_0_and_1_cannot_be_combined_6370": "\"{0}\" y \"{1}\" no se pueden combinar.",
"Options_Colon_6027": "Opciones:",
"Output_directory_for_generated_declaration_files_6166": "Directorio de salida para los archivos de declaración generados.",
"Output_file_0_from_project_1_does_not_exist_6309": "El archivo de salida \"{0}\" del proyecto \"{1}\" no existe.",
@@ -675,15 +677,15 @@
"Print_names_of_generated_files_part_of_the_compilation_6154": "Imprimir los nombres de los archivos generados que forman parte de la compilación.",
"Print_the_compiler_s_version_6019": "Imprima la versión del compilador.",
"Print_this_message_6017": "Imprima este mensaje.",
- "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Project '{0}' can't be built because its dependency '{1}' has errors",
- "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Project '{0}' is out of date because its dependency '{1}' is out of date",
- "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'",
- "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Project '{0}' is out of date because output file '{1}' does not exist",
- "Project_0_is_up_to_date_6361": "Project '{0}' is up to date",
- "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'",
- "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Project '{0}' is up to date with .d.ts files from its dependencies",
+ "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "El proyecto \"{0}\" no puede generarse porque su dependencia \"{1}\" tiene errores",
+ "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "El proyecto \"{0}\" está obsoleto porque su dependencia \"{1}\" no está actualizada",
+ "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "El proyecto \"{0}\" está obsoleto porque la salida más antigua \"{1}\" es anterior a la entrada más reciente \"{2}\"",
+ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "El proyecto \"{0}\" está obsoleto porque el archivo de salida \"{1}\" no existe",
+ "Project_0_is_up_to_date_6361": "El proyecto \"{0}\" está actualizado",
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "El proyecto \"{0}\" está actualizado porque la entrada más reciente \"{1}\" es anterior a la salida más antigua \"{2}\"",
+ "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "El proyecto \"{0}\" está actualizado con archivos .d.ts de sus dependencias",
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Las referencias del proyecto no pueden formar un gráfico circular. Ciclo detectado: {0}",
- "Projects_in_this_build_Colon_0_6355": "Projects in this build: {0}",
+ "Projects_in_this_build_Colon_0_6355": "Proyectos de esta compilación: {0}",
"Projects_to_reference_6300": "Proyectos a los que se hará referencia",
"Property_0_does_not_exist_on_const_enum_1_2479": "La propiedad '{0}' no existe en la enumeración 'const' '{1}'.",
"Property_0_does_not_exist_on_type_1_2339": "La propiedad '{0}' no existe en el tipo '{1}'.",
@@ -735,6 +737,7 @@
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "El proyecto \"{0}\" al que se hace referencia debe tener el valor \"composite\": true.",
"Remove_all_unreachable_code_95051": "Quitar todo el código inaccesible",
"Remove_all_unused_labels_95054": "Quitar todas las etiquetas no utilizadas",
+ "Remove_braces_from_arrow_function_95060": "Quitar las llaves de la función de flecha",
"Remove_declaration_for_Colon_0_90004": "Quitar declaración de: \"{0}\"",
"Remove_destructuring_90009": "Quitar la desestructuración",
"Remove_import_from_0_90005": "Quitar importación de \"{0}\"",
@@ -797,11 +800,11 @@
"Show_all_compiler_options_6169": "Mostrar todas las opciones de compilador.",
"Show_diagnostic_information_6149": "Mostrar información de diagnóstico.",
"Show_verbose_diagnostic_information_6150": "Mostrar información de diagnóstico detallada.",
- "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Show what would be built (or deleted, if specified with '--clean')",
+ "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Mostrar lo que podría compilarse (o eliminarse, si se especifica con \"--clean\")",
"Signature_0_must_be_a_type_predicate_1224": "La signatura '{0}' debe tener un predicado de tipo.",
"Skip_type_checking_of_declaration_files_6012": "Omita la comprobación de tipos de los archivos de declaración.",
- "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Skipping build of project '{0}' because its dependency '{1}' has errors",
- "Skipping_clean_because_not_all_projects_could_be_located_6371": "Skipping clean because not all projects could be located",
+ "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Omitiendo la compilación del proyecto \"{0}\" porque su dependencia \"{1}\" tiene errores",
+ "Skipping_clean_because_not_all_projects_could_be_located_6371": "Omitiendo la limpieza porque no se encontraron todos los proyectos",
"Source_Map_Options_6175": "Opciones de mapa de origen",
"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382": "La signatura de sobrecarga especializada no se puede asignar a ninguna signatura no especializada.",
"Specifier_of_dynamic_import_cannot_be_spread_element_1325": "El especificador de importación dinámica no puede ser un elemento de propagación.",
@@ -977,7 +980,7 @@
"Unterminated_template_literal_1160": "Literal de plantilla sin terminar.",
"Untyped_function_calls_may_not_accept_type_arguments_2347": "Las llamadas a función sin tipo no pueden aceptar argumentos de tipo.",
"Unused_label_7028": "Etiqueta no usada.",
- "Updating_output_timestamps_of_project_0_6359": "Updating output timestamps of project '{0}'...",
+ "Updating_output_timestamps_of_project_0_6359": "Actualizando las marcas de hora de salida del proyecto \"{0}\"...",
"Use_synthetic_default_member_95016": "Use el miembro sintético \"default\".",
"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "El uso de una cadena en una instrucción \"for...of\" solo se admite en ECMAScript 5 y versiones posteriores.",
"VERSION_6036": "VERSIÓN",
@@ -1038,7 +1041,7 @@
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "El inicializador de miembros de enumeración \"const\" se evaluó con un valor \"NaN\" no permitido.",
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "Las enumeraciones \"const\" solo se pueden usar en expresiones de acceso de propiedad o índice, o en la parte derecha de una declaración de importación, una asignación de exportación o una consulta de tipo.",
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "No se puede llamar a \"delete\" en un identificador en modo strict.",
- "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "delete this - Project '{0}' is up to date because it was previously built",
+ "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "eliminar esto - El proyecto \"{0}\" está actualizado porque se compiló previamente",
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "Las declaraciones \"enum\" solo se pueden usar en un archivo .ts.",
"export_can_only_be_used_in_a_ts_file_8003": "\"export=\" solo se puede usar en un archivo .ts.",
"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668": "El modificador 'export' no se puede aplicar a módulos de ambiente ni aumentos de módulos, porque siempre están visibles.",
diff --git a/lib/fr/diagnosticMessages.generated.json b/lib/fr/diagnosticMessages.generated.json
index 0bb0a49450..f844363395 100644
--- a/lib/fr/diagnosticMessages.generated.json
+++ b/lib/fr/diagnosticMessages.generated.json
@@ -49,8 +49,8 @@
"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Une déclaration d'espace de noms ne peut pas se trouver avant une classe ou une fonction avec laquelle elle est fusionnée.",
"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235": "Une déclaration d'espace de noms est autorisée uniquement dans un espace de noms ou un module.",
"A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038": "Impossible d'appeler ou de construire une importation de style d'espace de noms, ce qui va entraîner un échec au moment de l'exécution.",
- "A_non_dry_build_would_build_project_0_6357": "A non-dry build would build project '{0}'",
- "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "A non-dry build would delete the following files: {0}",
+ "A_non_dry_build_would_build_project_0_6357": "Une build non-DRY générerait le projet '{0}'",
+ "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "Une build non-DRY supprimerait les fichiers suivants : {0}",
"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "Un initialiseur de paramètre est uniquement autorisé dans une implémentation de fonction ou de constructeur.",
"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "Impossible de déclarer une propriété de paramètre à l'aide d'un paramètre rest.",
"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "Une propriété de paramètre est uniquement autorisée dans une implémentation de constructeur.",
@@ -102,6 +102,7 @@
"Add_all_missing_members_95022": "Ajouter tous les membres manquants",
"Add_all_missing_super_calls_95039": "Ajouter tous les appels super manquants",
"Add_async_modifier_to_containing_function_90029": "Ajouter le modificateur async dans la fonction conteneur",
+ "Add_braces_to_arrow_function_95059": "Ajouter des accolades à la fonction arrow",
"Add_definite_assignment_assertion_to_property_0_95020": "Ajouter une assertion d'assignation définie à la propriété '{0}'",
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Ajouter des assertions d'affectation définie à toutes les propriétés non initialisées",
"Add_index_signature_for_property_0_90017": "Ajouter une signature d'index pour la propriété '{0}'",
@@ -109,6 +110,7 @@
"Add_initializers_to_all_uninitialized_properties_95027": "Ajouter des initialiseurs à toutes les propriétés non initialisées",
"Add_missing_super_call_90001": "Ajouter l'appel manquant à 'super()'",
"Add_missing_typeof_95052": "Ajouter un 'typeof' manquant",
+ "Add_or_remove_braces_in_an_arrow_function_95058": "Ajouter ou supprimer les accolades dans une fonction arrow",
"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037": "Ajouter un qualificateur à toutes les variables non résolues correspondant à un nom de membre",
"Add_to_all_uncalled_decorators_95044": "Ajouter '()' à tous les décorateurs non appelés",
"Add_ts_ignore_to_all_error_messages_95042": "Ajouter '@ts-ignore' à tous les messages d'erreur",
@@ -191,9 +193,9 @@
"Binary_digit_expected_1177": "Chiffre binaire attendu.",
"Binding_element_0_implicitly_has_an_1_type_7031": "L'élément de liaison '{0}' possède implicitement un type '{1}'.",
"Block_scoped_variable_0_used_before_its_declaration_2448": "Variable de portée de bloc '{0}' utilisée avant sa déclaration.",
- "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Build all projects, including those that appear to be up to date",
- "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Build one or more projects and their dependencies, if out of date",
- "Building_project_0_6358": "Building project '{0}'...",
+ "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Générer tous les projets, même ceux qui semblent être à jour",
+ "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Générer un ou plusieurs projets et leurs dépendances (s'ils sont obsolètes)",
+ "Building_project_0_6358": "Génération du projet '{0}'...",
"Call_decorator_expression_90028": "Appeler l'expression de l'élément décoratif",
"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020": "La signature d'appel, qui ne dispose pas d'annotation de type de retour, possède implicitement un type de retour 'any'.",
"Call_target_does_not_contain_any_signatures_2346": "La cible de l'appel ne contient aucune signature.",
@@ -309,7 +311,7 @@
"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Impossible d'appliquer des éléments décoratifs à plusieurs accesseurs get/set du même nom.",
"Default_export_of_the_module_has_or_is_using_private_name_0_4082": "L'exportation par défaut du module a utilisé ou utilise le nom privé '{0}'.",
"Delete_all_unused_declarations_95024": "Supprimer toutes les déclarations inutilisées",
- "Delete_the_outputs_of_all_projects_6365": "Delete the outputs of all projects",
+ "Delete_the_outputs_of_all_projects_6365": "Supprimer les sorties de tous les projets",
"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Déconseillé] Utilisez '--jsxFactory' à la place. Permet de spécifier l'objet appelé pour createElement durant le ciblage de 'react' pour l'émission JSX",
"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Déconseillé] Utilisez '--outFile' à la place. Permet de concaténer et d'émettre la sortie vers un seul fichier",
"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Déconseillé] Utilisez '--skipLibCheck' à la place. Permet d'ignorer le contrôle de type des fichiers de déclaration de la bibliothèque par défaut.",
@@ -360,7 +362,7 @@
"Enable_strict_checking_of_property_initialization_in_classes_6187": "Activez la vérification stricte de l'initialisation des propriétés dans les classes.",
"Enable_strict_null_checks_6113": "Activez strict null checks.",
"Enable_tracing_of_the_name_resolution_process_6085": "Activez le traçage du processus de résolution de noms.",
- "Enable_verbose_logging_6366": "Enable verbose logging",
+ "Enable_verbose_logging_6366": "Activer la journalisation détaillée",
"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037": "Active l'interopérabilité entre les modules CommonJS et ES via la création d'objets d'espace de noms pour toutes les importations. Implique 'allowSyntheticDefaultImports'.",
"Enables_experimental_support_for_ES7_async_functions_6068": "Active la prise en charge expérimentale des fonctions async ES7.",
"Enables_experimental_support_for_ES7_decorators_6065": "Active la prise en charge expérimentale des éléments décoratifs ES7.",
@@ -622,12 +624,12 @@
"Option_0_cannot_be_specified_without_specifying_option_1_5052": "Impossible de spécifier l'option '{0}' sans spécifier l'option '{1}'.",
"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "Impossible de spécifier l'option '{0}' sans spécifier l'option '{1}' ou l'option '{2}'.",
"Option_0_should_have_array_of_strings_as_a_value_6103": "L'option '{0}' doit avoir un tableau de chaînes en tant que valeur.",
- "Option_build_must_be_the_first_command_line_argument_6369": "Option '--build' must be the first command line argument.",
+ "Option_build_must_be_the_first_command_line_argument_6369": "L'option '--build' doit être le premier argument de ligne de commande.",
"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "L'option 'isolatedModules' peut être utilisée seulement quand l'option '--module' est spécifiée, ou quand l'option 'target' a la valeur 'ES2015' ou une version supérieure.",
"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "Impossible d'utiliser l'option 'paths' sans spécifier l'option '--baseUrl'.",
"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042": "Impossible d'associer l'option 'project' à des fichiers sources sur une ligne de commande.",
"Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070": "Impossible de spécifier l'option '--resolveJsonModule' sans la stratégie de résolution de module 'node'.",
- "Options_0_and_1_cannot_be_combined_6370": "Options '{0}' and '{1}' cannot be combined.",
+ "Options_0_and_1_cannot_be_combined_6370": "Impossible de combiner les options '{0}' et '{1}'.",
"Options_Colon_6027": "Options :",
"Output_directory_for_generated_declaration_files_6166": "Répertoire de sortie pour les fichiers de déclaration générés.",
"Output_file_0_from_project_1_does_not_exist_6309": "Le fichier de sortie '{0}' du projet '{1}' n'existe pas",
@@ -675,15 +677,15 @@
"Print_names_of_generated_files_part_of_the_compilation_6154": "Imprimez les noms des fichiers générés faisant partie de la compilation.",
"Print_the_compiler_s_version_6019": "Affichez la version du compilateur.",
"Print_this_message_6017": "Imprimez ce message.",
- "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Project '{0}' can't be built because its dependency '{1}' has errors",
- "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Project '{0}' is out of date because its dependency '{1}' is out of date",
- "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'",
- "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Project '{0}' is out of date because output file '{1}' does not exist",
- "Project_0_is_up_to_date_6361": "Project '{0}' is up to date",
- "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'",
- "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Project '{0}' is up to date with .d.ts files from its dependencies",
+ "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Impossible de générer le projet '{0}' car sa dépendance '{1}' comporte des erreurs",
+ "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Le projet '{0}' est obsolète car sa dépendance '{1}' est obsolète",
+ "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Le projet '{0}' est obsolète car la sortie la plus ancienne ('{1}') est antérieure à l'entrée la plus récente '{2}'",
+ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Le projet '{0}' est obsolète car le fichier de sortie '{1}' n'existe pas",
+ "Project_0_is_up_to_date_6361": "Le projet '{0}' est à jour",
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Le projet '{0}' est à jour car l'entrée la plus récente ('{1}') est antérieure à la sortie la plus ancienne ('{2}')",
+ "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Le projet '{0}' est à jour avec les fichiers .d.ts de ses dépendances",
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Les références de projet ne peuvent pas former un graphe circulaire. Cycle détecté : {0}",
- "Projects_in_this_build_Colon_0_6355": "Projects in this build: {0}",
+ "Projects_in_this_build_Colon_0_6355": "Projets dans cette build : {0}",
"Projects_to_reference_6300": "Projets à référencer",
"Property_0_does_not_exist_on_const_enum_1_2479": "La propriété '{0}' n'existe pas sur l'enum 'const' '{1}'.",
"Property_0_does_not_exist_on_type_1_2339": "La propriété '{0}' n'existe pas sur le type '{1}'.",
@@ -735,6 +737,7 @@
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "Le projet référencé '{0}' doit avoir le paramètre \"composite\" avec la valeur true.",
"Remove_all_unreachable_code_95051": "Supprimer tout le code inaccessible",
"Remove_all_unused_labels_95054": "Supprimer toutes les étiquettes inutilisées",
+ "Remove_braces_from_arrow_function_95060": "Supprimer les accolades de la fonction arrow",
"Remove_declaration_for_Colon_0_90004": "Supprimer la déclaration pour : '{0}'",
"Remove_destructuring_90009": "Supprimer la déstructuration",
"Remove_import_from_0_90005": "Supprimer l'importation de '{0}'",
@@ -797,11 +800,11 @@
"Show_all_compiler_options_6169": "Affichez toutes les options du compilateur.",
"Show_diagnostic_information_6149": "Affichez les informations de diagnostic.",
"Show_verbose_diagnostic_information_6150": "Affichez les informations de diagnostic détaillées.",
- "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Show what would be built (or deleted, if specified with '--clean')",
+ "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Montrer ce qui serait généré (ou supprimé si '--clean' est spécifié)",
"Signature_0_must_be_a_type_predicate_1224": "La signature '{0}' doit être un prédicat de type.",
"Skip_type_checking_of_declaration_files_6012": "Ignorer le contrôle de type des fichiers de déclaration.",
- "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Skipping build of project '{0}' because its dependency '{1}' has errors",
- "Skipping_clean_because_not_all_projects_could_be_located_6371": "Skipping clean because not all projects could be located",
+ "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Ignorer la génération du projet '{0}' car sa dépendance '{1}' comporte des erreurs",
+ "Skipping_clean_because_not_all_projects_could_be_located_6371": "Ignorer le nettoyage car tous les projets ne peuvent pas être localisés",
"Source_Map_Options_6175": "Options de mappage de source",
"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382": "La signature de surcharge spécialisée n'est assignable à aucune signature non spécialisée.",
"Specifier_of_dynamic_import_cannot_be_spread_element_1325": "Le spécificateur de l'importation dynamique ne peut pas être un élément spread.",
@@ -977,7 +980,7 @@
"Unterminated_template_literal_1160": "Littéral de modèle inachevé.",
"Untyped_function_calls_may_not_accept_type_arguments_2347": "Les appels de fonctions non typées ne peuvent pas accepter d'arguments de type.",
"Unused_label_7028": "Étiquette inutilisée.",
- "Updating_output_timestamps_of_project_0_6359": "Updating output timestamps of project '{0}'...",
+ "Updating_output_timestamps_of_project_0_6359": "Mise à jour des horodatages de sortie du projet '{0}'...",
"Use_synthetic_default_member_95016": "Utilisez un membre 'default' synthétique.",
"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "L'utilisation d'une chaîne dans une instruction 'for...of' est prise en charge uniquement dans ECMAScript 5 et version supérieure.",
"VERSION_6036": "VERSION",
@@ -1038,7 +1041,7 @@
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "L'initialiseur de membre enum 'const' donne une valeur non autorisée 'NaN'.",
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "Les enums 'const' ne peuvent être utilisés que dans les expressions d'accès à une propriété ou un index, ou dans la partie droite d'une déclaration d'importation, d'une assignation d'exportation ou d'une requête de type.",
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "'delete' ne peut pas être appelé dans un identificateur en mode strict.",
- "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "delete this - Project '{0}' is up to date because it was previously built",
+ "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "supprimer ceci - Le projet '{0}' est à jour car il a déjà été généré",
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "'Les déclarations enum' peuvent uniquement être utilisées dans un fichier .ts.",
"export_can_only_be_used_in_a_ts_file_8003": "'export=' peut uniquement être utilisé dans un fichier .ts.",
"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668": "Impossible d'appliquer le modificateur 'export' aux modules ambients et aux augmentations de module, car ils sont toujours visibles.",
diff --git a/lib/it/diagnosticMessages.generated.json b/lib/it/diagnosticMessages.generated.json
index 5576154c59..ac6e8d9335 100644
--- a/lib/it/diagnosticMessages.generated.json
+++ b/lib/it/diagnosticMessages.generated.json
@@ -49,6 +49,8 @@
"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Una dichiarazione di spazio dei nomi non può essere specificata prima di una classe o funzione con cui è stato eseguito il merge.",
"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235": "Una dichiarazione di spazio dei nomi è consentita solo in uno spazio dei nomi o in un modulo.",
"A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038": "Non è possibile chiamare o costruire un'importazione in stile spazio dei nomi. Questo comporterà un errore in fase di runtime.",
+ "A_non_dry_build_would_build_project_0_6357": "Se si esegue una compilazione non di prova, verrà compilato il progetto '{0}'",
+ "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "Se si esegue una compilazione non di prova, i file seguenti verranno eliminati: {0}",
"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "Un inizializzatore di parametro è consentito solo in un'implementazione di funzione o costruttore.",
"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "Non è possibile dichiarare una proprietà di parametro usando un parametro REST.",
"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "Una proprietà di parametro è consentita solo in un'implementazione di costruttore.",
@@ -100,6 +102,7 @@
"Add_all_missing_members_95022": "Aggiungere tutti i membri mancanti",
"Add_all_missing_super_calls_95039": "Aggiungere tutte le chiamate a super mancanti",
"Add_async_modifier_to_containing_function_90029": "Aggiungere il modificatore async alla funzione contenitore",
+ "Add_braces_to_arrow_function_95059": "Aggiungere le parentesi graffe alla funzione arrow",
"Add_definite_assignment_assertion_to_property_0_95020": "Aggiungere l'asserzione di assegnazione definita alla proprietà '{0}'",
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Aggiungere le asserzioni di assegnazione definite a tutte le proprietà non inizializzate",
"Add_index_signature_for_property_0_90017": "Aggiungere la firma dell'indice per la proprietà '{0}'",
@@ -107,6 +110,7 @@
"Add_initializers_to_all_uninitialized_properties_95027": "Aggiungere gli inizializzatori a tutte le proprietà non inizializzate",
"Add_missing_super_call_90001": "Aggiungere la chiamata mancante a 'super()'",
"Add_missing_typeof_95052": "Aggiungere l'elemento 'typeof' mancante",
+ "Add_or_remove_braces_in_an_arrow_function_95058": "Aggiungere o rimuovere le parentesi graffe in una funzione arrow",
"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037": "Aggiungere il qualificatore a tutte le variabili non risolte corrispondenti a un nome di membro",
"Add_to_all_uncalled_decorators_95044": "Aggiungere '()' a tutti gli elementi Decorator non chiamati",
"Add_ts_ignore_to_all_error_messages_95042": "Aggiungere '@ts-ignore' a tutti i messaggi di errore",
@@ -189,6 +193,9 @@
"Binary_digit_expected_1177": "È prevista una cifra binaria.",
"Binding_element_0_implicitly_has_an_1_type_7031": "L'elemento di binding '{0}' contiene implicitamente un tipo '{1}'.",
"Block_scoped_variable_0_used_before_its_declaration_2448": "La variabile con ambito blocco '{0}' è stata usata prima di essere stata dichiarata.",
+ "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Compilare tutti i progetti, anche quelli che sembrano aggiornati",
+ "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Compilare uno o più progetti e le relative dipendenze, se non aggiornate",
+ "Building_project_0_6358": "Compilazione del progetto '{0}'...",
"Call_decorator_expression_90028": "Chiamare l'espressione Decorator",
"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020": "La firma di chiamata, in cui manca l'annotazione di tipo restituito, contiene implicitamente un tipo restituito 'any'.",
"Call_target_does_not_contain_any_signatures_2346": "La destinazione della chiamata non contiene alcuna firma.",
@@ -304,6 +311,7 @@
"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Non è possibile applicare le espressioni Decorator a più funzioni di accesso get/set con lo stesso nome.",
"Default_export_of_the_module_has_or_is_using_private_name_0_4082": "L'esportazione predefinita del modulo contiene o usa il nome privato '{0}'.",
"Delete_all_unused_declarations_95024": "Eliminare tutte le dichiarazioni non usate",
+ "Delete_the_outputs_of_all_projects_6365": "Eliminare gli output di tutti i progetti",
"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Deprecata] In alternativa, usare '--jsxFactory'. Specifica l'oggetto richiamato per createElement quando la destinazione è la creazione JSX 'react'",
"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Deprecata] In alternativa, usare '--outFile'. Concatena e crea l'output in un singolo file",
"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Deprecata] In alternativa, usare '--skipLibCheck'. Ignora il controllo del tipo dei file di dichiarazione delle librerie predefinite.",
@@ -354,6 +362,7 @@
"Enable_strict_checking_of_property_initialization_in_classes_6187": "Abilita il controllo tassativo dell'inizializzazione delle proprietà nelle classi.",
"Enable_strict_null_checks_6113": "Abilita i controlli strict Null.",
"Enable_tracing_of_the_name_resolution_process_6085": "Abilita la traccia del processo di risoluzione dei nomi.",
+ "Enable_verbose_logging_6366": "Abilitare la registrazione dettagliata",
"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037": "Abilita l'interoperabilità di creazione tra moduli ES e CommonJS tramite la creazione di oggetti spazio dei nomi per tutte le importazioni. Implica 'allowSyntheticDefaultImports'.",
"Enables_experimental_support_for_ES7_async_functions_6068": "Abilita il supporto sperimentale per le funzioni asincrone di ES7.",
"Enables_experimental_support_for_ES7_decorators_6065": "Abilita il supporto sperimentale per le espressioni Decorator di ES7.",
@@ -615,10 +624,12 @@
"Option_0_cannot_be_specified_without_specifying_option_1_5052": "Non è possibile specificare l'opzione '{0}' senza l'opzione '{1}'.",
"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "Non è possibile specificare l'opzione '{0}' senza l'opzione'{1}' o '{2}'.",
"Option_0_should_have_array_of_strings_as_a_value_6103": "Il valore dell'opzione '{0}' deve essere una matrice di stringhe.",
+ "Option_build_must_be_the_first_command_line_argument_6369": "L'opzione '--build' deve essere il primo argomento della riga di comando.",
"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "L'opzione 'isolatedModules' può essere usata solo quando si specifica l'opzione '--module' oppure il valore dell'opzione 'target' è 'ES2015' o maggiore.",
"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "Non è possibile usare l'opzione 'paths' senza specificare l'opzione '--baseUrl'.",
"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042": "Non è possibile combinare l'opzione 'project' con file di origine in una riga di comando.",
"Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070": "Non è possibile specificare l'opzione '--resolveJsonModule' senza la strategia di risoluzione del modulo 'node'.",
+ "Options_0_and_1_cannot_be_combined_6370": "Non è possibile combinare le opzioni '{0}' e '{1}'.",
"Options_Colon_6027": "Opzioni:",
"Output_directory_for_generated_declaration_files_6166": "Directory di output per i file di dichiarazione generati.",
"Output_file_0_from_project_1_does_not_exist_6309": "Il file di output '{0}' del progetto '{1}' non esiste",
@@ -666,7 +677,15 @@
"Print_names_of_generated_files_part_of_the_compilation_6154": "Stampa i nomi dei file generati che fanno parte della compilazione.",
"Print_the_compiler_s_version_6019": "Stampa la versione del compilatore.",
"Print_this_message_6017": "Stampa questo messaggio.",
+ "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Non è possibile compilare il progetto '{0}' perché la dipendenza '{1}' contiene errori",
+ "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Il progetto '{0}' non è aggiornato perché la dipendenza '{1}' non è aggiornata",
+ "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Il progetto '{0}' non è aggiornato perché l'output meno recente '{1}' è meno recente dell'input più recente '{2}'",
+ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Il progetto '{0}' non è aggiornato perché il file di output '{1}' non esiste",
+ "Project_0_is_up_to_date_6361": "Il progetto '{0}' è aggiornato",
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Il progetto '{0}' è aggiornato perché l'input più recente '{1}' è meno recente dell'output meno recente '{2}'",
+ "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Il progetto '{0}' è aggiornato con i file con estensione d.ts delle relative dipendenze",
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "I riferimenti al progetto non possono formare un grafico circolare. Ciclo rilevato: {0}",
+ "Projects_in_this_build_Colon_0_6355": "Progetti in questa compilazione: {0}",
"Projects_to_reference_6300": "Progetti cui fare riferimento",
"Property_0_does_not_exist_on_const_enum_1_2479": "La proprietà '{0}' non esiste nell'enumerazione 'const' '{1}'.",
"Property_0_does_not_exist_on_type_1_2339": "La proprietà '{0}' non esiste nel tipo '{1}'.",
@@ -718,6 +737,7 @@
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "Il progetto di riferimento '{0}' deve includere l'impostazione \"composite\": true.",
"Remove_all_unreachable_code_95051": "Rimuovere tutto il codice non eseguibile",
"Remove_all_unused_labels_95054": "Rimuovere tutte le etichette inutilizzate",
+ "Remove_braces_from_arrow_function_95060": "Rimuovere le parentesi graffe dalla funzione arrow",
"Remove_declaration_for_Colon_0_90004": "Rimuovere la dichiarazione per '{0}'",
"Remove_destructuring_90009": "Rimuovere la destrutturazione",
"Remove_import_from_0_90005": "Rimuovere l'importazione da '{0}'",
@@ -780,8 +800,11 @@
"Show_all_compiler_options_6169": "Mostra tutte le opzioni del compilatore.",
"Show_diagnostic_information_6149": "Mostra le informazioni di diagnostica.",
"Show_verbose_diagnostic_information_6150": "Mostra le informazioni di diagnostica dettagliate.",
+ "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Mostra gli elementi che vengono compilati (o eliminati, se specificati con l'opzione '--clean')",
"Signature_0_must_be_a_type_predicate_1224": "La firma '{0}' deve essere un predicato di tipo.",
"Skip_type_checking_of_declaration_files_6012": "Ignora il controllo del tipo dei file di dichiarazione.",
+ "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "La compilazione del progetto '{0}' verrà ignorata perché la dipendenza '{1}' contiene errori",
+ "Skipping_clean_because_not_all_projects_could_be_located_6371": "La pulizia verrà ignorata perché non è stato possibile individuare tutti i progetti",
"Source_Map_Options_6175": "Opzioni per mapping di origine",
"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382": "La firma di overload specializzata non è assegnabile a una firma non specializzata.",
"Specifier_of_dynamic_import_cannot_be_spread_element_1325": "L'identificatore dell'importazione dinamica non può essere l'elemento spread.",
@@ -957,6 +980,7 @@
"Unterminated_template_literal_1160": "Valore letterale di modello senza terminazione.",
"Untyped_function_calls_may_not_accept_type_arguments_2347": "Le chiamate di funzione non tipizzate potrebbero non accettare argomenti tipo.",
"Unused_label_7028": "Etichetta non usata.",
+ "Updating_output_timestamps_of_project_0_6359": "Aggiornamento dei timestamp di output del progetto '{0}'...",
"Use_synthetic_default_member_95016": "Usare il membro 'default' sintetico.",
"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "L'uso di una stringa in un'istruzione 'for...of' è supportato solo in ECMAScript 5 e versioni successive.",
"VERSION_6036": "VERSIONE",
@@ -1017,6 +1041,7 @@
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "L'inizializzatore del membro di enumerazione 'const' è stato valutato come valore non consentito 'NaN'.",
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "Le enumerazioni 'const' possono essere usate solo in espressioni di accesso a proprietà o indice oppure nella parte destra di un'assegnazione di esportazione, di una dichiarazione di importazione o di una query su tipo.",
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "Non è possibile chiamare 'delete' su un identificatore in modalità strict.",
+ "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "eliminare - Il progetto '{0}' è aggiornato perché è stato compilato in precedenza",
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "Le dichiarazioni 'enum' possono essere usate solo in un file con estensione ts.",
"export_can_only_be_used_in_a_ts_file_8003": "'export=' può essere usato solo in un file con estensione ts.",
"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668": "Non è possibile applicare il modificatore 'export' a moduli di ambiente e aumenti di modulo perché sono sempre visibili.",
diff --git a/lib/ja/diagnosticMessages.generated.json b/lib/ja/diagnosticMessages.generated.json
index 96d8b8e876..846237d617 100644
--- a/lib/ja/diagnosticMessages.generated.json
+++ b/lib/ja/diagnosticMessages.generated.json
@@ -49,8 +49,8 @@
"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "名前空間宣言は、それとマージするクラスや関数より前に配置できません。",
"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235": "名前空間宣言は、名前空間かモジュールでのみ使用できます。",
"A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038": "名前空間スタイルのインポートを呼び出したり、構築したりすることはできません。実行時にエラーが発生する原因となります。",
- "A_non_dry_build_would_build_project_0_6357": "A non-dry build would build project '{0}'",
- "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "A non-dry build would delete the following files: {0}",
+ "A_non_dry_build_would_build_project_0_6357": "非ドライ ビルドはプロジェクト '{0}' をビルドします",
+ "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "非ドライ ビルドは、次のファイルを削除します: {0}",
"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "パラメーター初期化子は、関数またはコンストラクターの実装でのみ指定できます。",
"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "パラメーター プロパティは、rest パラメーターを使用して宣言することはできません。",
"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "パラメーター プロパティは、コンストラクターの実装でのみ指定できます。",
@@ -102,6 +102,7 @@
"Add_all_missing_members_95022": "不足しているすべてのメンバーを追加します",
"Add_all_missing_super_calls_95039": "不足しているすべての super の呼び出しを追加します",
"Add_async_modifier_to_containing_function_90029": "含まれている関数に async 修飾子を追加します",
+ "Add_braces_to_arrow_function_95059": "アロー関数に中かっこを追加します",
"Add_definite_assignment_assertion_to_property_0_95020": "プロパティ '{0}' に限定代入アサーションを追加します",
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "初期化されていないすべてのプロパティに限定代入アサーションを追加します",
"Add_index_signature_for_property_0_90017": "プロパティ '{0}' のインデックス シグネチャを追加する",
@@ -109,6 +110,7 @@
"Add_initializers_to_all_uninitialized_properties_95027": "初期化されていないすべてのプロパティに初期化子を追加します",
"Add_missing_super_call_90001": "欠落している 'super()' 呼び出しを追加する",
"Add_missing_typeof_95052": "不足している 'typeof' を追加します",
+ "Add_or_remove_braces_in_an_arrow_function_95058": "アロー関数内の中かっこを追加または削除します",
"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037": "メンバー名と一致するすべての未解決の変数に修飾子を追加します",
"Add_to_all_uncalled_decorators_95044": "呼び出されていないすべてのデコレーターに '()' を追加します",
"Add_ts_ignore_to_all_error_messages_95042": "すべてのエラー メッセージに '@ts-ignore' を追加します",
@@ -191,9 +193,9 @@
"Binary_digit_expected_1177": "2 進の数字が必要です。",
"Binding_element_0_implicitly_has_an_1_type_7031": "バインド要素 '{0}' には暗黙的に '{1}' 型が含まれます。",
"Block_scoped_variable_0_used_before_its_declaration_2448": "ブロック スコープの変数 '{0}' が、宣言の前に使用されています。",
- "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Build all projects, including those that appear to be up to date",
- "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Build one or more projects and their dependencies, if out of date",
- "Building_project_0_6358": "Building project '{0}'...",
+ "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "最新の状態であると思われるものを含むすべてのプロジェクトをビルドします",
+ "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "最新でない場合は、1 つ以上のプロジェクトとその依存関係をビルドします",
+ "Building_project_0_6358": "プロジェクト \"{0}\" をビルドしています...",
"Call_decorator_expression_90028": "デコレーター式を呼び出す",
"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020": "戻り値の型の注釈がない呼び出しシグネチャの戻り値の型は、暗黙的に 'any' になります。",
"Call_target_does_not_contain_any_signatures_2346": "呼び出しターゲットにシグネチャが含まれていません。",
@@ -309,7 +311,7 @@
"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "デコレーターを同じ名前の複数の get/set アクセサーに適用することはできません。",
"Default_export_of_the_module_has_or_is_using_private_name_0_4082": "モジュールの既定エクスポートがプライベート名 '{0}' を持っているか、使用しています。",
"Delete_all_unused_declarations_95024": "未使用の宣言をすべて削除します",
- "Delete_the_outputs_of_all_projects_6365": "Delete the outputs of all projects",
+ "Delete_the_outputs_of_all_projects_6365": "すべてのプロジェクトの出力を削除します",
"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[非推奨] 代わりに '--jsxFactory' を使います。'react' JSX 発行を対象とするときに、createElement に対して呼び出されたオブジェクトを指定します",
"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[非推奨] 代わりに '--outFile' を使います。出力を連結して 1 つのファイルを生成します",
"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[非推奨] 代わりに '--skipLibCheck' を使います。既定のライブラリ宣言ファイルの型チェックをスキップします。",
@@ -360,7 +362,7 @@
"Enable_strict_checking_of_property_initialization_in_classes_6187": "クラス内のプロパティの初期化の厳密なチェックを有効にします。",
"Enable_strict_null_checks_6113": "厳格な null チェックを有効にします。",
"Enable_tracing_of_the_name_resolution_process_6085": "名前解決の処理のトレースを有効にします。",
- "Enable_verbose_logging_6366": "Enable verbose logging",
+ "Enable_verbose_logging_6366": "詳細ログを有効にします",
"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037": "すべてのインポートの名前空間オブジェクトを作成して、CommonJS と ES モジュール間の生成の相互運用性を有効にします。'allowSyntheticDefaultImports' を暗黙のうちに表します。",
"Enables_experimental_support_for_ES7_async_functions_6068": "ES7 非同期関数用の実験的なサポートを有効にします。",
"Enables_experimental_support_for_ES7_decorators_6065": "ES7 デコレーター用の実験的なサポートを有効にします。",
@@ -622,12 +624,12 @@
"Option_0_cannot_be_specified_without_specifying_option_1_5052": "オプション '{1}' を指定せずに、オプション '{0}' を指定することはできません。",
"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "オプション '{1}' またはオプション '{2}' を指定せずに、オプション '{0}' を指定することはできません。",
"Option_0_should_have_array_of_strings_as_a_value_6103": "オプション '{0}' には、値として文字列の配列を指定する必要があります。",
- "Option_build_must_be_the_first_command_line_argument_6369": "Option '--build' must be the first command line argument.",
+ "Option_build_must_be_the_first_command_line_argument_6369": "オプション '--build' は最初のコマンド ライン引数である必要があります。",
"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "オプション 'isolatedModules' は、オプション '--module' が指定されているか、オプション 'target' が 'ES2015' 以上であるかのいずれかの場合でのみ使用できます。",
"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "オプション 'paths' は、'--baseUrl' オプションを指定せずに使用できません。",
"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042": "オプション 'project' をコマンド ライン上でソース ファイルと一緒に指定することはできません。",
"Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070": "'node' モジュールの解決方法を使用せずにオプション '--resolveJsonModule' を指定することはできません。",
- "Options_0_and_1_cannot_be_combined_6370": "Options '{0}' and '{1}' cannot be combined.",
+ "Options_0_and_1_cannot_be_combined_6370": "オプション '{0}' と '{1}' を組み合わせることはできません。",
"Options_Colon_6027": "オプション:",
"Output_directory_for_generated_declaration_files_6166": "生成された宣言ファイルの出力ディレクトリ。",
"Output_file_0_from_project_1_does_not_exist_6309": "プロジェクト '{1}' からの出力ファイル '{0}' がありません",
@@ -675,15 +677,15 @@
"Print_names_of_generated_files_part_of_the_compilation_6154": "コンパイルの一環として生成されたファイル名を書き出します。",
"Print_the_compiler_s_version_6019": "コンパイラのバージョンを表示します。",
"Print_this_message_6017": "このメッセージを表示します。",
- "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Project '{0}' can't be built because its dependency '{1}' has errors",
- "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Project '{0}' is out of date because its dependency '{1}' is out of date",
- "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'",
- "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Project '{0}' is out of date because output file '{1}' does not exist",
- "Project_0_is_up_to_date_6361": "Project '{0}' is up to date",
- "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'",
- "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Project '{0}' is up to date with .d.ts files from its dependencies",
+ "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "プロジェクト '{0}' はその依存関係 '{1}' にエラーがあるためビルドできません",
+ "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "プロジェクト '{0}' はその依存関係 '{1}' が古いため最新の状態ではありません",
+ "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "プロジェクト '{0}' は最も古い出力 '{1}' が最新の入力 '{2}' より古いため最新の状態ではありません",
+ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "プロジェクト '{0}' は出力ファイル '{1}' が存在しないため最新の状態ではありません",
+ "Project_0_is_up_to_date_6361": "プロジェクト '{0}' は最新の状態です",
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "プロジェクト '{0}' は最新の入力 '{1}' が最も古い出力 '{2}' より古いため最新の状態です",
+ "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "プロジェクト '{0}' はその依存関係からの .d.ts ファイルで最新の状態です",
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "プロジェクト参照が円グラフを形成できません。循環が検出されました: {0}",
- "Projects_in_this_build_Colon_0_6355": "Projects in this build: {0}",
+ "Projects_in_this_build_Colon_0_6355": "このビルドのプロジェクト: {0}",
"Projects_to_reference_6300": "参照するプロジェクト",
"Property_0_does_not_exist_on_const_enum_1_2479": "プロパティ '{0}' が 'const' 列挙型 '{1}' に存在しません。",
"Property_0_does_not_exist_on_type_1_2339": "プロパティ '{0}' は型 '{1}' に存在しません。",
@@ -735,6 +737,7 @@
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "参照されているプロジェクト '{0}' には、設定 \"composite\": true が必要です。",
"Remove_all_unreachable_code_95051": "到達できないコードをすべて削除します",
"Remove_all_unused_labels_95054": "すべての未使用のラベルを削除します",
+ "Remove_braces_from_arrow_function_95060": "アロー関数から中かっこを削除します",
"Remove_declaration_for_Colon_0_90004": "次に対する宣言を削除する: '{0}'",
"Remove_destructuring_90009": "非構造化を削除します",
"Remove_import_from_0_90005": "'{0}' からのインポートを削除",
@@ -797,11 +800,11 @@
"Show_all_compiler_options_6169": "コンパイラ オプションをすべて表示します。",
"Show_diagnostic_information_6149": "診断情報を表示します。",
"Show_verbose_diagnostic_information_6150": "詳細な診断情報を表示します。",
- "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Show what would be built (or deleted, if specified with '--clean')",
+ "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "ビルドされる (または '--clean' で指定される場合は、削除される) 内容を表示する",
"Signature_0_must_be_a_type_predicate_1224": "シグネチャ '{0}' は型の述語である必要があります。",
"Skip_type_checking_of_declaration_files_6012": "宣言ファイルの型チェックをスキップします。",
- "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Skipping build of project '{0}' because its dependency '{1}' has errors",
- "Skipping_clean_because_not_all_projects_could_be_located_6371": "Skipping clean because not all projects could be located",
+ "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "プロジェクト '{0}' のビルドは、その依存関係 '{1}' にエラーがあるため、スキップしています",
+ "Skipping_clean_because_not_all_projects_could_be_located_6371": "一部のプロジェクトが見つからなかったためクリーンをスキップしています",
"Source_Map_Options_6175": "ソース マップ オプション",
"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382": "特殊化されたオーバーロード シグネチャは、特殊化されていないシグネチャに割り当てることはできません。",
"Specifier_of_dynamic_import_cannot_be_spread_element_1325": "動的インポートの指定子にはスプレッド要素を指定できません。",
@@ -977,7 +980,7 @@
"Unterminated_template_literal_1160": "未終了のテンプレート リテラルです。",
"Untyped_function_calls_may_not_accept_type_arguments_2347": "型指定のない関数の呼び出しで型引数を使用することはできません。",
"Unused_label_7028": "未使用のラベル。",
- "Updating_output_timestamps_of_project_0_6359": "Updating output timestamps of project '{0}'...",
+ "Updating_output_timestamps_of_project_0_6359": "プロジェクト '{0}' の出力タイムスタンプを更新しています...",
"Use_synthetic_default_member_95016": "合成 'default' メンバーを使用します。",
"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "'for...of' ステートメントでの文字列の使用は ECMAScript 5 以上でのみサポートされています。",
"VERSION_6036": "バージョン",
@@ -1038,7 +1041,7 @@
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "'const' 列挙型メンバーの初期化子が、許可されない値 'NaN' に評価されました。",
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "'const' 列挙型は、プロパティまたはインデックスのアクセス式、インポート宣言またはエクスポートの割り当ての右辺、型のクエリにのみ使用できます。",
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "厳格モードでは 'delete' を識別子で呼び出すことはできません。",
- "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "delete this - Project '{0}' is up to date because it was previously built",
+ "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "これを削除します - プロジェクト '{0}' は、以前にビルドされているため、最新の状態です",
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "'列挙型宣言' を使用できるのは .ts ファイル内のみです。",
"export_can_only_be_used_in_a_ts_file_8003": "'export=' を使用できるのは .ts ファイル内のみです。",
"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668": "環境モジュールとモジュール拡張は常に表示されるので、これらに 'export' 修飾子を適用することはできません。",
diff --git a/lib/ko/diagnosticMessages.generated.json b/lib/ko/diagnosticMessages.generated.json
index aaeb235aca..e695f8ccb6 100644
--- a/lib/ko/diagnosticMessages.generated.json
+++ b/lib/ko/diagnosticMessages.generated.json
@@ -49,8 +49,8 @@
"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "네임스페이스 선언은 해당 선언이 병합된 클래스나 함수 앞에 있을 수 없습니다.",
"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235": "네임스페이스 선언은 네임스페이스 또는 모듈에서만 사용할 수 있습니다.",
"A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038": "네임스페이스 스타일 가져오기를 호출하거나 생성할 수 없으며 런타임 시 오류가 발생합니다.",
- "A_non_dry_build_would_build_project_0_6357": "A non-dry build would build project '{0}'",
- "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "A non-dry build would delete the following files: {0}",
+ "A_non_dry_build_would_build_project_0_6357": "DRY가 아닌 빌드는 프로젝트 '{0}'을(를) 빌드합니다.",
+ "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "DRY가 아닌 빌드는 다음 파일을 삭제합니다. {0}",
"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "매개 변수 이니셜라이저는 함수 또는 생성자 구현에서만 허용됩니다.",
"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "rest 매개 변수를 사용하여 매개 변수 속성을 선언할 수 없습니다.",
"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "매개 변수 속성은 생성자 구현에서만 허용됩니다.",
@@ -102,6 +102,7 @@
"Add_all_missing_members_95022": "누락된 모든 멤버 추가",
"Add_all_missing_super_calls_95039": "누락된 모든 super 호출 추가",
"Add_async_modifier_to_containing_function_90029": "포함된 함수에 async 한정자 추가",
+ "Add_braces_to_arrow_function_95059": "화살표 함수에 중괄호 추가",
"Add_definite_assignment_assertion_to_property_0_95020": "'{0}' 속성에 한정된 할당 어설션 추가",
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "초기화되지 않은 모든 속성에 한정된 할당 어설션 추가",
"Add_index_signature_for_property_0_90017": "'{0}' 속성에 대해 인덱스 시그니처 추가",
@@ -109,6 +110,7 @@
"Add_initializers_to_all_uninitialized_properties_95027": "초기화되지 않은 모든 속성에 이니셜라이저 추가",
"Add_missing_super_call_90001": "누락된 'super()' 호출 추가",
"Add_missing_typeof_95052": "누락된 'typeof' 추가",
+ "Add_or_remove_braces_in_an_arrow_function_95058": "화살표 함수에 중괄호 추가 또는 제거",
"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037": "멤버 이름과 일치하는 모든 확인되지 않은 변수에 한정자 추가",
"Add_to_all_uncalled_decorators_95044": "호출되지 않는 모든 데코레이터에 '()' 추가",
"Add_ts_ignore_to_all_error_messages_95042": "모든 오류 메시지에 '@ts-ignore' 추가",
@@ -191,9 +193,9 @@
"Binary_digit_expected_1177": "이진수가 있어야 합니다.",
"Binding_element_0_implicitly_has_an_1_type_7031": "바인딩 요소 '{0}'에 암시적으로 '{1}' 형식이 있습니다.",
"Block_scoped_variable_0_used_before_its_declaration_2448": "선언 전에 사용된 블록 범위 변수 '{0}'입니다.",
- "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Build all projects, including those that appear to be up to date",
- "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Build one or more projects and their dependencies, if out of date",
- "Building_project_0_6358": "Building project '{0}'...",
+ "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "최신 상태로 표시될 프로젝트를 포함하여 모든 프로젝트 빌드",
+ "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "최신 상태가 아닌 경우, 하나 이상의 프로젝트 및 해당 종속성 빌드",
+ "Building_project_0_6358": "'{0}' 프로젝트를 빌드하는 중...",
"Call_decorator_expression_90028": "데코레이터 식 호출",
"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020": "반환 형식 주석이 없는 호출 시그니처에는 암시적으로 'any' 반환 형식이 포함됩니다.",
"Call_target_does_not_contain_any_signatures_2346": "호출 대상에 시그니처가 포함되어 있지 않습니다.",
@@ -309,7 +311,7 @@
"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "동일한 이름의 여러 get/set 접근자에 데코레이터를 적용할 수 없습니다.",
"Default_export_of_the_module_has_or_is_using_private_name_0_4082": "모듈의 기본 내보내기에서 전용 이름 '{0}'을(를) 가지고 있거나 사용 중입니다.",
"Delete_all_unused_declarations_95024": "사용하지 않는 선언 모두 삭제",
- "Delete_the_outputs_of_all_projects_6365": "Delete the outputs of all projects",
+ "Delete_the_outputs_of_all_projects_6365": "모든 프로젝트의 출력 삭제",
"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[사용되지 않음] 대신 '--jsxFactory'를 사용합니다. 'react' JSX 내보내기를 대상으로 할 경우 createElement에 대해 호출되는 개체를 지정합니다.",
"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[사용되지 않음] 대신 '--outFile'을 사용합니다. 출력을 연결하고 단일 파일로 내보냅니다.",
"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[사용되지 않음] 대신 '--skipLibCheck'를 사용합니다. 기본 라이브러리 선언 파일의 형식 검사를 건너뜁니다.",
@@ -360,7 +362,7 @@
"Enable_strict_checking_of_property_initialization_in_classes_6187": "클래스의 속성 초기화에 대해 엄격한 검사를 사용하도록 설정합니다.",
"Enable_strict_null_checks_6113": "엄격한 null 검사를 사용하도록 설정하세요.",
"Enable_tracing_of_the_name_resolution_process_6085": "이름 확인 프로세스 추적을 사용하도록 설정하세요.",
- "Enable_verbose_logging_6366": "Enable verbose logging",
+ "Enable_verbose_logging_6366": "자세한 정보 로깅 사용",
"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037": "모든 가져오기에 대한 네임스페이스 개체를 만들어 CommonJS 및 ES 모듈 간의 내보내기 상호 운용성을 사용하도록 설정합니다. 'allowSyntheticDefaultImports'를 의미합니다.",
"Enables_experimental_support_for_ES7_async_functions_6068": "ES7 비동기 함수에 대해 실험적 지원을 사용합니다.",
"Enables_experimental_support_for_ES7_decorators_6065": "ES7 데코레이터에 대해 실험적 지원을 사용합니다.",
@@ -622,12 +624,12 @@
"Option_0_cannot_be_specified_without_specifying_option_1_5052": "'{1}' 옵션을 지정하지 않고 '{0}' 옵션을 지정할 수 없습니다.",
"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "'{1}' 또는 '{2}' 옵션을 지정하지 않고 '{0}' 옵션을 지정할 수 없습니다.",
"Option_0_should_have_array_of_strings_as_a_value_6103": "'{0}' 옵션은 문자열 배열 값을 사용해야 합니다.",
- "Option_build_must_be_the_first_command_line_argument_6369": "Option '--build' must be the first command line argument.",
+ "Option_build_must_be_the_first_command_line_argument_6369": "'--build' 옵션은 첫 번째 명령줄 인수여야 합니다.",
"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "'isolatedModules' 옵션은 '--module' 옵션을 지정하거나 'target' 옵션이 'ES2015' 이상인 경우에만 사용할 수 있습니다.",
"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "'paths' 옵션은 '--baseUrl' 옵션을 지정하지 않고 사용할 수 없습니다.",
"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042": "명령줄에서 'project' 옵션을 원본 파일과 혼합하여 사용할 수 없습니다.",
"Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070": "'node' 모듈 확인 전략 없이 '--resolveJsonModule' 옵션을 지정할 수 없습니다.",
- "Options_0_and_1_cannot_be_combined_6370": "Options '{0}' and '{1}' cannot be combined.",
+ "Options_0_and_1_cannot_be_combined_6370": "'{0}' 및 '{1}' 옵션은 조합할 수 없습니다.",
"Options_Colon_6027": "옵션:",
"Output_directory_for_generated_declaration_files_6166": "생성된 선언 파일의 출력 디렉터리입니다.",
"Output_file_0_from_project_1_does_not_exist_6309": "프로젝트 '{1}'의 출력 파일 '{0}'이(가) 존재하지 않습니다.",
@@ -675,15 +677,15 @@
"Print_names_of_generated_files_part_of_the_compilation_6154": "컴파일의 일부인 생성된 파일의 이름을 인쇄합니다.",
"Print_the_compiler_s_version_6019": "컴파일러 버전을 인쇄합니다.",
"Print_this_message_6017": "이 메시지를 출력합니다.",
- "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Project '{0}' can't be built because its dependency '{1}' has errors",
- "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Project '{0}' is out of date because its dependency '{1}' is out of date",
- "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'",
- "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Project '{0}' is out of date because output file '{1}' does not exist",
- "Project_0_is_up_to_date_6361": "Project '{0}' is up to date",
- "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'",
- "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Project '{0}' is up to date with .d.ts files from its dependencies",
+ "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "'{1}' 종속성에 오류가 있기 때문에 '{0}' 프로젝트를 빌드할 수 없습니다.",
+ "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "'{1}' 종속성이 최신 상태가 아니기 때문에 '{0}' 프로젝트가 최신 상태가 아닙니다.",
+ "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "가장 오래된 출력 '{1}'이(가) 최신 입력 '{2}'보다 오래되었기 때문에 '{0}' 프로젝트가 최신 상태가 아닙니다.",
+ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "'{1}' 출력 파일이 존재하지 않기 때문에 '{0}' 프로젝트가 최신 상태가 아닙니다.",
+ "Project_0_is_up_to_date_6361": "'{0}' 프로젝트가 최신 상태입니다.",
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "최신 입력 '{1}'이(가) 가장 오래된 출력 '{2}'보다 오래되었기 때문에 '{0}' 프로젝트가 최신 상태입니다.",
+ "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "종속성의 .d.ts 파일이 있기 때문에 '{0}' 프로젝트가 최신 상태입니다.",
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "프로젝트 참조는 순환 그래프를 형성할 수 없습니다. 순환이 발견되었습니다. {0}",
- "Projects_in_this_build_Colon_0_6355": "Projects in this build: {0}",
+ "Projects_in_this_build_Colon_0_6355": "이 빌드의 프로젝트: {0}",
"Projects_to_reference_6300": "참조할 프로젝트",
"Property_0_does_not_exist_on_const_enum_1_2479": "'const' 열거형 '{1}'에 '{0}' 속성이 없습니다.",
"Property_0_does_not_exist_on_type_1_2339": "'{1}' 형식에 '{0}' 속성이 없습니다.",
@@ -735,6 +737,7 @@
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "참조되는 프로젝트 '{0}'에는 \"composite\": true 설정이 있어야 합니다.",
"Remove_all_unreachable_code_95051": "접근할 수 없는 코드 모두 제거",
"Remove_all_unused_labels_95054": "사용되지 않는 레이블 모두 제거",
+ "Remove_braces_from_arrow_function_95060": "화살표 함수에서 중괄호 제거",
"Remove_declaration_for_Colon_0_90004": "'{0}'에 대한 선언 제거",
"Remove_destructuring_90009": "구조 파괴 제거",
"Remove_import_from_0_90005": "'{0}'에서 가져오기 제거",
@@ -797,11 +800,11 @@
"Show_all_compiler_options_6169": "모든 컴파일러 옵션을 표시합니다.",
"Show_diagnostic_information_6149": "진단 정보를 표시합니다.",
"Show_verbose_diagnostic_information_6150": "자세한 진단 정보를 표시합니다.",
- "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Show what would be built (or deleted, if specified with '--clean')",
+ "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "빌드될 항목 표시(또는 '--clean'으로 지정된 경우 삭제될 항목 표시)",
"Signature_0_must_be_a_type_predicate_1224": "'{0}' 시그니처는 형식 조건자여야 합니다.",
"Skip_type_checking_of_declaration_files_6012": "선언 파일 형식 검사를 건너뜁니다.",
- "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Skipping build of project '{0}' because its dependency '{1}' has errors",
- "Skipping_clean_because_not_all_projects_could_be_located_6371": "Skipping clean because not all projects could be located",
+ "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "'{1}' 종속성에 오류가 있기 때문에 '{0}' 프로젝트 빌드를 건너뜁니다.",
+ "Skipping_clean_because_not_all_projects_could_be_located_6371": "일부 프로젝트를 찾을 수 없으므로 정리를 건너뛰는 중입니다.",
"Source_Map_Options_6175": "소스 맵 옵션",
"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382": "특수화된 오버로드 시그니처는 특수화되지 않은 서명에 할당할 수 없습니다.",
"Specifier_of_dynamic_import_cannot_be_spread_element_1325": "동적 가져오기의 지정자는 스프레드 요소일 수 없습니다.",
@@ -977,7 +980,7 @@
"Unterminated_template_literal_1160": "종결되지 않은 템플릿 리터럴입니다.",
"Untyped_function_calls_may_not_accept_type_arguments_2347": "형식화되지 않은 함수 호출에는 형식 인수를 사용할 수 없습니다.",
"Unused_label_7028": "사용되지 않는 레이블입니다.",
- "Updating_output_timestamps_of_project_0_6359": "Updating output timestamps of project '{0}'...",
+ "Updating_output_timestamps_of_project_0_6359": "'{0}' 프로젝트의 출력 타임스탬프를 업데이트하는 중...",
"Use_synthetic_default_member_95016": "가상 '기본' 멤버를 사용합니다.",
"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "ECMAScript 5 이상에서만 'for...of' 문에서 문자열을 사용할 수 있습니다.",
"VERSION_6036": "버전",
@@ -1038,7 +1041,7 @@
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "'const' 열거형 멤버 이니셜라이저가 허용되지 않은 'NaN' 값에 대해 평가되었습니다.",
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "'const' 열거형은 속성 또는 인덱스 액세스 식 또는 내보내기 할당 또는 가져오기 선언의 오른쪽 또는 형식 쿼리에서만 사용할 수 있습니다.",
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "strict 모드에서는 식별자에 대해 'delete'를 호출할 수 없습니다.",
- "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "delete this - Project '{0}' is up to date because it was previously built",
+ "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "이 항목 삭제 - '{0}' 프로젝트는 이전에 빌드되었기 때문에 최신 상태입니다.",
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "'enum 선언'은 .ts 파일에서만 사용할 수 있습니다.",
"export_can_only_be_used_in_a_ts_file_8003": "'export='는 .ts 파일에서만 사용할 수 있습니다.",
"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668": "앰비언트 모듈 및 모듈 확대는 항상 표시되므로 'export' 한정자를 적용할 수 없습니다.",
diff --git a/lib/pl/diagnosticMessages.generated.json b/lib/pl/diagnosticMessages.generated.json
index 96befeffb8..c5b17f6056 100644
--- a/lib/pl/diagnosticMessages.generated.json
+++ b/lib/pl/diagnosticMessages.generated.json
@@ -49,8 +49,8 @@
"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Deklaracja przestrzeni nazw nie może występować przed klasą lub funkcją, z którą ją scalono.",
"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235": "Deklaracja przestrzeni nazw jest dozwolona tylko w przestrzeni nazw lub module.",
"A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038": "Nie można wywołać lub skonstruować importu stylu przestrzeni nazw. Spowoduje to błąd w czasie wykonania.",
- "A_non_dry_build_would_build_project_0_6357": "A non-dry build would build project '{0}'",
- "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "A non-dry build would delete the following files: {0}",
+ "A_non_dry_build_would_build_project_0_6357": "Kompilacja inna niż DRY spowodowałaby skompilowanie projektu „{0}”",
+ "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "Kompilacja inna niż DRY spowodowałaby usunięcie następujących plików: {0}",
"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "Inicjator parametru jest dozwolony tylko w implementacji funkcji lub konstruktora.",
"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "Właściwości parametru nie można zadeklarować za pomocą parametru rest.",
"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "Właściwość parametru jest dozwolona tylko w implementacji konstruktora.",
@@ -102,6 +102,7 @@
"Add_all_missing_members_95022": "Dodaj wszystkie brakujące elementy członkowskie",
"Add_all_missing_super_calls_95039": "Dodaj wszystkie brakujące wywołania typu super",
"Add_async_modifier_to_containing_function_90029": "Dodaj modyfikator asynchroniczny do funkcji zawierającej",
+ "Add_braces_to_arrow_function_95059": "Dodaj nawiasy klamrowe do funkcji strzałki",
"Add_definite_assignment_assertion_to_property_0_95020": "Dodaj asercję określonego przypisania do właściwości „{0}”",
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Dodaj asercję określonego przypisania do wszystkich niezainicjowanych właściwości",
"Add_index_signature_for_property_0_90017": "Dodaj sygnaturę indeksu dla właściwości „{0}”",
@@ -109,6 +110,7 @@
"Add_initializers_to_all_uninitialized_properties_95027": "Dodaj inicjatory do wszystkich niezainicjowanych właściwości",
"Add_missing_super_call_90001": "Dodaj brakujące wywołanie „super()”",
"Add_missing_typeof_95052": "Dodaj brakujący element „typeof”",
+ "Add_or_remove_braces_in_an_arrow_function_95058": "Dodaj lub usuń nawiasy klamrowe w funkcji strzałki",
"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037": "Dodaj kwalifikator do wszystkich nierozpoznanych zmiennych pasujących do nazwy składowej",
"Add_to_all_uncalled_decorators_95044": "Dodaj element „()” do wszystkich niewywoływanych dekoratorów",
"Add_ts_ignore_to_all_error_messages_95042": "Dodaj element „@ts-ignore” do wszystkich komunikatów o błędach",
@@ -191,9 +193,9 @@
"Binary_digit_expected_1177": "Oczekiwano bitu.",
"Binding_element_0_implicitly_has_an_1_type_7031": "Dla elementu powiązania „{0}” niejawnie określono typ „{1}”.",
"Block_scoped_variable_0_used_before_its_declaration_2448": "Zmienna „{0}” o zakresie bloku została użyta przed jej deklaracją.",
- "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Build all projects, including those that appear to be up to date",
- "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Build one or more projects and their dependencies, if out of date",
- "Building_project_0_6358": "Building project '{0}'...",
+ "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Kompiluj wszystkie projekty, łącznie z tymi, które wydają się być aktualne",
+ "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Kompiluj co najmniej jeden projekt i jego zależności, jeśli są nieaktualne",
+ "Building_project_0_6358": "Trwa kompilowanie projektu „{0}”...",
"Call_decorator_expression_90028": "Wywołaj wyrażenie dekoratora",
"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020": "Dla sygnatury wywołania bez adnotacji zwracanego typu niejawnie określono zwracany typ „any”.",
"Call_target_does_not_contain_any_signatures_2346": "Cel wywołania nie zawiera żadnych podpisów.",
@@ -309,7 +311,7 @@
"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Nie można stosować elementów Decorator do wielu metod dostępu pobierania/ustawiania o takiej samej nazwie.",
"Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Domyślny eksport modułu ma nazwę prywatną „{0}” lub używa tej nazwy.",
"Delete_all_unused_declarations_95024": "Usuń wszystkie nieużywane deklaracje",
- "Delete_the_outputs_of_all_projects_6365": "Delete the outputs of all projects",
+ "Delete_the_outputs_of_all_projects_6365": "Usuń dane wyjściowe wszystkich projektów",
"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Przestarzałe] Użyj w zastępstwie opcji „--jsxFactory”. Określ obiekt wywoływany dla elementu createElement przy określaniu jako celu emisji JSX „react”",
"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Przestarzałe] Użyj w zastępstwie opcji „--outFile”. Połącz dane wyjściowe i wyemituj jako jeden plik",
"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Przestarzałe] Użyj w zastępstwie opcji „--skipLibCheck”. Pomiń sprawdzanie typów domyślnych plików deklaracji biblioteki.",
@@ -360,7 +362,7 @@
"Enable_strict_checking_of_property_initialization_in_classes_6187": "Włącz dokładne sprawdzanie inicjowania właściwości w klasach.",
"Enable_strict_null_checks_6113": "Włącz dokładne sprawdzanie wartości null.",
"Enable_tracing_of_the_name_resolution_process_6085": "Włącz śledzenie procesu rozpoznawania nazw.",
- "Enable_verbose_logging_6366": "Enable verbose logging",
+ "Enable_verbose_logging_6366": "Włącz pełne rejestrowanie",
"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037": "Umożliwia współdziałanie emitowania między modułami CommonJS i ES przez tworzenie obiektów przestrzeni nazw dla wszystkich importów. Implikuje użycie ustawienia „allowSyntheticDefaultImports”.",
"Enables_experimental_support_for_ES7_async_functions_6068": "Umożliwia obsługę eksperymentalną funkcji asynchronicznych języka ES7.",
"Enables_experimental_support_for_ES7_decorators_6065": "Umożliwia obsługę eksperymentalną elementów Decorator języka ES7.",
@@ -622,12 +624,12 @@
"Option_0_cannot_be_specified_without_specifying_option_1_5052": "Opcji „{0}” nie można określić bez opcji „{1}”.",
"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "Opcji „{0}” nie można określić bez opcji „{1}” lub opcji „{2}”.",
"Option_0_should_have_array_of_strings_as_a_value_6103": "Wartość opcji „{0}” powinna być tablicą łańcuchów.",
- "Option_build_must_be_the_first_command_line_argument_6369": "Option '--build' must be the first command line argument.",
+ "Option_build_must_be_the_first_command_line_argument_6369": "Opcja „--build” musi być pierwszym argumentem wiersza polecenia.",
"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "Opcji „isolatedModules” można użyć tylko wtedy, gdy podano opcję „--module” lub opcja „target” określa cel „ES2015” lub wyższy.",
"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "Opcji „paths” nie można użyć bez podawania opcji „--baseUrl”.",
"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042": "Nie można mieszać opcji „project” z plikami źródłowymi w wierszu polecenia.",
"Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070": "Nie można określić opcji „--resolveJsonModule” bez strategii rozpoznawania modułów „node”.",
- "Options_0_and_1_cannot_be_combined_6370": "Options '{0}' and '{1}' cannot be combined.",
+ "Options_0_and_1_cannot_be_combined_6370": "Nie można połączyć opcji „{0}” i „{1}”.",
"Options_Colon_6027": "Opcje:",
"Output_directory_for_generated_declaration_files_6166": "Katalog wyjściowy dla wygenerowanych plików deklaracji.",
"Output_file_0_from_project_1_does_not_exist_6309": "Plik wyjściowy „{0}” z projektu „{1}” nie istnieje",
@@ -675,15 +677,15 @@
"Print_names_of_generated_files_part_of_the_compilation_6154": "Drukuj nazwy wygenerowanych plików będących częścią kompilacji.",
"Print_the_compiler_s_version_6019": "Wypisz wersję kompilatora.",
"Print_this_message_6017": "Wypisz ten komunikat.",
- "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Project '{0}' can't be built because its dependency '{1}' has errors",
- "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Project '{0}' is out of date because its dependency '{1}' is out of date",
- "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'",
- "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Project '{0}' is out of date because output file '{1}' does not exist",
- "Project_0_is_up_to_date_6361": "Project '{0}' is up to date",
- "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'",
- "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Project '{0}' is up to date with .d.ts files from its dependencies",
+ "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Nie można skompilować projektu „{0}”, ponieważ jego zależność „{1}” zawiera błędy",
+ "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Projekt „{0}” jest nieaktualny, ponieważ jego zależność „{1}” jest nieaktualna",
+ "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Projekt „{0}” jest nieaktualny, ponieważ najstarsze dane wyjściowe „{1}” są starsze niż najnowsze dane wejściowe „{2}”",
+ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Projekt „{0}” jest nieaktualny, ponieważ plik wyjściowy „{1}” nie istnieje",
+ "Project_0_is_up_to_date_6361": "Projekt „{0}” jest aktualny",
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Projekt „{0}” jest aktualny, ponieważ najnowsze dane wejściowe „{1}” są starsze niż najstarsze dane wyjściowe „{2}”",
+ "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Projekt „{0}” jest aktualny z plikami .d.ts z jego zależności",
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Odwołania do projektu nie mogą tworzyć grafu kołowego. Wykryto cykl: {0}",
- "Projects_in_this_build_Colon_0_6355": "Projects in this build: {0}",
+ "Projects_in_this_build_Colon_0_6355": "Projekty w tej kompilacji: {0}",
"Projects_to_reference_6300": "Projekty do przywołania",
"Property_0_does_not_exist_on_const_enum_1_2479": "Właściwość „{0}” nie istnieje w wyliczeniu ze specyfikatorem „const” „{1}”.",
"Property_0_does_not_exist_on_type_1_2339": "Właściwość „{0}” nie istnieje w typie „{1}”.",
@@ -735,6 +737,7 @@
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "Przywoływany projekt „{0}” musi mieć ustawienie „composite” o wartości true.",
"Remove_all_unreachable_code_95051": "Usuń cały nieosiągalny kod",
"Remove_all_unused_labels_95054": "Usuń wszystkie nieużywane etykiety",
+ "Remove_braces_from_arrow_function_95060": "Usuń nawiasy klamrowe z funkcji strzałki",
"Remove_declaration_for_Colon_0_90004": "Usuń deklarację dla: „{0}”",
"Remove_destructuring_90009": "Usuń usuwanie struktury",
"Remove_import_from_0_90005": "Usuń import z „{0}”",
@@ -797,11 +800,11 @@
"Show_all_compiler_options_6169": "Pokaż wszystkie opcje kompilatora.",
"Show_diagnostic_information_6149": "Pokaż informacje diagnostyczne.",
"Show_verbose_diagnostic_information_6150": "Pokaż pełne informacje diagnostyczne.",
- "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Show what would be built (or deleted, if specified with '--clean')",
+ "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Pokaż, co zostanie skompilowane (lub usunięte, jeśli określono opcję „--clean”)",
"Signature_0_must_be_a_type_predicate_1224": "Sygnatura „{0}” musi być predykatem typów.",
"Skip_type_checking_of_declaration_files_6012": "Pomiń sprawdzanie typu plików deklaracji.",
- "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Skipping build of project '{0}' because its dependency '{1}' has errors",
- "Skipping_clean_because_not_all_projects_could_be_located_6371": "Skipping clean because not all projects could be located",
+ "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Pomijanie kompilacji projektu „{0}”, ponieważ jego zależność „{1}” zawiera błędy",
+ "Skipping_clean_because_not_all_projects_could_be_located_6371": "Pomijanie czyszczenia, ponieważ nie można zlokalizować wszystkich projektów",
"Source_Map_Options_6175": "Opcje mapy źródła",
"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382": "Nie można przypisać specjalizowanej sygnatury przeciążenia do żadnej sygnatury niespecjalizowanej.",
"Specifier_of_dynamic_import_cannot_be_spread_element_1325": "Specyfikator dynamicznego importowania nie może być elementem spread.",
@@ -977,7 +980,7 @@
"Unterminated_template_literal_1160": "Niezakończony literał szablonu.",
"Untyped_function_calls_may_not_accept_type_arguments_2347": "Wywołania funkcji bez typu nie mogą przyjmować argumentów typu.",
"Unused_label_7028": "Nieużywana etykieta.",
- "Updating_output_timestamps_of_project_0_6359": "Updating output timestamps of project '{0}'...",
+ "Updating_output_timestamps_of_project_0_6359": "Trwa aktualizowanie sygnatury czasowej danych wyjściowych projektu „{0}”...",
"Use_synthetic_default_member_95016": "Użyj syntetycznej składowej „default”.",
"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "Używanie ciągu w instrukcji „for...of” jest obsługiwane tylko w języku ECMAScript 5 lub nowszym.",
"VERSION_6036": "WERSJA",
@@ -1038,7 +1041,7 @@
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "Wynikiem obliczenia inicjatora składowej wyliczenia ze specyfikatorem „const” jest niedozwolona wartość „NaN”.",
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "Wyliczenia ze specyfikatorem „const” mogą być używane tylko w wyrażeniach dostępu do indeksu lub właściwości albo po prawej stronie deklaracji importu, przypisania eksportu lub typu zapytania.",
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "Nie można wywołać elementu „delete” dla identyfikatora w trybie z ograniczeniami.",
- "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "delete this - Project '{0}' is up to date because it was previously built",
+ "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "usuń to — projekt „{0}” jest aktualny, ponieważ został wcześniej skompilowany",
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "Deklaracji enum można używać tylko w pliku ts.",
"export_can_only_be_used_in_a_ts_file_8003": "Ciągu „export=” można użyć tylko w pliku ts.",
"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668": "Modyfikator „export” nie może być stosowany do modułów otoczenia ani rozszerzeń modułów, ponieważ są one zawsze widoczne.",
diff --git a/lib/protocol.d.ts b/lib/protocol.d.ts
index 05f108613a..987fbf9ae2 100644
--- a/lib/protocol.d.ts
+++ b/lib/protocol.d.ts
@@ -336,6 +336,7 @@ declare namespace ts.server.protocol {
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
@@ -1711,6 +1712,10 @@ declare namespace ts.server.protocol {
*/
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.
*/
@@ -1726,6 +1731,22 @@ declare namespace ts.server.protocol {
*/
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.
@@ -2234,7 +2255,6 @@ declare namespace ts.server.protocol {
interface TextInsertion {
newText: string;
- /** The position in newText the caret should point to after the insertion. */
caretOffset: number;
}
@@ -2250,13 +2270,9 @@ declare namespace ts.server.protocol {
}
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"
}
@@ -2270,56 +2286,27 @@ declare namespace ts.server.protocol {
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",
@@ -2329,11 +2316,7 @@ declare namespace ts.server.protocol {
letElement = "let",
directory = "directory",
externalModuleName = "external module name",
- /**
- *
- */
jsxAttribute = "JSX attribute",
- /** String literal */
string = "string"
}
@@ -2356,11 +2339,6 @@ declare namespace ts.server.protocol {
text?: string;
}
- /**
- * 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;
}
@@ -2370,13 +2348,9 @@ declare namespace ts.server.protocol {
}
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;
}
diff --git a/lib/pt-br/diagnosticMessages.generated.json b/lib/pt-br/diagnosticMessages.generated.json
index e4afa14afb..abae5e7a64 100644
--- a/lib/pt-br/diagnosticMessages.generated.json
+++ b/lib/pt-br/diagnosticMessages.generated.json
@@ -49,8 +49,8 @@
"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Uma declaração de namespace não pode estar localizada antes de uma classe ou função com a qual ela é mesclada.",
"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235": "Uma declaração de namespace só é permitida e um namespace ou módulo.",
"A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038": "Uma importação de estilo do namespace não pode ser chamada nem construída e causará uma falha no tempo de execução.",
- "A_non_dry_build_would_build_project_0_6357": "A non-dry build would build project '{0}'",
- "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "A non-dry build would delete the following files: {0}",
+ "A_non_dry_build_would_build_project_0_6357": "Um build não dry compilaria o projeto '{0}'",
+ "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "Um build não dry excluiria os seguintes arquivos: {0}",
"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "Um inicializador de parâmetro só é permitido em uma implementação de função ou de construtor.",
"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "Uma propriedade de parâmetro não pode ser declarada usando um parâmetro rest.",
"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "Uma propriedade de parâmetro somente é permitida em uma implementação de construtor.",
@@ -102,6 +102,7 @@
"Add_all_missing_members_95022": "Adicionar todos os membros ausentes",
"Add_all_missing_super_calls_95039": "Adicionar todas as chamadas super ausentes",
"Add_async_modifier_to_containing_function_90029": "Adicione o modificador assíncrono que contém a função",
+ "Add_braces_to_arrow_function_95059": "Adicionar chaves para a função de seta",
"Add_definite_assignment_assertion_to_property_0_95020": "Adicionar a asserção de atribuição definitiva à propriedade '{0}'",
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Adicionar declarações de atribuição definidas a todas as propriedades não inicializadas",
"Add_index_signature_for_property_0_90017": "Adicionar assinatura de índice para a propriedade '{0}'",
@@ -109,6 +110,7 @@
"Add_initializers_to_all_uninitialized_properties_95027": "Adicionar inicializadores a todas as propriedades não inicializadas",
"Add_missing_super_call_90001": "Adicionar chamada 'super()' ausente",
"Add_missing_typeof_95052": "Adicionar 'typeof' ausente",
+ "Add_or_remove_braces_in_an_arrow_function_95058": "Adicionar ou remover chaves em uma função de seta",
"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037": "Adicionar um qualificador a todas as variáveis não resolvidas correspondentes a um nome de membro",
"Add_to_all_uncalled_decorators_95044": "Adicionar '()' a todos os decoradores não chamados",
"Add_ts_ignore_to_all_error_messages_95042": "Adicionar '@ts-ignore' a todas as mensagens de erro",
@@ -191,9 +193,9 @@
"Binary_digit_expected_1177": "Dígito binário esperado.",
"Binding_element_0_implicitly_has_an_1_type_7031": "O elemento de associação '{0}' tem implicitamente um tipo '{1}'.",
"Block_scoped_variable_0_used_before_its_declaration_2448": "Variável de escopo de bloco '{0}' usada antes da sua declaração.",
- "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Build all projects, including those that appear to be up to date",
- "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Build one or more projects and their dependencies, if out of date",
- "Building_project_0_6358": "Building project '{0}'...",
+ "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Compilar todos os projetos, incluindo aqueles que parecem estar atualizados",
+ "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Compilar um ou mais projetos e suas dependências, se estiverem desatualizados",
+ "Building_project_0_6358": "Compilando o projeto '{0}'...",
"Call_decorator_expression_90028": "Chamar expressão do decorador",
"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020": "Assinatura de chamada, que não tem a anotação de tipo de retorno, implicitamente tem um tipo de retorno 'any'.",
"Call_target_does_not_contain_any_signatures_2346": "O destino da chamada não contém nenhuma assinatura.",
@@ -214,7 +216,7 @@
"Cannot_find_global_type_0_2318": "Não é possível encontrar o tipo global '{0}'.",
"Cannot_find_global_value_0_2468": "Não é possível encontrar o valor global '{0}'.",
"Cannot_find_lib_definition_for_0_2726": "Não é possível encontrar a definição de lib para '{0}'.",
- "Cannot_find_lib_definition_for_0_Did_you_mean_1_2727": "Cannot find lib definition for '{0}'. Did you mean '{1}'?",
+ "Cannot_find_lib_definition_for_0_Did_you_mean_1_2727": "Não é possível encontrar a definição de lib para '{0}'. Você quis dizer '{1}'?",
"Cannot_find_module_0_2307": "Não é possível encontrar o módulo '{0}'.",
"Cannot_find_name_0_2304": "Não é possível encontrar o nome '{0}'.",
"Cannot_find_name_0_Did_you_mean_1_2552": "Não é possível localizar o nome '{0}'. Você quis dizer '{1}'?",
@@ -309,7 +311,7 @@
"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Os decoradores não podem ser aplicados a vários acessadores get/set de mesmo nome.",
"Default_export_of_the_module_has_or_is_using_private_name_0_4082": "A exportação padrão do módulo tem ou está usando o nome particular '{0}'.",
"Delete_all_unused_declarations_95024": "Excluir todas as declarações não usadas",
- "Delete_the_outputs_of_all_projects_6365": "Delete the outputs of all projects",
+ "Delete_the_outputs_of_all_projects_6365": "Excluir as saídas de todos os projetos",
"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Preterido] Use '--jsxFactory' no lugar. Especifique o objeto invocado para createElement ao direcionar uma emissão de JSX 'react'",
"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Preterido] Use '--outFile' no lugar. Concatene e emita uma saída para um arquivo único",
"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Preterido] Use '--skipLibCheck' no lugar. Ignore a verificação de tipo dos arquivos de declaração de biblioteca padrão.",
@@ -360,7 +362,7 @@
"Enable_strict_checking_of_property_initialization_in_classes_6187": "Habilite a verificação estrita de inicialização de propriedade nas classes.",
"Enable_strict_null_checks_6113": "Habilite verificações nulas estritas.",
"Enable_tracing_of_the_name_resolution_process_6085": "Habilite o rastreio do processo de resolução de nome.",
- "Enable_verbose_logging_6366": "Enable verbose logging",
+ "Enable_verbose_logging_6366": "Habilitar registro em log detalhado",
"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037": "Permite emissão de interoperabilidade entre CommonJS e Módulos ES através da criação de objetos de namespace para todas as importações. Implica em 'allowSyntheticDefaultImports'.",
"Enables_experimental_support_for_ES7_async_functions_6068": "Habilita o suporte experimental para funções assíncronas de ES7.",
"Enables_experimental_support_for_ES7_decorators_6065": "Habilita o suporte experimental para decoradores ES7.",
@@ -622,12 +624,12 @@
"Option_0_cannot_be_specified_without_specifying_option_1_5052": "A opção '{0}' não pode ser especificada sem especificar a opção '{1}'.",
"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "A opção '{0}' não pode ser especificada sem especificar a opção '{1}' ou a opção '{2}'.",
"Option_0_should_have_array_of_strings_as_a_value_6103": "A opção '{0}' deve ter matriz de cadeias de um valor.",
- "Option_build_must_be_the_first_command_line_argument_6369": "Option '--build' must be the first command line argument.",
+ "Option_build_must_be_the_first_command_line_argument_6369": "A opção '--build' precisa ser o primeiro argumento da linha de comando.",
"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "A opção 'isolatedModules' só pode ser usada quando nenhuma opção de '--module' for fornecida ou a opção 'target' for 'ES2015' ou superior.",
"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "A opção 'paths' não pode ser usada sem se especificar a opção '--baseUrl'.",
"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042": "A opção 'project' não pode ser mesclada com arquivos de origem em uma linha de comando.",
"Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070": "A opção '--resolveJsonModule' não pode ser especificada sem a estratégia de resolução de módulo de 'nó'.",
- "Options_0_and_1_cannot_be_combined_6370": "Options '{0}' and '{1}' cannot be combined.",
+ "Options_0_and_1_cannot_be_combined_6370": "As opções '{0}' e '{1}' não podem ser combinadas.",
"Options_Colon_6027": "Opções:",
"Output_directory_for_generated_declaration_files_6166": "Diretório de saída para os arquivos de declaração gerados.",
"Output_file_0_from_project_1_does_not_exist_6309": "O arquivo de saída '{0}' do projeto '{1}' não existe",
@@ -675,15 +677,15 @@
"Print_names_of_generated_files_part_of_the_compilation_6154": "Nomes de impressão das partes dos arquivos gerados da compilação.",
"Print_the_compiler_s_version_6019": "Imprima a versão do compilador.",
"Print_this_message_6017": "Imprima esta mensagem.",
- "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Project '{0}' can't be built because its dependency '{1}' has errors",
- "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Project '{0}' is out of date because its dependency '{1}' is out of date",
- "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'",
- "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Project '{0}' is out of date because output file '{1}' does not exist",
- "Project_0_is_up_to_date_6361": "Project '{0}' is up to date",
- "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'",
- "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Project '{0}' is up to date with .d.ts files from its dependencies",
+ "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "O projeto '{0}' não pode ser compilado porque sua dependência '{1}' tem erros",
+ "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "O projeto '{0}' está desatualizado porque sua dependência '{1}' está desatualizada",
+ "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "O projeto '{0}' está desatualizado porque a saída mais antiga '{1}' é mais antiga que a entrada mais recente '{2}'",
+ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "O projeto '{0}' está desatualizado porque o arquivo de saída '{1}' não existe",
+ "Project_0_is_up_to_date_6361": "O projeto '{0}' está atualizado",
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "O projeto '{0}' está atualizado porque a entrada mais recente '{1}' é mais antiga que a saída mais antiga '{2}'",
+ "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "O projeto '{0}' está atualizado com os arquivos .d.ts de suas dependências",
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Referências de projeto não podem formar um gráfico circular. Ciclo detectado: {0}",
- "Projects_in_this_build_Colon_0_6355": "Projects in this build: {0}",
+ "Projects_in_this_build_Colon_0_6355": "Projetos neste build: {0}",
"Projects_to_reference_6300": "Projetos para referência",
"Property_0_does_not_exist_on_const_enum_1_2479": "A propriedade '{0}' não existe na enumeração 'const' '{1}'.",
"Property_0_does_not_exist_on_type_1_2339": "A propriedade '{0}' não existe no tipo '{1}'.",
@@ -735,6 +737,7 @@
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "O projeto referenciado '{0}' deve ter a configuração de \"composite\": true.",
"Remove_all_unreachable_code_95051": "Remover todo o código inacessível",
"Remove_all_unused_labels_95054": "Remover todos os rótulos não utilizados",
+ "Remove_braces_from_arrow_function_95060": "Remover chaves da função de seta",
"Remove_declaration_for_Colon_0_90004": "Remover declaração para: '{0}'",
"Remove_destructuring_90009": "Remover desestruturação",
"Remove_import_from_0_90005": "Remover importação do '{0}'",
@@ -797,11 +800,11 @@
"Show_all_compiler_options_6169": "Mostrar todas as opções do compilador.",
"Show_diagnostic_information_6149": "Mostras as informações de diagnóstico.",
"Show_verbose_diagnostic_information_6150": "Mostras as informações detalhadas de diagnóstico.",
- "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Show what would be built (or deleted, if specified with '--clean')",
+ "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Mostrar o que seria compilado (ou excluído, se especificado com '--clean')",
"Signature_0_must_be_a_type_predicate_1224": "A assinatura '{0}' deve ser um predicado de tipo.",
"Skip_type_checking_of_declaration_files_6012": "Ignorar a verificação de tipo dos arquivos de declaração.",
- "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Skipping build of project '{0}' because its dependency '{1}' has errors",
- "Skipping_clean_because_not_all_projects_could_be_located_6371": "Skipping clean because not all projects could be located",
+ "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Ignorando build do projeto '{0}' porque sua dependência '{1}' tem erros",
+ "Skipping_clean_because_not_all_projects_could_be_located_6371": "Ignorando a limpeza porque nem todos os projetos foram localizados",
"Source_Map_Options_6175": "Opções do Sourcemap",
"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382": "A assinatura de sobrecarga especializada não pode ser atribuída a qualquer assinatura não especializada.",
"Specifier_of_dynamic_import_cannot_be_spread_element_1325": "O especificador de importação dinâmica não pode ser o elemento de difusão.",
@@ -977,7 +980,7 @@
"Unterminated_template_literal_1160": "Literal de modelo não finalizado.",
"Untyped_function_calls_may_not_accept_type_arguments_2347": "Chamadas de função não tipadas não podem aceitar argumentos de tipo.",
"Unused_label_7028": "Rótulo não utilizado.",
- "Updating_output_timestamps_of_project_0_6359": "Updating output timestamps of project '{0}'...",
+ "Updating_output_timestamps_of_project_0_6359": "Atualizando os carimbos de data/hora de saída do projeto '{0}'...",
"Use_synthetic_default_member_95016": "Use o membro sintético 'padrão'.",
"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "Há suporte para o uso de uma cadeia de caracteres em uma instrução 'for...of' somente no ECMAScript 5 e superior.",
"VERSION_6036": "VERSÃO",
@@ -1038,7 +1041,7 @@
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "O inicializador de membro de enumeração 'const' foi avaliado como o valor não permitido 'NaN'.",
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "Enumerações 'const' só podem ser usadas em expressões de acesso de índice ou propriedade, ou então do lado direito de uma consulta de tipo, declaração de importação ou atribuição de exportação.",
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "'delete' não pode ser chamado em um identificador no modo estrito.",
- "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "delete this - Project '{0}' is up to date because it was previously built",
+ "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "excluir isto – o Projeto '{0}' está atualizado porque ele já foi compilado",
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "'enum declarations' só podem ser usadas em um arquivo .ts.",
"export_can_only_be_used_in_a_ts_file_8003": "'export=' só pode ser usado em um arquivo .ts.",
"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668": "O modificador 'export' não pode ser aplicado a módulos de ambiente e acréscimos de módulo, pois eles estão sempre visíveis.",
diff --git a/lib/ru/diagnosticMessages.generated.json b/lib/ru/diagnosticMessages.generated.json
index 4e05507039..1da5b76d7a 100644
--- a/lib/ru/diagnosticMessages.generated.json
+++ b/lib/ru/diagnosticMessages.generated.json
@@ -49,6 +49,8 @@
"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Объявление пространства имен не может располагаться раньше класса или функции, с которыми оно объединено.",
"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235": "Объявление пространства имен разрешено использовать только в пространстве имен или модуле.",
"A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038": "Импорт стиля пространства имен не может быть вызван или создан и приведет к сбою во время выполнения.",
+ "A_non_dry_build_would_build_project_0_6357": "При выполнении сборки в рабочем режиме будет собран проект \"{0}\"",
+ "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "При выполнении сборки в рабочем режиме будут удалены следующие файлы: {0}",
"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "Инициализатор параметра разрешено использовать только в реализации функции или конструктора.",
"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "Свойство параметра невозможно объявить с помощью параметра REST.",
"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "Свойство параметра допускается только в реализации конструктора.",
@@ -100,6 +102,7 @@
"Add_all_missing_members_95022": "Добавить все отсутствующие элементы",
"Add_all_missing_super_calls_95039": "Добавить все отсутствующие вызовы super",
"Add_async_modifier_to_containing_function_90029": "Добавьте модификатор async в содержащую функцию",
+ "Add_braces_to_arrow_function_95059": "Добавить скобки в стрелочную функцию",
"Add_definite_assignment_assertion_to_property_0_95020": "Добавить утверждение определенного присваивания к свойству \"{0}\"",
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Добавить утверждения определенного присваивания ко всем неинициализированным свойствам",
"Add_index_signature_for_property_0_90017": "Добавьте сигнатуру индекса для свойства \"{0}\"",
@@ -107,6 +110,7 @@
"Add_initializers_to_all_uninitialized_properties_95027": "Добавить инициализаторы ко всем неинициализированным свойствам",
"Add_missing_super_call_90001": "Добавьте отсутствующий вызов \"super()\"",
"Add_missing_typeof_95052": "Добавить отсутствующий \"typeof\"",
+ "Add_or_remove_braces_in_an_arrow_function_95058": "Добавить скобки в стрелочную функцию или удалить скобки из нее",
"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037": "Добавить квалификатор ко всем неразрешенным переменным, соответствующим имени члена",
"Add_to_all_uncalled_decorators_95044": "Добавить \"()\" ко всем невызванным декораторам",
"Add_ts_ignore_to_all_error_messages_95042": "Добавить \"@ts-ignore\" ко всем сообщениям об ошибках",
@@ -189,6 +193,9 @@
"Binary_digit_expected_1177": "Ожидался бит.",
"Binding_element_0_implicitly_has_an_1_type_7031": "Элемент привязки \"{0}\" имеет неявный тип \"{1}\".",
"Block_scoped_variable_0_used_before_its_declaration_2448": "Переменная \"{0}\" с областью видимости, ограниченной блоком, использована перед своим объявлением.",
+ "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Собрать все проекты, включая не требующие обновления",
+ "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Собрать один проект или несколько и их зависимости, если они не обновлены",
+ "Building_project_0_6358": "Сборка проекта \"{0}\"...",
"Call_decorator_expression_90028": "Вызовите выражение декоратора",
"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020": "Сигнатура вызова, у которой нет аннотации типа возвращаемого значения, неявно имеет тип возвращаемого значения any.",
"Call_target_does_not_contain_any_signatures_2346": "Объект вызова не содержит сигнатуры.",
@@ -208,8 +215,8 @@
"Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057": "Не удается найти файл tsconfig.json в указанном каталоге: \"{0}\".",
"Cannot_find_global_type_0_2318": "Не удается найти глобальный тип \"{0}\".",
"Cannot_find_global_value_0_2468": "Не удается найти глобальное значение \"{0}\".",
- "Cannot_find_lib_definition_for_0_2726": "Cannot find lib definition for '{0}'.",
- "Cannot_find_lib_definition_for_0_Did_you_mean_1_2727": "Cannot find lib definition for '{0}'. Did you mean '{1}'?",
+ "Cannot_find_lib_definition_for_0_2726": "Не удается найти определение lib для \"{0}\".",
+ "Cannot_find_lib_definition_for_0_Did_you_mean_1_2727": "Не удается найти определение lib для \"{0}\". Вы имели в виду \"{1}\"?",
"Cannot_find_module_0_2307": "Не удается найти модуль \"{0}\".",
"Cannot_find_name_0_2304": "Не удается найти имя \"{0}\".",
"Cannot_find_name_0_Did_you_mean_1_2552": "Не удается найти имя \"{0}\". Вы имели в виду \"{1}\"?",
@@ -304,6 +311,7 @@
"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Декораторы нельзя применять к множественным методам доступа get или set с совпадающим именем.",
"Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Экспорт модуля по умолчанию использует или имеет закрытое имя \"{0}\".",
"Delete_all_unused_declarations_95024": "Удалить все неиспользуемые объявления",
+ "Delete_the_outputs_of_all_projects_6365": "Удалить выходные данные всех проектов",
"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Устарело.] Используйте --jsxFactory. Укажите объект, вызываемый для createElement при целевом порождении JSX react",
"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Устарело.] Используйте --outFile. Сцепление и порождение выходных данных в одном файле",
"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Устарело.] Используйте --skipLibCheck. Пропуск проверки типов для файлов объявления библиотеки по умолчанию.",
@@ -354,6 +362,7 @@
"Enable_strict_checking_of_property_initialization_in_classes_6187": "Включение строгой проверки инициализации свойств в классах.",
"Enable_strict_null_checks_6113": "Включить строгие проверки NULL.",
"Enable_tracing_of_the_name_resolution_process_6085": "Включить трассировку процесса разрешения имен.",
+ "Enable_verbose_logging_6366": "Включить подробное ведение журнала",
"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037": "Позволяет обеспечивать взаимодействие между модулями CommonJS и ES посредством создания объектов пространства имен для всех импортов. Подразумевает \"allowSyntheticDefaultImports\".",
"Enables_experimental_support_for_ES7_async_functions_6068": "Включает экспериментальную поддержку для асинхронных функций ES7.",
"Enables_experimental_support_for_ES7_decorators_6065": "Включает экспериментальную поддержку для декораторов ES7.",
@@ -615,10 +624,12 @@
"Option_0_cannot_be_specified_without_specifying_option_1_5052": "Параметр \"{0}\" невозможно указать без указания параметра \"{1}\".",
"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "Параметр \"{0}\" нельзя указывать без указания параметра \"{1}\" или \"{2}\".",
"Option_0_should_have_array_of_strings_as_a_value_6103": "Параметр \"{0}\" должен иметь массив строк в качестве значения.",
+ "Option_build_must_be_the_first_command_line_argument_6369": "Параметр \"--build\" должен быть первым аргументом командной строки.",
"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "Параметр isolatedModules можно использовать, только если указан параметр --module или если параметр target — ES2015 или выше.",
"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "Параметр paths невозможно использовать без указания параметра \"--baseUrl\".",
"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042": "Параметр project не может быть указан вместе с исходными файлами в командной строке.",
"Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070": "Параметр \"--resolveJsonModule\" нельзя указать без стратегии разрешения модуля node.",
+ "Options_0_and_1_cannot_be_combined_6370": "Параметры \"{0}\" и \"{1}\" не могут использоваться одновременно.",
"Options_Colon_6027": "Параметры:",
"Output_directory_for_generated_declaration_files_6166": "Выходной каталог для создаваемых файлов объявления.",
"Output_file_0_from_project_1_does_not_exist_6309": "Выходной файл \"{0}\" из проекта \"{1}\" не существует",
@@ -666,7 +677,15 @@
"Print_names_of_generated_files_part_of_the_compilation_6154": "Печатать имена создаваемых файлов, входящих в компиляцию.",
"Print_the_compiler_s_version_6019": "Печать версии компилятора.",
"Print_this_message_6017": "Напечатайте это сообщение.",
+ "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Не удается собрать проект \"{0}\", так как его зависимость \"{1}\" содержит ошибки",
+ "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Проект \"{0}\" требует обновления, так как не обновлена его зависимость \"{1}\"",
+ "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Проект \"{0}\" требует обновления, так как самые старые выходные данные \"{1}\" старше самых новых входных данных \"{2}\"",
+ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Проект \"{0}\" требует обновления, так как выходного файла \"{1}\" не существует",
+ "Project_0_is_up_to_date_6361": "Проект \"{0}\" не требует обновления",
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Проект \"{0}\" не требует обновления, так как самые новые входные данные \"{1}\" старее самых старых выходных данных \"{2}\"",
+ "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Проект \"{0}\" не требует обновления с файлами .d.ts, взятыми из зависимостей проекта",
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Ссылки на проект не могут формировать циклический граф. Обнаружен цикл: {0}",
+ "Projects_in_this_build_Colon_0_6355": "Проекты в этой сборке: {0}",
"Projects_to_reference_6300": "Проекты для ссылки",
"Property_0_does_not_exist_on_const_enum_1_2479": "Свойство \"{0}\" не существует в перечислении const \"{1}\".",
"Property_0_does_not_exist_on_type_1_2339": "Свойство \"{0}\" не существует в типе \"{1}\".",
@@ -718,6 +737,7 @@
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "Указанный в ссылке проект \"{0}\" должен иметь следующее значение параметра composite: true.",
"Remove_all_unreachable_code_95051": "Удалить весь недостижимый код",
"Remove_all_unused_labels_95054": "Удалить все неиспользуемые метки",
+ "Remove_braces_from_arrow_function_95060": "Удалить скобки из стрелочной функции",
"Remove_declaration_for_Colon_0_90004": "Удалите объявление: \"{0}\"",
"Remove_destructuring_90009": "Удалить деструктурирование",
"Remove_import_from_0_90005": "Удалить импорт из \"{0}\"",
@@ -780,8 +800,11 @@
"Show_all_compiler_options_6169": "Отображение всех параметров компилятора.",
"Show_diagnostic_information_6149": "Отображение сведений диагностики.",
"Show_verbose_diagnostic_information_6150": "Отображение подробных сведений диагностики.",
+ "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Показать компоненты, которые будут собраны (или удалены, если дополнительно указан параметр \"--clean\")",
"Signature_0_must_be_a_type_predicate_1224": "Сигнатура \"{0}\" должна быть предикатом типа.",
"Skip_type_checking_of_declaration_files_6012": "Пропустить проверку типа файлов объявления.",
+ "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Сборка проекта \"{0}\" будет пропущена, так как его зависимость \"{1}\" содержит ошибки",
+ "Skipping_clean_because_not_all_projects_could_be_located_6371": "Очистка будет пропущена, так как не удалось найти некоторые проекты",
"Source_Map_Options_6175": "Параметры сопоставления источников",
"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382": "Специализированная сигнатура перегрузки не поддерживает назначение неспециализированной сигнатуре.",
"Specifier_of_dynamic_import_cannot_be_spread_element_1325": "Описатель динамического импорта не может быть элементом расширения.",
@@ -957,6 +980,7 @@
"Unterminated_template_literal_1160": "Незавершенный литерал шаблона.",
"Untyped_function_calls_may_not_accept_type_arguments_2347": "Вызовы функций без типов не могут принимать аргументы типов.",
"Unused_label_7028": "Неиспользуемая метка.",
+ "Updating_output_timestamps_of_project_0_6359": "Обновление меток времени в выходных данных проекта \"{0}\"...",
"Use_synthetic_default_member_95016": "Используйте искусственный элемент \"default\".",
"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "Использование строки для оператора for...of поддерживается только в ECMAScript 5 и более поздних версиях.",
"VERSION_6036": "ВЕРСИЯ",
@@ -1017,6 +1041,7 @@
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "Инициализатор элементов перечисления const был вычислен в запрещенное значение NaN.",
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "Перечисления const можно использовать только в выражениях доступа к свойству или индексу, а также в правой части объявления импорта, присваивания экспорта или запроса типа.",
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "Невозможно вызвать оператор delete с идентификатором в строгом режиме.",
+ "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "удалить это — проект \"{0}\" не требует обновления, так как был собран ранее",
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "Объявления перечислений можно использовать только в TS-файле.",
"export_can_only_be_used_in_a_ts_file_8003": "Элемент \"export=\" может использоваться только в TS-файле.",
"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668": "Модификатор export невозможно применить к неоднозначным модулям и улучшениям модулей, так как они всегда видимые.",
diff --git a/lib/tr/diagnosticMessages.generated.json b/lib/tr/diagnosticMessages.generated.json
index 940c3dfc67..cbfdb9d002 100644
--- a/lib/tr/diagnosticMessages.generated.json
+++ b/lib/tr/diagnosticMessages.generated.json
@@ -49,8 +49,8 @@
"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Bir ad alanı bildirimi, birleştirildiği sınıf veya işlevden önce gelemez.",
"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235": "Ad alanı bildirimine yalnızca bir ad alanında veya modülde izin verilir.",
"A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038": "Bir ad alanı stili içeri aktarma işlemi çağrılamadığından veya oluşturulamadığından çalışma zamanında hataya yol açacak.",
- "A_non_dry_build_would_build_project_0_6357": "A non-dry build would build project '{0}'",
- "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "A non-dry build would delete the following files: {0}",
+ "A_non_dry_build_would_build_project_0_6357": "DRY dışı bir derleme '{0}' projesini derler",
+ "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "DRY dışı bir derleme şu dosyaları siler: {0}",
"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "Parametre başlatıcısına yalnızca bir işlevde veya oluşturucu uygulamasında izin verilir.",
"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "Parametre özelliği, rest parametresi kullanılarak bildirilemez.",
"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "Parametre özelliğine yalnızca bir oluşturucu uygulamasında izin verilir.",
@@ -102,6 +102,7 @@
"Add_all_missing_members_95022": "Tüm eksik üyeleri ekle",
"Add_all_missing_super_calls_95039": "Tüm eksik süper çağrıları ekle",
"Add_async_modifier_to_containing_function_90029": "İçeren işleve zaman uyumsuz değiştirici ekle",
+ "Add_braces_to_arrow_function_95059": "Ok işlevine küme ayracı ekleyin",
"Add_definite_assignment_assertion_to_property_0_95020": "'{0}' özelliğine belirli atama onayı ekle",
"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028": "Tüm başlatılmamış özelliklere kesin atama onayları ekle",
"Add_index_signature_for_property_0_90017": "'{0}' özelliği için dizin imzası ekle",
@@ -109,6 +110,7 @@
"Add_initializers_to_all_uninitialized_properties_95027": "Tüm başlatılmamış özelliklere başlatıcılar ekle",
"Add_missing_super_call_90001": "Eksik 'super()' çağrısını ekle",
"Add_missing_typeof_95052": "Eksik 'typeof' öğesini ekle",
+ "Add_or_remove_braces_in_an_arrow_function_95058": "Ok işlevine küme ayracı ekleyin veya kaldırın",
"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037": "Bir üye adıyla eşleşen tüm çözülmemiş değişkenlere niteleyici ekle",
"Add_to_all_uncalled_decorators_95044": "Çağrılmayan tüm dekoratörlere '()' ekle",
"Add_ts_ignore_to_all_error_messages_95042": "Tüm hata iletilerine '@ts-ignore' ekle",
@@ -191,9 +193,9 @@
"Binary_digit_expected_1177": "İkili sayı bekleniyor.",
"Binding_element_0_implicitly_has_an_1_type_7031": "'{0}' bağlama öğesi, örtük olarak '{1}' türü içeriyor.",
"Block_scoped_variable_0_used_before_its_declaration_2448": "Blok kapsamlı değişken '{0}', bildirilmeden önce kullanıldı.",
- "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Build all projects, including those that appear to be up to date",
- "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Build one or more projects and their dependencies, if out of date",
- "Building_project_0_6358": "Building project '{0}'...",
+ "Build_all_projects_including_those_that_appear_to_be_up_to_date_6368": "Güncel görünenler de dahil olmak üzere tüm projeleri derleyin",
+ "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364": "Eskiyse, bir veya daha fazla projeyi ve bağımlılıklarını derleyin",
+ "Building_project_0_6358": "'{0}' projesi derleniyor...",
"Call_decorator_expression_90028": "Dekoratör ifadesini çağır",
"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020": "Dönüş türü ek açıklaması bulunmayan çağrı imzası, örtük olarak 'any' dönüş türüne sahip.",
"Call_target_does_not_contain_any_signatures_2346": "Çağrı hedefi imza içermiyor.",
@@ -309,7 +311,7 @@
"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207": "Dekoratörler aynı ada sahip birden fazla get/set erişimcisine uygulanamaz.",
"Default_export_of_the_module_has_or_is_using_private_name_0_4082": "Modülün varsayılan dışarı aktarımı '{0}' özel adına sahip veya bu adı kullanıyor.",
"Delete_all_unused_declarations_95024": "Kullanılmayan tüm bildirimleri sil",
- "Delete_the_outputs_of_all_projects_6365": "Delete the outputs of all projects",
+ "Delete_the_outputs_of_all_projects_6365": "Tüm projelerin çıkışlarını silin",
"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084": "[Kullanım Dışı] Bunun yerine '--jsxFactory' kullanın. 'react' JSX gösterimi hedefleniyorsa, createElement için çağrılan nesneyi belirtin",
"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170": "[Kullanım Dışı] Bunun yerine '--outFile' kullanın. Çıkışı tek bir dosya olarak birleştirin ve gösterin",
"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160": "[Kullanım Dışı] Bunun yerine '--skipLibCheck' kullanın. Varsayılan kitaplık bildirim dosyalarının tür denetimini atlayın.",
@@ -360,7 +362,7 @@
"Enable_strict_checking_of_property_initialization_in_classes_6187": "Sınıflarda sıkı özellik başlatma denetimini etkinleştirin.",
"Enable_strict_null_checks_6113": "Katı null denetimlerini etkinleştir.",
"Enable_tracing_of_the_name_resolution_process_6085": "Ad çözümleme işlemini izlemeyi etkinleştir.",
- "Enable_verbose_logging_6366": "Enable verbose logging",
+ "Enable_verbose_logging_6366": "Ayrıntılı günlüğe yazmayı etkinleştirin",
"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037": "Tüm içeri aktarma işlemleri için ad alanı nesnelerinin oluşturulması aracılığıyla CommonJS ile ES Modülleri arasında yayımlama birlikte çalışabilirliğine imkan tanır. Şu anlama gelir: 'allowSyntheticDefaultImports'.",
"Enables_experimental_support_for_ES7_async_functions_6068": "Zaman uyumsuz ES7 işlevleri için deneysel desteği etkinleştirir.",
"Enables_experimental_support_for_ES7_decorators_6065": "ES7 dekoratörleri için deneysel desteği etkinleştirir.",
@@ -622,12 +624,12 @@
"Option_0_cannot_be_specified_without_specifying_option_1_5052": "'{0}' seçeneği, '{1}' seçeneği belirtilmeden belirtilemez.",
"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069": "'{1}' seçeneği veya '{2}' seçeneği belirtilmeden '{0}' seçeneği belirtilemez.",
"Option_0_should_have_array_of_strings_as_a_value_6103": "'{0}' seçeneği değer olarak, dizelerden oluşan bir dizi içermelidir.",
- "Option_build_must_be_the_first_command_line_argument_6369": "Option '--build' must be the first command line argument.",
+ "Option_build_must_be_the_first_command_line_argument_6369": "'--build' seçeneği ilk komut satırı bağımsız değişkeni olmalıdır.",
"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047": "'isolatedModules' seçeneği, yalnızca '--module' sağlandığında veya 'target' seçeneği 'ES2015' veya daha yüksek bir sürüm değerine sahip olduğunda kullanılabilir.",
"Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060": "'Paths' seçeneği, '--baseUrl' seçeneği belirtilmeden kullanılamaz.",
"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042": "'project' seçeneği, komut satırındaki kaynak dosyalarıyla karıştırılamaz.",
"Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070": "'node' modül çözümleme stratejisi olmadan '--resolveJsonModule' seçeneği belirtilemez.",
- "Options_0_and_1_cannot_be_combined_6370": "Options '{0}' and '{1}' cannot be combined.",
+ "Options_0_and_1_cannot_be_combined_6370": "'{0}' ve '{1}' seçenekleri birleştirilemez.",
"Options_Colon_6027": "Seçenekler:",
"Output_directory_for_generated_declaration_files_6166": "Oluşturulan bildirim dosyaları için çıkış dizini.",
"Output_file_0_from_project_1_does_not_exist_6309": "'{1}' projesinden '{0}' çıkış dosyası yok",
@@ -675,15 +677,15 @@
"Print_names_of_generated_files_part_of_the_compilation_6154": "Oluşturulan dosyalardan, derlemenin parçası olanların adlarını yazdırın.",
"Print_the_compiler_s_version_6019": "Derleyici sürümünü yazdır.",
"Print_this_message_6017": "Bu iletiyi yazdır.",
- "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "Project '{0}' can't be built because its dependency '{1}' has errors",
- "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "Project '{0}' is out of date because its dependency '{1}' is out of date",
- "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'",
- "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Project '{0}' is out of date because output file '{1}' does not exist",
- "Project_0_is_up_to_date_6361": "Project '{0}' is up to date",
- "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'",
- "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "Project '{0}' is up to date with .d.ts files from its dependencies",
+ "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "'{0}' projesinin '{1}' bağımlılığında hatalar olduğundan proje derlenemiyor",
+ "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "'{0}' projesinin '{1}' bağımlılığı güncel olmadığından proje güncel değil",
+ "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "En eski '{1}' çıkışı en yeni '{2}' girişinden daha eski olduğundan '{0}' projesi güncel değil",
+ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Çıkış dosyası '{1}' mevcut olmadığından '{0}' projesi güncel değil",
+ "Project_0_is_up_to_date_6361": "'{0}' projesi güncel",
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "En yeni '{1}' girişi en eski '{2}' çıkışından daha eski olduğundan '{0}' projesi güncel",
+ "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "'{0}' projesi bağımlılıklarından d.ts dosyaları ile güncel",
"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Proje başvuruları döngüsel bir grafik formu oluşturamaz. Döngü tespit edildi: {0}",
- "Projects_in_this_build_Colon_0_6355": "Projects in this build: {0}",
+ "Projects_in_this_build_Colon_0_6355": "Bu derlemedeki projeler: {0}",
"Projects_to_reference_6300": "Başvurulacak projeler",
"Property_0_does_not_exist_on_const_enum_1_2479": "'{0}' özelliği, '{1}' 'const' sabit listesi üzerinde değil.",
"Property_0_does_not_exist_on_type_1_2339": "'{0}' özelliği, '{1}' türünde değil.",
@@ -735,6 +737,7 @@
"Referenced_project_0_must_have_setting_composite_Colon_true_6306": "Başvurulan proje '{0}' \"composite\": true ayarına sahip olmalıdır.",
"Remove_all_unreachable_code_95051": "Tüm erişilemeyen kodları kaldır",
"Remove_all_unused_labels_95054": "Kullanılmayan tüm etiketleri kaldır",
+ "Remove_braces_from_arrow_function_95060": "Ok işlevinden köşeli ayraçları kaldırın",
"Remove_declaration_for_Colon_0_90004": "'{0}' bildirimini kaldır",
"Remove_destructuring_90009": "Yıkmayı kaldır",
"Remove_import_from_0_90005": "'{0}' öğesinden içeri aktarmayı kaldır",
@@ -797,11 +800,11 @@
"Show_all_compiler_options_6169": "Tüm derleyici seçeneklerini gösterin.",
"Show_diagnostic_information_6149": "Tanılama bilgilerini gösterin.",
"Show_verbose_diagnostic_information_6150": "Ayrıntılı tanılama bilgilerini gösterin.",
- "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Show what would be built (or deleted, if specified with '--clean')",
+ "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367": "Nelerin derleneceğini (veya '--clean' ile belirtilmişse silineceğini) göster",
"Signature_0_must_be_a_type_predicate_1224": "'{0}' imzası bir tür koşulu olmalıdır.",
"Skip_type_checking_of_declaration_files_6012": "Bildirim dosyalarının tür denetimini atla.",
- "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "Skipping build of project '{0}' because its dependency '{1}' has errors",
- "Skipping_clean_because_not_all_projects_could_be_located_6371": "Skipping clean because not all projects could be located",
+ "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362": "'{0}' projesinin '{1}' bağımlılığında hatalar olduğundan projenin derlenmesi atlanıyor",
+ "Skipping_clean_because_not_all_projects_could_be_located_6371": "Tüm projeler bulunamadığından temizleme atlanıyor",
"Source_Map_Options_6175": "Kaynak Eşleme Seçenekleri",
"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382": "Özelleşmiş aşırı yükleme imzası özelleşmemiş imzalara atanamaz.",
"Specifier_of_dynamic_import_cannot_be_spread_element_1325": "Dinamik içeri aktarmanın tanımlayıcısı, yayılma öğesi olamaz.",
@@ -977,7 +980,7 @@
"Unterminated_template_literal_1160": "Sonlandırılmamış şablon sabit değeri.",
"Untyped_function_calls_may_not_accept_type_arguments_2347": "Türü belirtilmemiş işlev çağrıları tür bağımsız değişkenlerini kabul etmeyebilir.",
"Unused_label_7028": "Kullanılmayan etiket.",
- "Updating_output_timestamps_of_project_0_6359": "Updating output timestamps of project '{0}'...",
+ "Updating_output_timestamps_of_project_0_6359": "'{0}' projesinin çıkış zaman damgaları güncelleştiriliyor...",
"Use_synthetic_default_member_95016": "Yapay 'default' üyesini kullanın.",
"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "'for...of' deyiminde dize kullanma yalnızca ECMAScript 5 veya üzerinde desteklenir.",
"VERSION_6036": "SÜRÜM",
@@ -1038,7 +1041,7 @@
"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "'const' sabit listesi üyesi başlatıcısı, izin verilmeyen 'NaN' değeri olarak hesaplandı.",
"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "'const' sabit listeleri yalnızca bir özellikte, dizin erişim ifadelerinde, içeri aktarma bildiriminin veya dışarı aktarma atamasının sağ tarafında ya da tür sorgusunda kullanılabilir.",
"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102": "'delete', katı moddaki bir tanımlayıcıda çağrılamaz.",
- "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "delete this - Project '{0}' is up to date because it was previously built",
+ "delete_this_Project_0_is_up_to_date_because_it_was_previously_built_6360": "bunu silin - '{0}' projesi önceden derlenmiş olduğundan güncel",
"enum_declarations_can_only_be_used_in_a_ts_file_8015": "'enum declarations' yalnızca bir .ts dosyasında kullanılabilir.",
"export_can_only_be_used_in_a_ts_file_8003": "'export=' yalnızca bir .ts dosyasında kullanılabilir.",
"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668": "'export' değiştiricisi, her zaman görünür olduğu için çevresel modüllere ve modül genişletmelerine uygulanamaz.",
diff --git a/lib/tsc.js b/lib/tsc.js
index 81404fac6f..5ee4b284ad 100644
--- a/lib/tsc.js
+++ b/lib/tsc.js
@@ -3568,7 +3568,7 @@ var ts;
Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0: diag(7035, ts.DiagnosticCategory.Error, "Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_mod_7035", "Try `npm install @types/{0}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`"),
Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0: diag(7036, ts.DiagnosticCategory.Error, "Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036", "Dynamic import's specifier must be of type 'string', but here has type '{0}'."),
Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports: diag(7037, ts.DiagnosticCategory.Message, "Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037", "Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'."),
- A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime: diag(7038, ts.DiagnosticCategory.Error, "A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038", "A namespace-style import cannot be called or constructed, and will cause a failure at runtime."),
+ 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: diag(7038, ts.DiagnosticCategory.Error, "Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cau_7038", "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."),
Mapped_object_type_implicitly_has_an_any_template_type: diag(7039, ts.DiagnosticCategory.Error, "Mapped_object_type_implicitly_has_an_any_template_type_7039", "Mapped object type implicitly has an 'any' template type."),
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
@@ -5765,7 +5765,7 @@ var ts;
if (includeJsDoc && ts.hasJSDocNodes(node)) {
return getTokenPosOfNode(node.jsDoc[0]);
}
- if (node.kind === 299 && node._children.length > 0) {
+ if (node.kind === 300 && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -5949,7 +5949,7 @@ var ts;
case 205:
case 236:
case 237:
- case 296:
+ case 297:
case 234:
case 154:
case 155:
@@ -5958,7 +5958,7 @@ var ts;
case 192:
case 193:
case 292:
- case 297:
+ case 298:
case 288:
return true;
default:
@@ -6052,7 +6052,7 @@ var ts;
return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3);
}
ts.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile;
- function createDiagnosticForNodeFromMessageChain(node, messageChain) {
+ function createDiagnosticForNodeFromMessageChain(node, messageChain, relatedInformation) {
var sourceFile = getSourceFileOfNode(node);
var span = getErrorSpanForNode(sourceFile, node);
return {
@@ -6061,7 +6061,8 @@ var ts;
length: span.length,
code: messageChain.code,
category: messageChain.category,
- messageText: messageChain.next ? messageChain : messageChain.messageText
+ messageText: messageChain.next ? messageChain : messageChain.messageText,
+ relatedInformation: relatedInformation
};
}
ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;
@@ -6894,6 +6895,11 @@ var ts;
return node.initializer;
}
ts.getEffectiveInitializer = getEffectiveInitializer;
+ function getDeclaredJavascriptInitializer(node) {
+ var init = getEffectiveInitializer(node);
+ return init && getJavascriptInitializer(init, isPrototypeAccess(node.name));
+ }
+ ts.getDeclaredJavascriptInitializer = getDeclaredJavascriptInitializer;
function getAssignedJavascriptInitializer(node) {
if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 58) {
var isPrototypeAssignment = isPrototypeAccess(node.parent.left);
@@ -7102,7 +7108,7 @@ var ts;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 297 || node.kind === 292;
+ return node.kind === 298 || node.kind === 292;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -7169,7 +7175,12 @@ var ts;
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 58 ||
ts.isBinaryExpression(parent) && parent.operatorToken.kind === 58 ||
node.kind === 185 && node.parent && node.parent.kind === 216) {
- getJSDocCommentsAndTagsWorker(parent);
+ if (ts.isBinaryExpression(parent)) {
+ getJSDocCommentsAndTagsWorker(parent.parent);
+ }
+ else {
+ getJSDocCommentsAndTagsWorker(parent);
+ }
}
if (node.kind === 149) {
result = ts.addRange(result, ts.getJSDocParameterTags(node));
@@ -7701,7 +7712,7 @@ var ts;
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 302:
+ case 303:
return 0;
case 204:
return 1;
@@ -7999,8 +8010,8 @@ var ts;
decreaseIndent: function () { indent--; },
getIndent: function () { return indent; },
getTextPos: function () { return output.length; },
- getLine: function () { return lineCount + 1; },
- getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; },
+ getLine: function () { return lineCount; },
+ getColumn: function () { return lineStart ? indent * getIndentSize() : output.length - linePos; },
getText: function () { return output; },
isAtStartOfLine: function () { return lineStart; },
clear: reset,
@@ -8997,6 +9008,8 @@ var ts;
switch (options.target) {
case 6:
return "lib.esnext.full.d.ts";
+ case 5:
+ return "lib.es2018.full.d.ts";
case 4:
return "lib.es2017.full.d.ts";
case 3:
@@ -9340,7 +9353,7 @@ var ts;
break;
case 71:
return declaration;
- case 298:
+ case 299:
case 293: {
var name = declaration.name;
if (name.kind === 146) {
@@ -9362,7 +9375,7 @@ var ts;
}
case 292:
return declaration.name;
- case 297:
+ case 298:
return getNameOfJSDocTypedef(declaration);
case 249: {
var expression = declaration.expression;
@@ -9418,6 +9431,10 @@ var ts;
return getFirstJSDocTag(node, ts.isJSDocClassTag);
}
ts.getJSDocClassTag = getJSDocClassTag;
+ function getJSDocThisTag(node) {
+ return getFirstJSDocTag(node, ts.isJSDocThisTag);
+ }
+ ts.getJSDocThisTag = getJSDocThisTag;
function getJSDocReturnTag(node) {
return getFirstJSDocTag(node, ts.isJSDocReturnTag);
}
@@ -9691,7 +9708,7 @@ var ts;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 301) {
+ while (node.kind === 302) {
node = node.expression;
}
return node;
@@ -10085,6 +10102,10 @@ var ts;
return node.kind === 291;
}
ts.isJSDocClassTag = isJSDocClassTag;
+ function isJSDocThisTag(node) {
+ return node.kind === 295;
+ }
+ ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
return node.kind === 293;
}
@@ -10094,23 +10115,23 @@ var ts;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 295;
+ return node.kind === 296;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 296;
+ return node.kind === 297;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 297;
+ return node.kind === 298;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 298;
+ return node.kind === 299;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 298 || node.kind === 293;
+ return node.kind === 299 || node.kind === 293;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
@@ -10128,7 +10149,7 @@ var ts;
})(ts || (ts = {}));
(function (ts) {
function isSyntaxList(n) {
- return n.kind === 299;
+ return n.kind === 300;
}
ts.isSyntaxList = isSyntaxList;
function isNode(node) {
@@ -10531,8 +10552,8 @@ var ts;
case 204:
case 208:
case 206:
+ case 303:
case 302:
- case 301:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -10545,11 +10566,11 @@ var ts;
}
ts.isAssertionExpression = isAssertionExpression;
function isPartiallyEmittedExpression(node) {
- return node.kind === 301;
+ return node.kind === 302;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
function isNotEmittedStatement(node) {
- return node.kind === 300;
+ return node.kind === 301;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
function isNotEmittedOrPartiallyEmittedNode(node) {
@@ -10649,9 +10670,9 @@ var ts;
|| kind === 237
|| kind === 148
|| kind === 232
- || kind === 297
+ || kind === 298
|| kind === 292
- || kind === 298;
+ || kind === 299;
}
function isDeclarationStatementKind(kind) {
return kind === 234
@@ -10686,13 +10707,13 @@ var ts;
|| kind === 214
|| kind === 219
|| kind === 226
- || kind === 300
- || kind === 304
- || kind === 303;
+ || kind === 301
+ || kind === 305
+ || kind === 304;
}
function isDeclaration(node) {
if (node.kind === 148) {
- return node.parent.kind !== 296 || ts.isInJavaScriptFile(node);
+ return node.parent.kind !== 297 || ts.isInJavaScriptFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -10770,7 +10791,7 @@ var ts;
}
ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
function isJSDocNode(node) {
- return node.kind >= 278 && node.kind <= 298;
+ return node.kind >= 278 && node.kind <= 299;
}
ts.isJSDocNode = isJSDocNode;
function isJSDocCommentContainingNode(node) {
@@ -10778,7 +10799,7 @@ var ts;
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
function isJSDocTag(node) {
- return node.kind >= 289 && node.kind <= 298;
+ return node.kind >= 289 && node.kind <= 299;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
@@ -11868,7 +11889,7 @@ var ts;
}
ts.isAnySupportedFileExtension = isAnySupportedFileExtension;
function tryGetExtensionFromPath(path) {
- return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (e) { return ts.fileExtensionIs(path, e); }) || ts.find(ts.supportedJavascriptExtensions, function (e) { return ts.fileExtensionIs(path, e); });
+ return ts.find(extensionsToRemove, function (e) { return ts.fileExtensionIs(path, e); });
}
ts.tryGetExtensionFromPath = tryGetExtensionFromPath;
function getAnyExtensionFromPathWorker(path, extensions, stringEqualityComparer) {
@@ -12314,7 +12335,7 @@ var ts;
return visitNode(cbNode, node.expression);
case 253:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 302:
+ case 303:
return visitNodes(cbNode, cbNodes, node.elements);
case 255:
return visitNode(cbNode, node.openingElement) ||
@@ -12357,7 +12378,7 @@ var ts;
case 286:
return visitNodes(cbNode, cbNodes, node.tags);
case 293:
- case 298:
+ case 299:
if (node.isNameFirst) {
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression);
@@ -12368,13 +12389,13 @@ var ts;
}
case 294:
return visitNode(cbNode, node.typeExpression);
- case 295:
+ case 296:
return visitNode(cbNode, node.typeExpression);
case 290:
return visitNode(cbNode, node.class);
- case 296:
- return visitNodes(cbNode, cbNodes, node.typeParameters);
case 297:
+ return visitNodes(cbNode, cbNodes, node.typeParameters);
+ case 298:
if (node.typeExpression &&
node.typeExpression.kind === 278) {
return visitNode(cbNode, node.typeExpression) ||
@@ -12387,6 +12408,8 @@ var ts;
case 292:
return visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
+ case 295:
+ return visitNode(cbNode, node.typeExpression);
case 288:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
@@ -12401,7 +12424,7 @@ var ts;
}
}
return;
- case 301:
+ case 302:
return visitNode(cbNode, node.expression);
}
}
@@ -16612,6 +16635,9 @@ var ts;
case "constructor":
tag = parseClassTag(atToken, tagName);
break;
+ case "this":
+ tag = parseThisTag(atToken, tagName);
+ break;
case "arg":
case "argument":
case "param":
@@ -16753,7 +16779,7 @@ var ts;
typeExpression = tryParseTypeExpression();
}
var result = target === 1 ?
- createNode(298, atToken.pos) :
+ createNode(299, atToken.pos) :
createNode(293, atToken.pos);
var comment;
if (indent !== undefined)
@@ -16780,7 +16806,7 @@ var ts;
var start_2 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, name); })) {
- if (child.kind === 293 || child.kind === 298) {
+ if (child.kind === 293 || child.kind === 299) {
children = ts.append(children, child);
}
}
@@ -16806,10 +16832,10 @@ var ts;
return finishNode(result);
}
function parseTypeTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 295; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 296; })) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(295, atToken.pos);
+ var result = createNode(296, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(true);
@@ -16849,10 +16875,18 @@ var ts;
tag.tagName = tagName;
return finishNode(tag);
}
+ function parseThisTag(atToken, tagName) {
+ var tag = createNode(295, atToken.pos);
+ tag.atToken = atToken;
+ tag.tagName = tagName;
+ tag.typeExpression = parseJSDocTypeExpression(true);
+ skipWhitespace();
+ return finishNode(tag);
+ }
function parseTypedefTag(atToken, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespace();
- var typedefTag = createNode(297, atToken.pos);
+ var typedefTag = createNode(298, atToken.pos);
typedefTag.atToken = atToken;
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
@@ -16870,7 +16904,7 @@ var ts;
if (!jsdocTypeLiteral) {
jsdocTypeLiteral = createNode(287, start_3);
}
- if (child.kind === 295) {
+ if (child.kind === 296) {
if (childTypeTag) {
break;
}
@@ -17052,7 +17086,7 @@ var ts;
if (constraint) {
ts.first(typeParameters).constraint = constraint.type;
}
- var result = createNode(296, atToken.pos);
+ var result = createNode(297, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
@@ -18042,7 +18076,6 @@ var ts;
{
name: "sourceRoot",
type: "string",
- isFilePath: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
@@ -18050,7 +18083,6 @@ var ts;
{
name: "mapRoot",
type: "string",
- isFilePath: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -21003,7 +21035,7 @@ var ts;
case 187:
bindCallExpressionFlow(node);
break;
- case 297:
+ case 298:
case 292:
bindJSDocTypeAlias(node);
break;
@@ -21699,7 +21731,7 @@ var ts;
case 192:
case 193:
case 284:
- case 297:
+ case 298:
case 292:
case 237:
case 177:
@@ -22215,13 +22247,13 @@ var ts;
if (node.parent.kind !== 287) {
break;
}
- case 298:
+ case 299:
var propTag = node;
var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 283 ?
4 | 16777216 :
4;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0);
- case 297:
+ case 298:
case 292:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
@@ -22294,15 +22326,19 @@ var ts;
}
}
function setCommonJsModuleIndicator(node) {
+ if (file.externalModuleIndicator) {
+ return false;
+ }
if (!file.commonJsModuleIndicator) {
file.commonJsModuleIndicator = node;
- if (!file.externalModuleIndicator) {
- bindSourceFileAsExternalModule();
- }
+ bindSourceFileAsExternalModule();
}
+ return true;
}
function bindExportsPropertyAssignment(node) {
- setCommonJsModuleIndicator(node);
+ if (!setCommonJsModuleIndicator(node)) {
+ return;
+ }
var lhs = node.left;
var symbol = forEachIdentifierInEntityName(lhs.expression, undefined, function (id, symbol) {
if (symbol) {
@@ -22318,12 +22354,13 @@ var ts;
}
}
function bindModuleExportsAssignment(node) {
- var assignedExpression = ts.getRightMostAssignedExpression(node.right);
- if (ts.isEmptyObjectLiteral(assignedExpression) || container === file && isExportsOrModuleExportsOrAlias(file, assignedExpression)) {
- setCommonJsModuleIndicator(node);
+ if (!setCommonJsModuleIndicator(node)) {
+ return;
+ }
+ var assignedExpression = ts.getRightMostAssignedExpression(node.right);
+ if (ts.isEmptyObjectLiteral(assignedExpression) || container === file && isExportsOrModuleExportsOrAlias(file, assignedExpression)) {
return;
}
- setCommonJsModuleIndicator(node);
var flags = ts.exportAssignmentIsAlias(node)
? 2097152
: 4 | 1048576 | 512;
@@ -22445,6 +22482,7 @@ var ts;
ts.isBinaryExpression(node) ? node.right :
ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) ? node.parent.right :
undefined;
+ init = init && ts.getRightMostAssignedExpression(init);
if (init) {
var isPrototypeAssignment = ts.isPrototypeAccess(ts.isVariableDeclaration(node) ? node.name : ts.isBinaryExpression(node) ? node.left : node);
return !!ts.getJavascriptInitializer(ts.isBinaryExpression(init) && init.operatorToken.kind === 54 ? init.right : init, isPrototypeAssignment);
@@ -23114,7 +23152,7 @@ var ts;
break;
case 190:
case 208:
- case 301:
+ case 302:
transformFlags |= 3;
excludeFlags = 536872257;
break;
@@ -23349,7 +23387,7 @@ var ts;
return 940049729;
case 190:
case 208:
- case 301:
+ case 302:
case 191:
case 97:
return 536872257;
@@ -24161,6 +24199,7 @@ var ts;
? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3)
: ts.createCompilerDiagnostic(message, arg0, arg1, arg2, arg3);
diagnostics.add(diagnostic);
+ return diagnostic;
}
function addErrorOrSuggestion(isError, diagnostic) {
if (isError) {
@@ -24632,7 +24671,7 @@ var ts;
location = location.parent;
}
break;
- case 297:
+ case 298:
case 292:
location = ts.getJSDocHost(location);
break;
@@ -26778,7 +26817,7 @@ var ts;
}
else {
var contextFile = ts.getSourceFileOfNode(ts.getOriginalNode(context.enclosingDeclaration));
- return "\"" + (file.moduleName || ts.moduleSpecifiers.getModuleSpecifier(compilerOptions, contextFile, contextFile.path, file.path, context.tracker.moduleResolverHost)) + "\"";
+ return "\"" + (file.moduleName || ts.moduleSpecifiers.getModuleSpecifiers(symbol, compilerOptions, contextFile, context.tracker.moduleResolverHost, context.tracker.moduleResolverHost.getSourceFiles(), { importModuleSpecifierPreference: "non-relative" })[0]) + "\"";
}
}
var declaration = symbol.declarations[0];
@@ -26823,7 +26862,7 @@ var ts;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
case 292:
- case 297:
+ case 298:
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
case 182:
return isDeclarationVisible(node.parent.parent);
@@ -27397,7 +27436,9 @@ var ts;
: getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
}
function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) {
- var type = getTypeForVariableLikeDeclaration(declaration, true);
+ return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, true), declaration, reportErrors);
+ }
+ function widenTypeForVariableLikeDeclaration(type, declaration, reportErrors) {
if (type) {
if (reportErrors) {
reportErrorsFromWidening(declaration, type);
@@ -27446,50 +27487,45 @@ var ts;
if (declaration.kind === 249) {
return links.type = checkExpression(declaration.expression);
}
- if (ts.isInJavaScriptFile(declaration) && ts.isJSDocPropertyLikeTag(declaration) && declaration.typeExpression) {
- return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
- }
if (!pushTypeResolution(symbol, 0)) {
return errorType;
}
- var type = void 0;
- if (declaration.kind === 200 ||
- declaration.kind === 185 && declaration.parent.kind === 200) {
- type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol);
- }
- else if (ts.isJSDocPropertyLikeTag(declaration)
- || ts.isPropertyAccessExpression(declaration)
- || ts.isIdentifier(declaration)
- || ts.isClassDeclaration(declaration)
- || ts.isFunctionDeclaration(declaration)
- || (ts.isMethodDeclaration(declaration) && !ts.isObjectLiteralMethod(declaration))
- || ts.isMethodSignature(declaration)) {
- if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) {
- return getTypeOfFuncClassEnumModule(symbol);
+ var type = getJSSpecialType(symbol, declaration);
+ if (!type) {
+ if (ts.isJSDocPropertyLikeTag(declaration)
+ || ts.isPropertyAccessExpression(declaration)
+ || ts.isIdentifier(declaration)
+ || ts.isClassDeclaration(declaration)
+ || ts.isFunctionDeclaration(declaration)
+ || (ts.isMethodDeclaration(declaration) && !ts.isObjectLiteralMethod(declaration))
+ || ts.isMethodSignature(declaration)) {
+ if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) {
+ return getTypeOfFuncClassEnumModule(symbol);
+ }
+ type = tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
+ }
+ else if (ts.isPropertyAssignment(declaration)) {
+ type = tryGetTypeFromEffectiveTypeNode(declaration) || checkPropertyAssignment(declaration);
+ }
+ else if (ts.isJsxAttribute(declaration)) {
+ type = tryGetTypeFromEffectiveTypeNode(declaration) || checkJsxAttribute(declaration);
+ }
+ else if (ts.isShorthandPropertyAssignment(declaration)) {
+ type = tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionForMutableLocation(declaration.name, 0);
+ }
+ else if (ts.isObjectLiteralMethod(declaration)) {
+ type = tryGetTypeFromEffectiveTypeNode(declaration) || checkObjectLiteralMethod(declaration, 0);
+ }
+ else if (ts.isParameter(declaration)
+ || ts.isPropertyDeclaration(declaration)
+ || ts.isPropertySignature(declaration)
+ || ts.isVariableDeclaration(declaration)
+ || ts.isBindingElement(declaration)) {
+ type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
+ }
+ else {
+ return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.showSyntaxKind(declaration) + " for " + ts.Debug.showSymbol(symbol));
}
- type = tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
- }
- else if (ts.isPropertyAssignment(declaration)) {
- type = tryGetTypeFromEffectiveTypeNode(declaration) || checkPropertyAssignment(declaration);
- }
- else if (ts.isJsxAttribute(declaration)) {
- type = tryGetTypeFromEffectiveTypeNode(declaration) || checkJsxAttribute(declaration);
- }
- else if (ts.isShorthandPropertyAssignment(declaration)) {
- type = tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionForMutableLocation(declaration.name, 0);
- }
- else if (ts.isObjectLiteralMethod(declaration)) {
- type = tryGetTypeFromEffectiveTypeNode(declaration) || checkObjectLiteralMethod(declaration, 0);
- }
- else if (ts.isParameter(declaration)
- || ts.isPropertyDeclaration(declaration)
- || ts.isPropertySignature(declaration)
- || ts.isVariableDeclaration(declaration)
- || ts.isBindingElement(declaration)) {
- type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
- }
- else {
- return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.showSyntaxKind(declaration) + " for " + ts.Debug.showSymbol(symbol));
}
if (!popTypeResolution()) {
type = reportCircularityError(symbol);
@@ -27498,6 +27534,48 @@ var ts;
}
return links.type;
}
+ function getJSSpecialType(symbol, decl) {
+ if (!ts.isInJavaScriptFile(decl)) {
+ return undefined;
+ }
+ else if (ts.isJSDocPropertyLikeTag(decl) && decl.typeExpression) {
+ return getTypeFromTypeNode(decl.typeExpression.type);
+ }
+ else if (ts.isBinaryExpression(decl) ||
+ ts.isPropertyAccessExpression(decl) && ts.isBinaryExpression(decl.parent)) {
+ return getJSInitializerType(decl, symbol, ts.getAssignedJavascriptInitializer(ts.isBinaryExpression(decl) ? decl.left : decl)) ||
+ getWidenedTypeFromJSSpecialPropertyDeclarations(symbol);
+ }
+ else if (ts.isParameter(decl)
+ || ts.isPropertyDeclaration(decl)
+ || ts.isPropertySignature(decl)
+ || ts.isVariableDeclaration(decl)
+ || ts.isBindingElement(decl)) {
+ var isOptional = ts.isParameter(decl) && isJSDocOptionalParameter(decl) ||
+ !ts.isBindingElement(decl) && !ts.isVariableDeclaration(decl) && !!decl.questionToken;
+ var declaredType = tryGetTypeFromEffectiveTypeNode(decl);
+ return declaredType && addOptionality(declaredType, isOptional) ||
+ getJSInitializerType(decl, symbol, ts.getDeclaredJavascriptInitializer(decl)) ||
+ getWidenedTypeForVariableLikeDeclaration(decl, true);
+ }
+ }
+ function getJSInitializerType(decl, symbol, init) {
+ if (init && ts.isInJavaScriptFile(init) && ts.isObjectLiteralExpression(init)) {
+ var exports_1 = ts.createSymbolTable();
+ while (ts.isBinaryExpression(decl) || ts.isPropertyAccessExpression(decl)) {
+ var s_1 = getSymbolOfNode(decl);
+ if (s_1 && ts.hasEntries(s_1.exports)) {
+ mergeSymbolTable(exports_1, s_1.exports);
+ }
+ decl = ts.isBinaryExpression(decl) ? decl.parent : decl.parent.parent;
+ }
+ var s = getSymbolOfNode(decl);
+ if (s && ts.hasEntries(s.exports)) {
+ mergeSymbolTable(exports_1, s.exports);
+ }
+ return createAnonymousType(symbol, exports_1, ts.emptyArray, ts.emptyArray, jsObjectLiteralIndexInfo, undefined);
+ }
+ }
function getAnnotatedAccessorType(accessor) {
if (accessor) {
if (accessor.kind === 156) {
@@ -27737,8 +27815,8 @@ var ts;
case 192:
case 193:
case 237:
- case 296:
case 297:
+ case 298:
case 292:
case 177:
case 171:
@@ -31907,16 +31985,18 @@ var ts;
errorInfo = ts.concatenateDiagnosticMessageChains(chain_1, errorInfo);
}
}
- diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo));
- }
- if (headMessage && errorNode && !result && source.symbol) {
- var links = getSymbolLinks(source.symbol);
- if (links.originatingImport && !ts.isImportCall(links.originatingImport)) {
- var helpfulRetry = checkTypeRelatedTo(getTypeOfSymbol(links.target), target, relation, undefined);
- if (helpfulRetry) {
- diagnostics.add(ts.createDiagnosticForNode(links.originatingImport, ts.Diagnostics.A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime));
+ var relatedInformation = void 0;
+ if (headMessage && errorNode && !result && source.symbol) {
+ var links = getSymbolLinks(source.symbol);
+ if (links.originatingImport && !ts.isImportCall(links.originatingImport)) {
+ var helpfulRetry = checkTypeRelatedTo(getTypeOfSymbol(links.target), target, relation, undefined);
+ if (helpfulRetry) {
+ var diag = ts.createDiagnosticForNode(links.originatingImport, ts.Diagnostics.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);
+ relatedInformation = ts.append(relatedInformation, diag);
+ }
}
}
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, relatedInformation));
}
return result !== 0;
function reportError(message, arg0, arg1, arg2) {
@@ -33317,13 +33397,6 @@ var ts;
if (!(prop.flags & 4)) {
return prop;
}
- if (prop.flags & 67108864) {
- var node = prop.declarations && ts.first(prop.declarations);
- var init = ts.getAssignedJavascriptInitializer(node);
- if (init && init.kind !== 184) {
- return prop;
- }
- }
var original = getTypeOfSymbol(prop);
var propContext = context && createWideningContext(context, prop.escapedName, undefined);
var widened = getWidenedTypeWithContext(original, propContext);
@@ -35478,6 +35551,10 @@ var ts;
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
}
}
+ var thisTag = ts.getJSDocThisTag(node);
+ if (thisTag && thisTag.typeExpression) {
+ return getTypeFromTypeNode(thisTag.typeExpression);
+ }
}
function isInConstructorArgumentInitializer(node, constructorDecl) {
return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : n.kind === 149; });
@@ -36312,17 +36389,6 @@ var ts;
var patternWithComputedProperties = false;
var hasComputedStringProperty = false;
var hasComputedNumberProperty = false;
- if (isInJSFile) {
- var decl = ts.getDeclarationOfJSInitializer(node);
- if (decl) {
- var symbol = getSymbolOfNode(decl);
- if (symbol && ts.hasEntries(symbol.exports)) {
- propertiesTable = symbol.exports;
- symbol.exports.forEach(function (s) { return propertiesArray.push(getMergedSymbol(s)); });
- return createObjectLiteralType();
- }
- }
- }
propertiesTable = ts.createSymbolTable();
var offset = 0;
for (var i = 0; i < node.properties.length; i++) {
@@ -38246,12 +38312,11 @@ var ts;
return true;
}
function invocationError(node, apparentType, kind) {
- error(node, kind === 0
+ invocationErrorRecovery(apparentType, kind, error(node, kind === 0
? ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures
- : ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature, typeToString(apparentType));
- invocationErrorRecovery(apparentType, kind);
+ : ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature, typeToString(apparentType)));
}
- function invocationErrorRecovery(apparentType, kind) {
+ function invocationErrorRecovery(apparentType, kind, diagnostic) {
if (!apparentType.symbol) {
return;
}
@@ -38260,7 +38325,8 @@ var ts;
var sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind);
if (!sigs || !sigs.length)
return;
- error(importNode, ts.Diagnostics.A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime);
+ diagnostic.relatedInformation = diagnostic.relatedInformation || [];
+ diagnostic.relatedInformation.push(ts.createDiagnosticForNode(importNode, ts.Diagnostics.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));
}
}
function resolveTaggedTemplateExpression(node, candidatesOutArray) {
@@ -38317,8 +38383,9 @@ var ts;
if (!callSignatures.length) {
var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType));
errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage);
- diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo));
- invocationErrorRecovery(apparentType, 0);
+ var diag = ts.createDiagnosticForNodeFromMessageChain(node, errorInfo);
+ diagnostics.add(diag);
+ invocationErrorRecovery(apparentType, 0, diag);
return resolveErrorCall(node);
}
return resolveCall(node, callSignatures, candidatesOutArray, headMessage);
@@ -39528,9 +39595,15 @@ var ts;
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2) :
leftType;
case 58:
- checkSpecialAssignment(left, right);
- checkAssignmentOperator(rightType);
- return getRegularTypeOfObjectLiteral(rightType);
+ var special = ts.getSpecialPropertyAssignmentKind(left.parent);
+ checkSpecialAssignment(special, right);
+ if (isJSSpecialPropertyAssignment(special)) {
+ return leftType;
+ }
+ else {
+ checkAssignmentOperator(rightType);
+ return getRegularTypeOfObjectLiteral(rightType);
+ }
case 26:
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right)) {
error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
@@ -39539,8 +39612,7 @@ var ts;
default:
return ts.Debug.fail();
}
- function checkSpecialAssignment(left, right) {
- var special = ts.getSpecialPropertyAssignmentKind(left.parent);
+ function checkSpecialAssignment(special, right) {
if (special === 2) {
var rightType_1 = checkExpression(right, checkMode);
for (var _i = 0, _a = getPropertiesOfObjectType(rightType_1); _i < _a.length; _i++) {
@@ -39593,6 +39665,22 @@ var ts;
}
}
}
+ function isJSSpecialPropertyAssignment(special) {
+ switch (special) {
+ case 1:
+ case 2:
+ case 5:
+ case 6:
+ case 3:
+ case 4:
+ var symbol = getSymbolOfNode(left);
+ var init = ts.getAssignedJavascriptInitializer(right);
+ return init && ts.isObjectLiteralExpression(init) &&
+ symbol && ts.hasEntries(symbol.exports);
+ default:
+ return false;
+ }
+ }
function reportOperatorError() {
error(errorNode || operatorToken, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), typeToString(leftType), typeToString(rightType));
}
@@ -40741,7 +40829,7 @@ var ts;
switch (d.kind) {
case 236:
case 237:
- case 297:
+ case 298:
case 292:
return 2;
case 239:
@@ -41083,6 +41171,9 @@ var ts;
}
checkSourceElement(node.typeExpression);
}
+ function checkJSDocTypeTag(node) {
+ checkSourceElement(node.typeExpression);
+ }
function checkJSDocParameterTag(node) {
checkSourceElement(node.typeExpression);
if (!ts.getParameterSymbolFromJSDoc(node)) {
@@ -41309,8 +41400,10 @@ var ts;
}
for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (ts.isAmbientModule(declaration))
+ if (ts.isAmbientModule(declaration) ||
+ (ts.isVariableDeclaration(declaration) && ts.isForInOrOfStatement(declaration.parent.parent) || isImportedDeclaration(declaration)) && isIdentifierThatStartsWithUnderScore(declaration.name)) {
continue;
+ }
if (isImportedDeclaration(declaration)) {
addToGroup(unusedImports, importClauseFromImported(declaration), declaration, getNodeId);
}
@@ -41321,9 +41414,7 @@ var ts;
}
}
else if (ts.isVariableDeclaration(declaration)) {
- if (!isIdentifierThatStartsWithUnderScore(declaration.name) || !ts.isForInOrOfStatement(declaration.parent.parent)) {
- addToGroup(unusedVariables, declaration.parent, declaration, getNodeId);
- }
+ addToGroup(unusedVariables, declaration.parent, declaration, getNodeId);
}
else {
var parameter = local.valueDeclaration && tryGetRootParameterDeclaration(local.valueDeclaration);
@@ -41658,9 +41749,15 @@ var ts;
var type = convertAutoToAny(getTypeOfSymbol(symbol));
if (node === symbol.valueDeclaration) {
var initializer = ts.getEffectiveInitializer(node);
- if (initializer && node.parent.parent.kind !== 221) {
- checkTypeAssignableTo(checkExpressionCached(initializer), type, node, undefined);
- checkParameterInitializer(node);
+ if (initializer) {
+ var isJSObjectLiteralInitializer = ts.isInJavaScriptFile(node) &&
+ ts.isObjectLiteralExpression(initializer) &&
+ (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) &&
+ ts.hasEntries(symbol.exports);
+ if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 221) {
+ checkTypeAssignableTo(checkExpressionCached(initializer), type, node, undefined);
+ checkParameterInitializer(node);
+ }
}
}
else {
@@ -43240,9 +43337,9 @@ var ts;
error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
}
}
- var exports_1 = getExportsOfModule(moduleSymbol);
- if (exports_1) {
- exports_1.forEach(function (_a, id) {
+ var exports_2 = getExportsOfModule(moduleSymbol);
+ if (exports_2) {
+ exports_2.forEach(function (_a, id) {
var declarations = _a.declarations, flags = _a.flags;
if (id === "__export") {
return;
@@ -43343,9 +43440,11 @@ var ts;
return checkImportType(node);
case 290:
return checkJSDocAugmentsTag(node);
- case 297:
+ case 298:
case 292:
return checkJSDocTypeAliasTag(node);
+ case 296:
+ return checkJSDocTypeTag(node);
case 293:
return checkJSDocParameterTag(node);
case 284:
@@ -43812,7 +43911,7 @@ var ts;
if (entityName.parent.kind === 293) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 148 && entityName.parent.parent.kind === 296) {
+ if (entityName.parent.kind === 148 && entityName.parent.parent.kind === 297) {
ts.Debug.assert(!ts.isInJavaScriptFile(entityName));
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -46090,7 +46189,7 @@ var ts;
ts.updateQualifiedName = updateQualifiedName;
function parenthesizeForComputedName(expression) {
return (ts.isBinaryExpression(expression) && expression.operatorToken.kind === 26) ||
- expression.kind === 302 ?
+ expression.kind === 303 ?
createParen(expression) :
expression;
}
@@ -48048,28 +48147,28 @@ var ts;
}
ts.getMutableClone = getMutableClone;
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(300);
+ var node = createSynthesizedNode(301);
node.original = original;
setTextRange(node, original);
return node;
}
ts.createNotEmittedStatement = createNotEmittedStatement;
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(304);
+ var node = createSynthesizedNode(305);
node.emitNode = {};
node.original = original;
return node;
}
ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker;
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(303);
+ var node = createSynthesizedNode(304);
node.emitNode = {};
node.original = original;
return node;
}
ts.createMergeDeclarationMarker = createMergeDeclarationMarker;
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(301);
+ var node = createSynthesizedNode(302);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -48085,7 +48184,7 @@ var ts;
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 302) {
+ if (node.kind === 303) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26) {
@@ -48095,7 +48194,7 @@ var ts;
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(302);
+ var node = createSynthesizedNode(303);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -48114,18 +48213,21 @@ var ts;
return node;
}
ts.createBundle = createBundle;
- function createUnparsedSourceFile(text, map) {
+ function createUnparsedSourceFile(text, mapPath, map) {
var node = ts.createNode(276);
node.text = text;
+ node.sourceMapPath = mapPath;
node.sourceMapText = map;
return node;
}
ts.createUnparsedSourceFile = createUnparsedSourceFile;
- function createInputFiles(javascript, declaration, javascriptMapText, declarationMapText) {
+ function createInputFiles(javascript, declaration, javascriptMapPath, javascriptMapText, declarationMapPath, declarationMapText) {
var node = ts.createNode(277);
node.javascriptText = javascript;
+ node.javascriptMapPath = javascriptMapPath;
node.javascriptMapText = javascriptMapText;
node.declarationText = declaration;
+ node.declarationMapPath = declarationMapPath;
node.declarationMapText = declarationMapText;
return node;
}
@@ -49068,7 +49170,7 @@ var ts;
function parenthesizeSubexpressionOfConditionalExpression(e) {
var emittedExpression = ts.skipPartiallyEmittedExpressions(e);
return emittedExpression.kind === 200 && emittedExpression.operatorToken.kind === 26 ||
- emittedExpression.kind === 302
+ emittedExpression.kind === 303
? ts.createParen(e)
: e;
}
@@ -49077,7 +49179,7 @@ var ts;
var check = ts.skipPartiallyEmittedExpressions(e);
return (check.kind === 205 ||
check.kind === 192 ||
- check.kind === 302 ||
+ check.kind === 303 ||
ts.isBinaryExpression(check) && check.operatorToken.kind === 26)
? ts.createParen(e)
: e;
@@ -49223,7 +49325,7 @@ var ts;
case 185:
node = node.expression;
continue;
- case 301:
+ case 302:
node = node.expression;
continue;
}
@@ -49246,7 +49348,7 @@ var ts;
case 208:
case 209:
return (kinds & 2) !== 0;
- case 301:
+ case 302:
return (kinds & 4) !== 0;
}
return false;
@@ -49283,7 +49385,7 @@ var ts;
case 190: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
case 208: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
case 209: return ts.updateNonNullExpression(outerExpression, expression);
- case 301: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 302: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
function isIgnorableParen(node) {
@@ -49909,9 +50011,9 @@ var ts;
return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
case 274:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
- case 301:
- return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
case 302:
+ return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 303:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
return node;
@@ -49949,7 +50051,7 @@ var ts;
case 215:
case 206:
case 231:
- case 300:
+ case 301:
break;
case 146:
result = reduceNode(node.left, cbNode, result);
@@ -50312,10 +50414,10 @@ var ts;
case 274:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 301:
+ case 302:
result = reduceNode(node.expression, cbNode, result);
break;
- case 302:
+ case 303:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -50444,6 +50546,255 @@ var ts;
})(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
var ts;
+(function (ts) {
+ function createSourceFileLikeCache(host) {
+ var cached = ts.createMap();
+ return {
+ get: function (path) {
+ if (cached.has(path)) {
+ return cached.get(path);
+ }
+ if (!host.fileExists || !host.readFile || !host.fileExists(path))
+ return;
+ var text = host.readFile(path);
+ var file = {
+ text: text,
+ lineMap: undefined,
+ getLineAndCharacterOfPosition: function (pos) {
+ return ts.computeLineAndCharacterOfPosition(ts.getLineStarts(this), pos);
+ }
+ };
+ cached.set(path, file);
+ return file;
+ }
+ };
+ }
+ ts.createSourceFileLikeCache = createSourceFileLikeCache;
+})(ts || (ts = {}));
+(function (ts) {
+ var sourcemaps;
+ (function (sourcemaps) {
+ sourcemaps.identitySourceMapper = { getOriginalPosition: ts.identity, getGeneratedPosition: ts.identity };
+ function decode(host, mapPath, map, program, fallbackCache) {
+ if (fallbackCache === void 0) { fallbackCache = ts.createSourceFileLikeCache(host); }
+ var currentDirectory = ts.getDirectoryPath(mapPath);
+ var sourceRoot = map.sourceRoot || currentDirectory;
+ var decodedMappings;
+ var generatedOrderedMappings;
+ var sourceOrderedMappings;
+ return {
+ getOriginalPosition: getOriginalPosition,
+ getGeneratedPosition: getGeneratedPosition
+ };
+ function getGeneratedPosition(loc) {
+ var maps = getSourceOrderedMappings();
+ if (!ts.length(maps))
+ return loc;
+ var targetIndex = ts.binarySearch(maps, { sourcePath: loc.fileName, sourcePosition: loc.position }, ts.identity, compareProcessedPositionSourcePositions);
+ if (targetIndex < 0 && maps.length > 0) {
+ targetIndex = ~targetIndex;
+ }
+ if (!maps[targetIndex] || ts.comparePaths(loc.fileName, maps[targetIndex].sourcePath, sourceRoot) !== 0) {
+ return loc;
+ }
+ return { fileName: ts.toPath(map.file, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].emittedPosition };
+ }
+ function getOriginalPosition(loc) {
+ var maps = getGeneratedOrderedMappings();
+ if (!ts.length(maps))
+ return loc;
+ var targetIndex = ts.binarySearch(maps, { emittedPosition: loc.position }, ts.identity, compareProcessedPositionEmittedPositions);
+ if (targetIndex < 0 && maps.length > 0) {
+ targetIndex = ~targetIndex;
+ }
+ return { fileName: ts.toPath(maps[targetIndex].sourcePath, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].sourcePosition };
+ }
+ function getSourceFileLike(fileName, location) {
+ var file = program && program.getSourceFile(fileName);
+ if (!file) {
+ var path = ts.toPath(fileName, location, host.getCanonicalFileName);
+ return fallbackCache.get(path);
+ }
+ return file;
+ }
+ function getPositionOfLineAndCharacterUsingName(fileName, directory, line, character) {
+ var file = getSourceFileLike(fileName, directory);
+ if (!file) {
+ return -1;
+ }
+ return ts.getPositionOfLineAndCharacter(file, line, character);
+ }
+ function getDecodedMappings() {
+ return decodedMappings || (decodedMappings = calculateDecodedMappings(map, processPosition, host));
+ }
+ function getSourceOrderedMappings() {
+ return sourceOrderedMappings || (sourceOrderedMappings = getDecodedMappings().slice().sort(compareProcessedPositionSourcePositions));
+ }
+ function getGeneratedOrderedMappings() {
+ return generatedOrderedMappings || (generatedOrderedMappings = getDecodedMappings().slice().sort(compareProcessedPositionEmittedPositions));
+ }
+ function compareProcessedPositionSourcePositions(a, b) {
+ return ts.comparePaths(a.sourcePath, b.sourcePath, sourceRoot) ||
+ ts.compareValues(a.sourcePosition, b.sourcePosition);
+ }
+ function compareProcessedPositionEmittedPositions(a, b) {
+ return ts.compareValues(a.emittedPosition, b.emittedPosition);
+ }
+ function processPosition(position) {
+ var sourcePath = map.sources[position.sourceIndex];
+ return {
+ emittedPosition: getPositionOfLineAndCharacterUsingName(map.file, currentDirectory, position.emittedLine, position.emittedColumn),
+ sourcePosition: getPositionOfLineAndCharacterUsingName(sourcePath, sourceRoot, position.sourceLine, position.sourceColumn),
+ sourcePath: sourcePath,
+ };
+ }
+ }
+ sourcemaps.decode = decode;
+ function decodeMappings(map) {
+ var state = {
+ encodedText: map.mappings,
+ currentNameIndex: undefined,
+ sourceMapNamesLength: map.names ? map.names.length : undefined,
+ currentEmittedColumn: 0,
+ currentEmittedLine: 0,
+ currentSourceColumn: 0,
+ currentSourceLine: 0,
+ currentSourceIndex: 0,
+ decodingIndex: 0
+ };
+ function captureSpan() {
+ return {
+ emittedColumn: state.currentEmittedColumn,
+ emittedLine: state.currentEmittedLine,
+ sourceColumn: state.currentSourceColumn,
+ sourceIndex: state.currentSourceIndex,
+ sourceLine: state.currentSourceLine,
+ nameIndex: state.currentNameIndex
+ };
+ }
+ return {
+ get decodingIndex() { return state.decodingIndex; },
+ get error() { return state.error; },
+ get lastSpan() { return captureSpan(); },
+ next: function () {
+ if (hasCompletedDecoding(state) || state.error)
+ return { done: true, value: undefined };
+ if (!decodeSinglePosition(state))
+ return { done: true, value: undefined };
+ return { done: false, value: captureSpan() };
+ }
+ };
+ }
+ sourcemaps.decodeMappings = decodeMappings;
+ function calculateDecodedMappings(map, processPosition, host) {
+ var decoder = decodeMappings(map);
+ var positions = ts.arrayFrom(decoder, processPosition);
+ if (decoder.error) {
+ if (host && host.log) {
+ host.log("Encountered error while decoding sourcemap: " + decoder.error);
+ }
+ return [];
+ }
+ return positions;
+ }
+ sourcemaps.calculateDecodedMappings = calculateDecodedMappings;
+ function hasCompletedDecoding(state) {
+ return state.decodingIndex === state.encodedText.length;
+ }
+ function decodeSinglePosition(state) {
+ while (state.decodingIndex < state.encodedText.length) {
+ var char = state.encodedText.charCodeAt(state.decodingIndex);
+ if (char === 59) {
+ state.currentEmittedLine++;
+ state.currentEmittedColumn = 0;
+ state.decodingIndex++;
+ continue;
+ }
+ if (char === 44) {
+ state.decodingIndex++;
+ continue;
+ }
+ state.currentEmittedColumn += base64VLQFormatDecode();
+ if (createErrorIfCondition(state.currentEmittedColumn < 0, "Invalid emittedColumn found")) {
+ return false;
+ }
+ if (createErrorIfCondition(isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: No entries after emitted column")) {
+ return false;
+ }
+ state.currentSourceIndex += base64VLQFormatDecode();
+ if (createErrorIfCondition(state.currentSourceIndex < 0, "Invalid sourceIndex found")) {
+ return false;
+ }
+ if (createErrorIfCondition(isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: No entries after sourceIndex")) {
+ return false;
+ }
+ state.currentSourceLine += base64VLQFormatDecode();
+ if (createErrorIfCondition(state.currentSourceLine < 0, "Invalid sourceLine found")) {
+ return false;
+ }
+ if (createErrorIfCondition(isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: No entries after emitted Line")) {
+ return false;
+ }
+ state.currentSourceColumn += base64VLQFormatDecode();
+ if (createErrorIfCondition(state.currentSourceColumn < 0, "Invalid sourceLine found")) {
+ return false;
+ }
+ if (!isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex)) {
+ if (state.currentNameIndex === undefined) {
+ state.currentNameIndex = 0;
+ }
+ state.currentNameIndex += base64VLQFormatDecode();
+ }
+ if (createErrorIfCondition(!isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: There are more entries after " + (state.currentNameIndex === undefined ? "sourceColumn" : "nameIndex"))) {
+ return false;
+ }
+ return true;
+ }
+ createErrorIfCondition(true, "No encoded entry found");
+ return false;
+ function createErrorIfCondition(condition, errormsg) {
+ if (state.error) {
+ return true;
+ }
+ if (condition) {
+ state.error = errormsg;
+ }
+ return condition;
+ }
+ function base64VLQFormatDecode() {
+ var moreDigits = true;
+ var shiftCount = 0;
+ var value = 0;
+ for (; moreDigits; state.decodingIndex++) {
+ if (createErrorIfCondition(state.decodingIndex >= state.encodedText.length, "Error in decoding base64VLQFormatDecode, past the mapping string")) {
+ return undefined;
+ }
+ var currentByte = base64FormatDecode(state.encodedText.charAt(state.decodingIndex));
+ moreDigits = (currentByte & 32) !== 0;
+ value = value | ((currentByte & 31) << shiftCount);
+ shiftCount += 5;
+ }
+ if ((value & 1) === 0) {
+ value = value >> 1;
+ }
+ else {
+ value = value >> 1;
+ value = -value;
+ }
+ return value;
+ }
+ }
+ function base64FormatDecode(char) {
+ return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(char);
+ }
+ function isSourceMappingSegmentEnd(encodedText, pos) {
+ return (pos === encodedText.length ||
+ encodedText.charCodeAt(pos) === 44 ||
+ encodedText.charCodeAt(pos) === 59);
+ }
+ })(sourcemaps = ts.sourcemaps || (ts.sourcemaps = {}));
+})(ts || (ts = {}));
+var ts;
(function (ts) {
function getOriginalNodeId(node) {
node = ts.getOriginalNode(node);
@@ -51040,7 +51391,7 @@ var ts;
function transformBundle(node) {
return ts.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) {
if (prepend.kind === 277) {
- return ts.createUnparsedSourceFile(prepend.javascriptText, prepend.javascriptMapText);
+ return ts.createUnparsedSourceFile(prepend.javascriptText, prepend.javascriptMapPath, prepend.javascriptMapText);
}
return prepend;
}));
@@ -58024,9 +58375,9 @@ var ts;
return visitFunctionDeclaration(node);
case 235:
return visitClassDeclaration(node);
- case 303:
- return visitMergeDeclarationMarker(node);
case 304:
+ return visitMergeDeclarationMarker(node);
+ case 305:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -59230,9 +59581,9 @@ var ts;
return visitCatchClause(node);
case 213:
return visitBlock(node);
- case 303:
- return visitMergeDeclarationMarker(node);
case 304:
+ return visitMergeDeclarationMarker(node);
+ case 305:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -60146,7 +60497,7 @@ var ts;
return ts.updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), true, [], [], false, []);
}), ts.mapDefined(node.prepends, function (prepend) {
if (prepend.kind === 277) {
- return ts.createUnparsedSourceFile(prepend.declarationText, prepend.declarationMapText);
+ return ts.createUnparsedSourceFile(prepend.declarationText, prepend.declarationMapPath, prepend.declarationMapText);
}
}));
bundle.syntheticFileReferences = [];
@@ -61035,7 +61386,7 @@ var ts;
}
ts.getTransformers = getTransformers;
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(305);
+ var enabledSyntaxKindFeatures = new Array(306);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -61237,10 +61588,10 @@ var ts;
var ts;
(function (ts) {
var defaultLastEncodedSourceMapSpan = {
- emittedLine: 1,
- emittedColumn: 1,
- sourceLine: 1,
- sourceColumn: 1,
+ emittedLine: 0,
+ emittedColumn: 0,
+ sourceLine: 0,
+ sourceColumn: 0,
sourceIndex: 0
};
function createSourceMapWriter(host, writer, compilerOptions) {
@@ -61256,9 +61607,6 @@ var ts;
var sourceMapData;
var sourceMapDataList;
var disabled = !(compilerOptions.sourceMap || compilerOptions.inlineSourceMap);
- var completedSections;
- var sectionStartLine;
- var sectionStartColumn;
return {
initialize: initialize,
reset: reset,
@@ -61286,9 +61634,6 @@ var ts;
lastRecordedSourceMapSpan = undefined;
lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan;
lastEncodedNameIndex = 0;
- completedSections = [];
- sectionStartLine = 1;
- sectionStartColumn = 1;
sourceMapData = {
sourceMapFilePath: sourceMapFilePath,
jsSourceMappingURL: !compilerOptions.inlineSourceMap ? ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)) : undefined,
@@ -61337,9 +61682,6 @@ var ts;
lastEncodedNameIndex = undefined;
sourceMapData = undefined;
sourceMapDataList = undefined;
- completedSections = undefined;
- sectionStartLine = undefined;
- sectionStartColumn = undefined;
}
function captureSection() {
return {
@@ -61352,29 +61694,14 @@ var ts;
sourcesContent: sourceMapData.sourceMapSourcesContent,
};
}
- function resetSectionalData() {
- sourceMapData.sourceMapSources = [];
- sourceMapData.sourceMapNames = [];
- sourceMapData.sourceMapMappings = "";
- sourceMapData.sourceMapSourcesContent = compilerOptions.inlineSources ? [] : undefined;
- }
- function generateMap() {
- if (completedSections.length) {
- captureSectionalSpanIfNeeded(false);
- return {
- version: 3,
- file: sourceMapData.sourceMapFile,
- sections: completedSections
- };
- }
- else {
- return captureSection();
- }
- }
function encodeLastRecordedSourceMapSpan() {
if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) {
return;
}
+ ts.Debug.assert(lastRecordedSourceMapSpan.emittedColumn >= 0, "lastEncodedSourceMapSpan.emittedColumn was negative");
+ ts.Debug.assert(lastRecordedSourceMapSpan.sourceIndex >= 0, "lastEncodedSourceMapSpan.sourceIndex was negative");
+ ts.Debug.assert(lastRecordedSourceMapSpan.sourceLine >= 0, "lastEncodedSourceMapSpan.sourceLine was negative");
+ ts.Debug.assert(lastRecordedSourceMapSpan.sourceColumn >= 0, "lastEncodedSourceMapSpan.sourceColumn was negative");
var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn;
if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) {
if (sourceMapData.sourceMapMappings) {
@@ -61385,7 +61712,7 @@ var ts;
for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) {
sourceMapData.sourceMapMappings += ";";
}
- prevEncodedEmittedColumn = 1;
+ prevEncodedEmittedColumn = 0;
}
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn);
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex);
@@ -61407,10 +61734,8 @@ var ts;
ts.performance.mark("beforeSourcemap");
}
var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSource, pos);
- sourceLinePos.line++;
- sourceLinePos.character++;
- var emittedLine = writer.getLine() - sectionStartLine + 1;
- var emittedColumn = emittedLine === 0 ? (writer.getColumn() - sectionStartColumn + 1) : writer.getColumn();
+ var emittedLine = writer.getLine();
+ var emittedColumn = writer.getColumn();
if (!lastRecordedSourceMapSpan ||
lastRecordedSourceMapSpan.emittedLine !== emittedLine ||
lastRecordedSourceMapSpan.emittedColumn !== emittedColumn ||
@@ -61436,13 +61761,8 @@ var ts;
ts.performance.measure("Source Map", "beforeSourcemap", "afterSourcemap");
}
}
- function captureSectionalSpanIfNeeded(reset) {
- if (lastRecordedSourceMapSpan && lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) {
- completedSections.push({ offset: { line: sectionStartLine - 1, column: sectionStartColumn - 1 }, map: captureSection() });
- if (reset) {
- resetSectionalData();
- }
- }
+ function isPossiblySourceMap(x) {
+ return typeof x === "object" && !!x.mappings && typeof x.mappings === "string" && !!x.sources;
}
function emitNodeWithSourceMap(hint, node, emitCallback) {
if (disabled || ts.isInJsonFile(node)) {
@@ -61450,7 +61770,6 @@ var ts;
}
if (node) {
if (ts.isUnparsedSource(node) && node.sourceMapText !== undefined) {
- captureSectionalSpanIfNeeded(true);
var text = node.sourceMapText;
var parsed = void 0;
try {
@@ -61458,22 +61777,25 @@ var ts;
}
catch (_a) {
}
- var offset = { line: writer.getLine() - 1, column: writer.getColumn() - 1 };
- completedSections.push(parsed
- ? {
- offset: offset,
- map: parsed
- }
- : {
- offset: offset,
- url: "data:application/json;charset=utf-8;base64," + ts.base64encode(ts.sys, text)
- });
- var emitResult = emitCallback(hint, node);
- sectionStartLine = writer.getLine();
- sectionStartColumn = writer.getColumn();
- lastRecordedSourceMapSpan = undefined;
- lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan;
- return emitResult;
+ if (!parsed || !isPossiblySourceMap(parsed)) {
+ return emitCallback(hint, node);
+ }
+ var offsetLine_1 = writer.getLine();
+ var firstLineColumnOffset_1 = writer.getColumn();
+ var originalMap_1 = parsed;
+ ts.sourcemaps.calculateDecodedMappings(originalMap_1, function (raw) {
+ var rawPath = originalMap_1.sources[raw.sourceIndex];
+ var relativePath = originalMap_1.sourceRoot ? ts.combinePaths(originalMap_1.sourceRoot, rawPath) : rawPath;
+ var combinedPath = ts.combinePaths(ts.getDirectoryPath(node.sourceMapPath), relativePath);
+ var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
+ var resolvedPath = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, combinedPath, host.getCurrentDirectory(), host.getCanonicalFileName, true);
+ var absolutePath = ts.getNormalizedAbsolutePath(resolvedPath, sourcesDirectoryPath);
+ setupSourceEntry(absolutePath, originalMap_1.sourcesContent ? originalMap_1.sourcesContent[raw.sourceIndex] : null);
+ var newIndex = sourceMapData.sourceMapSources.indexOf(resolvedPath);
+ encodeLastRecordedSourceMapSpan();
+ lastRecordedSourceMapSpan = __assign({}, raw, { emittedLine: raw.emittedLine + offsetLine_1, emittedColumn: raw.emittedLine === 0 ? (raw.emittedColumn + firstLineColumnOffset_1) : raw.emittedColumn, sourceIndex: newIndex });
+ });
+ return emitCallback(hint, node);
}
var emitNode = node.emitNode;
var emitFlags = emitNode && emitNode.flags || 0;
@@ -61485,7 +61807,7 @@ var ts;
source = undefined;
if (source)
setSourceFile(source);
- if (node.kind !== 300
+ if (node.kind !== 301
&& (emitFlags & 16) === 0
&& pos >= 0) {
emitPos(skipSourceTrivia(pos));
@@ -61502,7 +61824,7 @@ var ts;
}
if (source)
setSourceFile(source);
- if (node.kind !== 300
+ if (node.kind !== 301
&& (emitFlags & 32) === 0
&& end >= 0) {
emitPos(end);
@@ -61542,15 +61864,18 @@ var ts;
if (isJsonSourceMapSource(sourceFile)) {
return;
}
+ setupSourceEntry(sourceFile.fileName, sourceFile.text);
+ }
+ function setupSourceEntry(fileName, content) {
var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
- var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSource.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true);
+ var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true);
sourceMapSourceIndex = sourceMapData.sourceMapSources.indexOf(source);
if (sourceMapSourceIndex === -1) {
sourceMapSourceIndex = sourceMapData.sourceMapSources.length;
sourceMapData.sourceMapSources.push(source);
- sourceMapData.inputSourceFileNames.push(currentSource.fileName);
+ sourceMapData.inputSourceFileNames.push(fileName);
if (compilerOptions.inlineSources) {
- sourceMapData.sourceMapSourcesContent.push(currentSource.text);
+ sourceMapData.sourceMapSourcesContent.push(content);
}
}
}
@@ -61559,7 +61884,7 @@ var ts;
return undefined;
}
encodeLastRecordedSourceMapSpan();
- return JSON.stringify(generateMap());
+ return JSON.stringify(captureSection());
}
function getSourceMappingURL() {
if (disabled || isJsonSourceMapSource(currentSource)) {
@@ -61642,7 +61967,7 @@ var ts;
if (extendedDiagnostics) {
ts.performance.mark("preEmitNodeWithComment");
}
- var isEmittedNode = node.kind !== 300;
+ var isEmittedNode = node.kind !== 301;
var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0 || node.kind === 10;
var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 10;
if (!skipLeadingComments) {
@@ -62686,9 +63011,9 @@ var ts;
return emitJsxSelfClosingElement(node);
case 259:
return emitJsxFragment(node);
- case 301:
- return emitPartiallyEmittedExpression(node);
case 302:
+ return emitPartiallyEmittedExpression(node);
+ case 303:
return emitCommaList(node);
}
}
@@ -65381,6 +65706,8 @@ var ts;
var gutterSeparator = " ";
var resetEscapeSequence = "\u001b[0m";
var ellipsis = "...";
+ var halfIndent = " ";
+ var indent = " ";
function getCategoryFormat(category) {
switch (category) {
case ts.DiagnosticCategory.Error: return ForegroundColorEscapeSequences.Red;
@@ -65399,55 +65726,64 @@ var ts;
}
return s;
}
+ function formatCodeSpan(file, start, length, indent, squiggleColor, host) {
+ var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character;
+ var _b = ts.getLineAndCharacterOfPosition(file, start + length), lastLine = _b.line, lastLineChar = _b.character;
+ var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line;
+ var hasMoreThanFiveLines = (lastLine - firstLine) >= 4;
+ var gutterWidth = (lastLine + 1 + "").length;
+ if (hasMoreThanFiveLines) {
+ gutterWidth = Math.max(ellipsis.length, gutterWidth);
+ }
+ var context = "";
+ for (var i = firstLine; i <= lastLine; i++) {
+ context += host.getNewLine();
+ if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) {
+ context += indent + formatColorAndReset(padLeft(ellipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine();
+ i = lastLine - 1;
+ }
+ var lineStart = ts.getPositionOfLineAndCharacter(file, i, 0);
+ var lineEnd = i < lastLineInFile ? ts.getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length;
+ var lineContent = file.text.slice(lineStart, lineEnd);
+ lineContent = lineContent.replace(/\s+$/g, "");
+ lineContent = lineContent.replace("\t", " ");
+ context += indent + formatColorAndReset(padLeft(i + 1 + "", gutterWidth), gutterStyleSequence) + gutterSeparator;
+ context += lineContent + host.getNewLine();
+ context += indent + formatColorAndReset(padLeft("", gutterWidth), gutterStyleSequence) + gutterSeparator;
+ context += squiggleColor;
+ if (i === firstLine) {
+ var lastCharForLine = i === lastLine ? lastLineChar : undefined;
+ context += lineContent.slice(0, firstLineChar).replace(/\S/g, " ");
+ context += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~");
+ }
+ else if (i === lastLine) {
+ context += lineContent.slice(0, lastLineChar).replace(/./g, "~");
+ }
+ else {
+ context += lineContent.replace(/./g, "~");
+ }
+ context += resetEscapeSequence;
+ }
+ return context;
+ }
+ function formatLocation(file, start, host) {
+ var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character;
+ var relativeFileName = host ? ts.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : file.fileName;
+ var output = "";
+ output += formatColorAndReset(relativeFileName, ForegroundColorEscapeSequences.Cyan);
+ output += ":";
+ output += formatColorAndReset("" + (firstLine + 1), ForegroundColorEscapeSequences.Yellow);
+ output += ":";
+ output += formatColorAndReset("" + (firstLineChar + 1), ForegroundColorEscapeSequences.Yellow);
+ return output;
+ }
function formatDiagnosticsWithColorAndContext(diagnostics, host) {
var output = "";
for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) {
var diagnostic = diagnostics_2[_i];
- var context = "";
if (diagnostic.file) {
- var start = diagnostic.start, length_4 = diagnostic.length, file = diagnostic.file;
- var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character;
- var _b = ts.getLineAndCharacterOfPosition(file, start + length_4), lastLine = _b.line, lastLineChar = _b.character;
- var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line;
- var relativeFileName = host ? ts.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : file.fileName;
- var hasMoreThanFiveLines = (lastLine - firstLine) >= 4;
- var gutterWidth = (lastLine + 1 + "").length;
- if (hasMoreThanFiveLines) {
- gutterWidth = Math.max(ellipsis.length, gutterWidth);
- }
- for (var i = firstLine; i <= lastLine; i++) {
- context += host.getNewLine();
- if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) {
- context += formatColorAndReset(padLeft(ellipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine();
- i = lastLine - 1;
- }
- var lineStart = ts.getPositionOfLineAndCharacter(file, i, 0);
- var lineEnd = i < lastLineInFile ? ts.getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length;
- var lineContent = file.text.slice(lineStart, lineEnd);
- lineContent = lineContent.replace(/\s+$/g, "");
- lineContent = lineContent.replace("\t", " ");
- context += formatColorAndReset(padLeft(i + 1 + "", gutterWidth), gutterStyleSequence) + gutterSeparator;
- context += lineContent + host.getNewLine();
- context += formatColorAndReset(padLeft("", gutterWidth), gutterStyleSequence) + gutterSeparator;
- context += ForegroundColorEscapeSequences.Red;
- if (i === firstLine) {
- var lastCharForLine = i === lastLine ? lastLineChar : undefined;
- context += lineContent.slice(0, firstLineChar).replace(/\S/g, " ");
- context += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~");
- }
- else if (i === lastLine) {
- context += lineContent.slice(0, lastLineChar).replace(/./g, "~");
- }
- else {
- context += lineContent.replace(/./g, "~");
- }
- context += resetEscapeSequence;
- }
- output += formatColorAndReset(relativeFileName, ForegroundColorEscapeSequences.Cyan);
- output += ":";
- output += formatColorAndReset("" + (firstLine + 1), ForegroundColorEscapeSequences.Yellow);
- output += ":";
- output += formatColorAndReset("" + (firstLineChar + 1), ForegroundColorEscapeSequences.Yellow);
+ var file = diagnostic.file, start = diagnostic.start;
+ output += formatLocation(file, start, host);
output += " - ";
}
output += formatColorAndReset(ts.diagnosticCategoryName(diagnostic), getCategoryFormat(diagnostic.category));
@@ -65455,7 +65791,20 @@ var ts;
output += flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine());
if (diagnostic.file) {
output += host.getNewLine();
- output += context;
+ output += formatCodeSpan(diagnostic.file, diagnostic.start, diagnostic.length, "", getCategoryFormat(diagnostic.category), host);
+ if (diagnostic.relatedInformation) {
+ output += host.getNewLine();
+ for (var _a = 0, _b = diagnostic.relatedInformation; _a < _b.length; _a++) {
+ var _c = _b[_a], file = _c.file, start = _c.start, length_4 = _c.length, messageText = _c.messageText;
+ if (file) {
+ output += host.getNewLine();
+ output += halfIndent + formatLocation(file, start, host);
+ output += formatCodeSpan(file, start, length_4, indent, ForegroundColorEscapeSequences.Cyan, host);
+ }
+ output += host.getNewLine();
+ output += indent + flattenDiagnosticMessageText(messageText, host.getNewLine());
+ }
+ }
}
output += host.getNewLine();
}
@@ -65469,16 +65818,16 @@ var ts;
else {
var diagnosticChain = messageText;
var result = "";
- var indent = 0;
+ var indent_1 = 0;
while (diagnosticChain) {
- if (indent) {
+ if (indent_1) {
result += newLine;
- for (var i = 0; i < indent; i++) {
+ for (var i = 0; i < indent_1; i++) {
result += " ";
}
}
result += diagnosticChain.messageText;
- indent++;
+ indent_1++;
diagnosticChain = diagnosticChain.next;
}
return result;
@@ -66035,6 +66384,7 @@ var ts;
fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile);
}
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
+ resolvedProjectReferences = oldProgram.getProjectReferences();
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
redirectTargetsSet = oldProgram.redirectTargetsSet;
return oldProgram.structureIsReused = 2;
@@ -66061,10 +66411,12 @@ var ts;
continue;
var dtsFilename = ts.changeExtension(resolvedRefOpts.options.outFile, ".d.ts");
var js = host.readFile(resolvedRefOpts.options.outFile) || "/* Input file " + resolvedRefOpts.options.outFile + " was missing */\r\n";
- var jsMap = host.readFile(resolvedRefOpts.options.outFile + ".map");
+ var jsMapPath = resolvedRefOpts.options.outFile + ".map";
+ var jsMap = host.readFile(jsMapPath);
var dts = host.readFile(dtsFilename) || "/* Input file " + dtsFilename + " was missing */\r\n";
- var dtsMap = host.readFile(dtsFilename + ".map");
- var node = ts.createInputFiles(js, dts, jsMap, dtsMap);
+ var dtsMapPath = dtsFilename + ".map";
+ var dtsMap = host.readFile(dtsMapPath);
+ var node = ts.createInputFiles(js, dts, jsMap && jsMapPath, jsMap, dtsMap && dtsMapPath, dtsMap);
nodes.push(node);
}
}
@@ -68080,6 +68432,7 @@ var ts;
if (isNodeModulesDirectory(dirPath)) {
return filterFSRootDirectoriesToWatch({ dir: dir, dirPath: dirPath }, ts.getDirectoryPath(dirPath));
}
+ var nonRecursive = true;
var subDirectoryPath, subDirectory;
if (rootPath !== undefined) {
while (!isInDirectoryPath(dirPath, rootPath)) {
@@ -68087,13 +68440,14 @@ var ts;
if (parentPath === dirPath) {
break;
}
+ nonRecursive = false;
subDirectoryPath = dirPath;
subDirectory = dir;
dirPath = parentPath;
dir = ts.getDirectoryPath(dir);
}
}
- return filterFSRootDirectoriesToWatch({ dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath }, dirPath);
+ return filterFSRootDirectoriesToWatch({ dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive: nonRecursive }, dirPath);
}
function isPathWithDefaultFailedLookupExtension(path) {
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
@@ -68112,7 +68466,7 @@ var ts;
for (var _i = 0, failedLookupLocations_1 = failedLookupLocations; _i < failedLookupLocations_1.length; _i++) {
var failedLookupLocation = failedLookupLocations_1[_i];
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
- var _a = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath), dir = _a.dir, dirPath = _a.dirPath, ignore = _a.ignore;
+ var _a = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath), dir = _a.dir, dirPath = _a.dirPath, nonRecursive = _a.nonRecursive, ignore = _a.ignore;
if (!ignore) {
if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
var refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
@@ -68122,7 +68476,7 @@ var ts;
setAtRoot = true;
}
else {
- setDirectoryWatcher(dir, dirPath);
+ setDirectoryWatcher(dir, dirPath, nonRecursive);
}
}
}
@@ -68130,13 +68484,14 @@ var ts;
setDirectoryWatcher(rootDir, rootPath);
}
}
- function setDirectoryWatcher(dir, dirPath) {
+ function setDirectoryWatcher(dir, dirPath, nonRecursive) {
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
if (dirWatcher) {
+ ts.Debug.assert(!!nonRecursive === !!dirWatcher.nonRecursive);
dirWatcher.refCount++;
}
else {
- directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath), refCount: 1 });
+ directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive: nonRecursive });
}
}
function stopWatchFailedLookupLocationOfResolution(resolution) {
@@ -68180,7 +68535,7 @@ var ts;
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
dirWatcher.refCount--;
}
- function createDirectoryWatcher(directory, dirPath) {
+ function createDirectoryWatcher(directory, dirPath, nonRecursive) {
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, function (fileOrDirectory) {
var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
if (cachedDirectoryStructureHost) {
@@ -68189,7 +68544,7 @@ var ts;
if (!allFilesHaveInvalidatedResolution && invalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath)) {
resolutionHost.onInvalidatedResolution();
}
- }, 1);
+ }, nonRecursive ? 0 : 1);
}
function removeResolutionsOfFileFromCache(cache, filePath) {
var resolutions = cache.get(filePath);
@@ -68337,13 +68692,15 @@ var ts;
ts.first(getLocalModuleSpecifiers(toFileName, info, compilerOptions, preferences));
}
moduleSpecifiers.getModuleSpecifier = getModuleSpecifier;
- function getModuleSpecifiers(moduleSymbol, program, importingSourceFile, host, preferences) {
+ function getModuleSpecifiers(moduleSymbol, compilerOptions, importingSourceFile, host, files, preferences) {
var ambient = tryGetModuleNameFromAmbientModule(moduleSymbol);
if (ambient)
return [[ambient]];
- var compilerOptions = program.getCompilerOptions();
- var info = getInfo(compilerOptions, importingSourceFile, importingSourceFile.fileName, host);
- var modulePaths = getAllModulePaths(program, ts.getSourceFileOfNode(moduleSymbol.valueDeclaration));
+ var info = getInfo(compilerOptions, importingSourceFile, importingSourceFile.path, host);
+ if (!files) {
+ return ts.Debug.fail("Files list must be present to resolve symlinks in specifier resolution");
+ }
+ var modulePaths = getAllModulePaths(files, ts.getSourceFileOfNode(moduleSymbol.valueDeclaration), info.getCanonicalFileName, host);
var global = ts.mapDefined(modulePaths, function (moduleFileName) { return getGlobalModuleSpecifier(moduleFileName, info, host, compilerOptions); });
return global.length ? global.map(function (g) { return [g]; }) : modulePaths.map(function (moduleFileName) {
return getLocalModuleSpecifiers(moduleFileName, info, compilerOptions, preferences);
@@ -68400,14 +68757,60 @@ var ts;
return ts.pathIsRelative(text) ? ts.fileExtensionIs(text, ".js") : undefined;
}) || false;
}
- function getAllModulePaths(program, _a) {
+ function discoverProbableSymlinks(files, getCanonicalFileName, host) {
+ var symlinks = ts.mapDefined(files, function (sf) {
+ return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) {
+ return res && res.originalPath && res.resolvedFileName !== res.originalPath ? [res.resolvedFileName, res.originalPath] : undefined;
+ });
+ });
+ var result = ts.createMap();
+ if (symlinks) {
+ var currentDirectory = host.getCurrentDirectory ? host.getCurrentDirectory() : "";
+ for (var _i = 0, symlinks_1 = symlinks; _i < symlinks_1.length; _i++) {
+ var _a = symlinks_1[_i], resolvedPath = _a[0], originalPath = _a[1];
+ var resolvedParts = ts.getPathComponents(ts.toPath(resolvedPath, currentDirectory, getCanonicalFileName));
+ var originalParts = ts.getPathComponents(ts.toPath(originalPath, currentDirectory, getCanonicalFileName));
+ while (resolvedParts[resolvedParts.length - 1] === originalParts[originalParts.length - 1]) {
+ resolvedParts.pop();
+ originalParts.pop();
+ }
+ result.set(ts.getPathFromPathComponents(originalParts), ts.getPathFromPathComponents(resolvedParts));
+ }
+ }
+ return result;
+ }
+ function getAllModulePathsUsingIndirectSymlinks(files, target, getCanonicalFileName, host) {
+ var links = discoverProbableSymlinks(files, getCanonicalFileName, host);
+ var paths = ts.arrayFrom(links.keys());
+ var options;
+ var compareStrings = (!host.useCaseSensitiveFileNames || host.useCaseSensitiveFileNames()) ? ts.compareStringsCaseSensitive : ts.compareStringsCaseInsensitive;
+ for (var _i = 0, paths_2 = paths; _i < paths_2.length; _i++) {
+ var path = paths_2[_i];
+ var resolved = links.get(path);
+ if (compareStrings(target.slice(0, resolved.length + 1), resolved + "/") === 0) {
+ var relative = ts.getRelativePathFromDirectory(resolved, target, getCanonicalFileName);
+ var option = ts.resolvePath(path, relative);
+ if (!host.fileExists || host.fileExists(option)) {
+ if (!options)
+ options = [];
+ options.push(option);
+ }
+ }
+ }
+ if (options) {
+ options.push(target);
+ return options;
+ }
+ return [target];
+ }
+ function getAllModulePaths(files, _a, getCanonicalFileName, host) {
var fileName = _a.fileName;
- var symlinks = ts.mapDefined(program.getSourceFiles(), function (sf) {
+ var symlinks = ts.mapDefined(files, function (sf) {
return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) {
return res && res.resolvedFileName === fileName ? res.originalPath : undefined;
});
});
- return symlinks.length === 0 ? [fileName] : symlinks;
+ return symlinks.length === 0 ? getAllModulePathsUsingIndirectSymlinks(files, ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory ? host.getCurrentDirectory() : ""), getCanonicalFileName, host) : symlinks;
}
function getRelativePathNParents(relativePath) {
var components = ts.getPathComponents(relativePath);
@@ -69501,6 +69904,14 @@ var ts;
var configFileCache = createConfigFileCache(compilerHost);
var context = createBuildContext(defaultOptions);
var existingWatchersForWildcards = ts.createMap();
+ var upToDateHost = {
+ fileExists: function (fileName) { return compilerHost.fileExists(fileName); },
+ getModifiedTime: function (fileName) { return compilerHost.getModifiedTime(fileName); },
+ getUnchangedTime: function (fileName) { return context.unchangedOutputs.getValueOrUndefined(fileName); },
+ getLastStatus: function (fileName) { return context.projectStatus.getValueOrUndefined(fileName); },
+ setLastStatus: function (fileName, status) { return context.projectStatus.setValue(fileName, status); },
+ parseConfigFile: function (configFilePath) { return configFileCache.parseConfigFile(configFilePath); }
+ };
return {
buildAllProjects: buildAllProjects,
getUpToDateStatus: getUpToDateStatus,
@@ -69572,16 +69983,7 @@ var ts;
return getBuildGraph(rootNames);
}
function getUpToDateStatus(project) {
- if (project === undefined) {
- return { type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
- }
- var prior = context.projectStatus.getValueOrUndefined(project.options.configFilePath);
- if (prior !== undefined) {
- return prior;
- }
- var actual = getUpToDateStatusWorker(project);
- context.projectStatus.setValue(project.options.configFilePath, actual);
- return actual;
+ return ts.getUpToDateStatus(upToDateHost, project);
}
function invalidateProject(configFileName) {
var resolved = resolveProjectName(configFileName);
@@ -69596,7 +69998,6 @@ var ts;
queueBuildForDownstreamReferences(resolved);
}
function queueBuildForDownstreamReferences(root) {
- debugger;
var deps = graph.dependencyMap.getReferencesTo(root);
for (var _i = 0, deps_1 = deps; _i < deps_1.length; _i++) {
var ref = deps_1[_i];
@@ -69638,139 +70039,6 @@ var ts;
buildSingleProject(next);
}
}
- function getAllProjectOutputs(project) {
- if (project.options.outFile) {
- return getOutFileOutputs(project);
- }
- else {
- var outputs = [];
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
- var inputFile = _a[_i];
- outputs.push.apply(outputs, getOutputFileNames(inputFile, project));
- }
- return outputs;
- }
- }
- function getUpToDateStatusWorker(project) {
- var newestInputFileName = undefined;
- var newestInputFileTime = minimumDate;
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
- var inputFile = _a[_i];
- if (!compilerHost.fileExists(inputFile)) {
- return {
- type: UpToDateStatusType.Unbuildable,
- reason: inputFile + " does not exist"
- };
- }
- var inputTime = compilerHost.getModifiedTime(inputFile);
- if (inputTime > newestInputFileTime) {
- newestInputFileName = inputFile;
- newestInputFileTime = inputTime;
- }
- }
- var outputs = getAllProjectOutputs(project);
- if (outputs.length === 0) {
- return {
- type: UpToDateStatusType.ContainerOnly
- };
- }
- var oldestOutputFileName = "(none)";
- var oldestOutputFileTime = maximumDate;
- var newestOutputFileName = "(none)";
- var newestOutputFileTime = minimumDate;
- var missingOutputFileName;
- var newestDeclarationFileContentChangedTime = minimumDate;
- var isOutOfDateWithInputs = false;
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
- var output = outputs_1[_b];
- if (!compilerHost.fileExists(output)) {
- missingOutputFileName = output;
- break;
- }
- var outputTime = compilerHost.getModifiedTime(output);
- if (outputTime < oldestOutputFileTime) {
- oldestOutputFileTime = outputTime;
- oldestOutputFileName = output;
- }
- if (outputTime < newestInputFileTime) {
- isOutOfDateWithInputs = true;
- break;
- }
- if (outputTime > newestOutputFileTime) {
- newestOutputFileTime = outputTime;
- newestOutputFileName = output;
- }
- if (isDeclarationFile(output)) {
- var unchangedTime = context.unchangedOutputs.getValueOrUndefined(output);
- if (unchangedTime !== undefined) {
- newestDeclarationFileContentChangedTime = newer(unchangedTime, newestDeclarationFileContentChangedTime);
- }
- else {
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, compilerHost.getModifiedTime(output));
- }
- }
- }
- var pseudoUpToDate = false;
- var usesPrepend = false;
- if (project.projectReferences) {
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
- var ref = _d[_c];
- usesPrepend = usesPrepend || !!(ref.prepend);
- var resolvedRef = ts.resolveProjectReferencePath(compilerHost, ref);
- var refStatus = getUpToDateStatus(configFileCache.parseConfigFile(resolvedRef));
- if (refStatus.type === UpToDateStatusType.Unbuildable) {
- return {
- type: UpToDateStatusType.UpstreamBlocked,
- upstreamProjectName: ref.path
- };
- }
- if (refStatus.type !== UpToDateStatusType.UpToDate) {
- return {
- type: UpToDateStatusType.UpstreamOutOfDate,
- upstreamProjectName: ref.path
- };
- }
- if (refStatus.newestInputFileTime <= oldestOutputFileTime) {
- continue;
- }
- if (refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
- pseudoUpToDate = true;
- continue;
- }
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
- return {
- type: UpToDateStatusType.OutOfDateWithUpstream,
- outOfDateOutputFileName: oldestOutputFileName,
- newerProjectName: ref.path
- };
- }
- }
- if (missingOutputFileName !== undefined) {
- return {
- type: UpToDateStatusType.OutputMissing,
- missingOutputFileName: missingOutputFileName
- };
- }
- if (isOutOfDateWithInputs) {
- return {
- type: UpToDateStatusType.OutOfDateWithSelf,
- outOfDateOutputFileName: oldestOutputFileName,
- newerInputFileName: newestInputFileName
- };
- }
- if (usesPrepend) {
- pseudoUpToDate = false;
- }
- return {
- type: pseudoUpToDate ? UpToDateStatusType.UpToDateWithUpstreamTypes : UpToDateStatusType.UpToDate,
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
- newestInputFileTime: newestInputFileTime,
- newestOutputFileTime: newestOutputFileTime,
- newestInputFileName: newestInputFileName,
- newestOutputFileName: newestOutputFileName,
- oldestOutputFileName: oldestOutputFileName
- };
- }
function createDependencyGraph(roots) {
var temporaryMarks = {};
var permanentMarks = {};
@@ -69908,8 +70176,8 @@ var ts;
var now = new Date();
var outputs = getAllProjectOutputs(proj);
var priorNewestUpdateTime = minimumDate;
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
- var file = outputs_2[_i];
+ for (var _i = 0, outputs_1 = outputs; _i < outputs_1.length; _i++) {
+ var file = outputs_1[_i];
if (isDeclarationFile(file)) {
priorNewestUpdateTime = newer(priorNewestUpdateTime, compilerHost.getModifiedTime(file));
}
@@ -69932,8 +70200,8 @@ var ts;
continue;
}
var outputs = getAllProjectOutputs(parsed);
- for (var _b = 0, outputs_3 = outputs; _b < outputs_3.length; _b++) {
- var output = outputs_3[_b];
+ for (var _b = 0, outputs_2 = outputs; _b < outputs_2.length; _b++) {
+ var output = outputs_2[_b];
if (compilerHost.fileExists(output)) {
filesToDelete.push(output);
}
@@ -70052,37 +70320,202 @@ var ts;
function relName(path) {
return ts.convertToRelativePath(path, compilerHost.getCurrentDirectory(), function (f) { return compilerHost.getCanonicalFileName(f); });
}
+ function reportVerbose(message) {
+ var args = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ args[_i - 1] = arguments[_i];
+ }
+ buildHost.verbose.apply(buildHost, [message].concat(args));
+ }
function verboseReportProjectStatus(configFileName, status) {
if (!context.options.verbose)
return;
- switch (status.type) {
- case UpToDateStatusType.OutOfDateWithSelf:
- return buildHost.verbose(ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(configFileName), relName(status.outOfDateOutputFileName), relName(status.newerInputFileName));
- case UpToDateStatusType.OutOfDateWithUpstream:
- return buildHost.verbose(ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(configFileName), relName(status.outOfDateOutputFileName), relName(status.newerProjectName));
- case UpToDateStatusType.OutputMissing:
- return buildHost.verbose(ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(configFileName), relName(status.missingOutputFileName));
- case UpToDateStatusType.UpToDate:
- if (status.newestInputFileTime !== undefined) {
- return buildHost.verbose(ts.Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relName(configFileName), relName(status.newestInputFileName), relName(status.oldestOutputFileName));
- }
- break;
- case UpToDateStatusType.UpToDateWithUpstreamTypes:
- return buildHost.verbose(ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(configFileName));
- case UpToDateStatusType.UpstreamOutOfDate:
- return buildHost.verbose(ts.Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, relName(configFileName), relName(status.upstreamProjectName));
- case UpToDateStatusType.UpstreamBlocked:
- return buildHost.verbose(ts.Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, relName(configFileName), relName(status.upstreamProjectName));
- case UpToDateStatusType.Unbuildable:
- return buildHost.verbose(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(configFileName), status.reason);
- case UpToDateStatusType.ContainerOnly:
- break;
- default:
- ts.assertTypeIsNever(status);
- }
+ return formatUpToDateStatus(configFileName, status, relName, reportVerbose);
}
}
ts.createSolutionBuilder = createSolutionBuilder;
+ function getUpToDateStatus(host, project) {
+ if (project === undefined) {
+ return {
+ type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build"
+ };
+ }
+ if (project === undefined) {
+ return { type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
+ }
+ var prior = host.getLastStatus ? host.getLastStatus(project.options.configFilePath) : undefined;
+ if (prior !== undefined) {
+ return prior;
+ }
+ var actual = getUpToDateStatusWorker(host, project);
+ if (host.setLastStatus) {
+ host.setLastStatus(project.options.configFilePath, actual);
+ }
+ return actual;
+ }
+ ts.getUpToDateStatus = getUpToDateStatus;
+ function getUpToDateStatusWorker(host, project) {
+ var newestInputFileName = undefined;
+ var newestInputFileTime = minimumDate;
+ for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
+ var inputFile = _a[_i];
+ if (!host.fileExists(inputFile)) {
+ return {
+ type: UpToDateStatusType.Unbuildable,
+ reason: inputFile + " does not exist"
+ };
+ }
+ var inputTime = host.getModifiedTime(inputFile);
+ if (inputTime > newestInputFileTime) {
+ newestInputFileName = inputFile;
+ newestInputFileTime = inputTime;
+ }
+ }
+ var outputs = getAllProjectOutputs(project);
+ if (outputs.length === 0) {
+ return {
+ type: UpToDateStatusType.ContainerOnly
+ };
+ }
+ var oldestOutputFileName = "(none)";
+ var oldestOutputFileTime = maximumDate;
+ var newestOutputFileName = "(none)";
+ var newestOutputFileTime = minimumDate;
+ var missingOutputFileName;
+ var newestDeclarationFileContentChangedTime = minimumDate;
+ var isOutOfDateWithInputs = false;
+ for (var _b = 0, outputs_3 = outputs; _b < outputs_3.length; _b++) {
+ var output = outputs_3[_b];
+ if (!host.fileExists(output)) {
+ missingOutputFileName = output;
+ break;
+ }
+ var outputTime = host.getModifiedTime(output);
+ if (outputTime < oldestOutputFileTime) {
+ oldestOutputFileTime = outputTime;
+ oldestOutputFileName = output;
+ }
+ if (outputTime < newestInputFileTime) {
+ isOutOfDateWithInputs = true;
+ break;
+ }
+ if (outputTime > newestOutputFileTime) {
+ newestOutputFileTime = outputTime;
+ newestOutputFileName = output;
+ }
+ if (isDeclarationFile(output)) {
+ var unchangedTime = host.getUnchangedTime ? host.getUnchangedTime(output) : undefined;
+ if (unchangedTime !== undefined) {
+ newestDeclarationFileContentChangedTime = newer(unchangedTime, newestDeclarationFileContentChangedTime);
+ }
+ else {
+ newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, host.getModifiedTime(output));
+ }
+ }
+ }
+ var pseudoUpToDate = false;
+ var usesPrepend = false;
+ if (project.projectReferences && host.parseConfigFile) {
+ for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
+ var ref = _d[_c];
+ usesPrepend = usesPrepend || !!(ref.prepend);
+ var resolvedRef = ts.resolveProjectReferencePath(host, ref);
+ var refStatus = getUpToDateStatus(host, host.parseConfigFile(resolvedRef));
+ if (refStatus.type === UpToDateStatusType.Unbuildable) {
+ return {
+ type: UpToDateStatusType.UpstreamBlocked,
+ upstreamProjectName: ref.path
+ };
+ }
+ if (refStatus.type !== UpToDateStatusType.UpToDate) {
+ return {
+ type: UpToDateStatusType.UpstreamOutOfDate,
+ upstreamProjectName: ref.path
+ };
+ }
+ if (refStatus.newestInputFileTime <= oldestOutputFileTime) {
+ continue;
+ }
+ if (refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
+ pseudoUpToDate = true;
+ continue;
+ }
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
+ return {
+ type: UpToDateStatusType.OutOfDateWithUpstream,
+ outOfDateOutputFileName: oldestOutputFileName,
+ newerProjectName: ref.path
+ };
+ }
+ }
+ if (missingOutputFileName !== undefined) {
+ return {
+ type: UpToDateStatusType.OutputMissing,
+ missingOutputFileName: missingOutputFileName
+ };
+ }
+ if (isOutOfDateWithInputs) {
+ return {
+ type: UpToDateStatusType.OutOfDateWithSelf,
+ outOfDateOutputFileName: oldestOutputFileName,
+ newerInputFileName: newestInputFileName
+ };
+ }
+ if (usesPrepend) {
+ pseudoUpToDate = false;
+ }
+ return {
+ type: pseudoUpToDate ? UpToDateStatusType.UpToDateWithUpstreamTypes : UpToDateStatusType.UpToDate,
+ newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
+ newestInputFileTime: newestInputFileTime,
+ newestOutputFileTime: newestOutputFileTime,
+ newestInputFileName: newestInputFileName,
+ newestOutputFileName: newestOutputFileName,
+ oldestOutputFileName: oldestOutputFileName
+ };
+ }
+ function getAllProjectOutputs(project) {
+ if (project.options.outFile) {
+ return getOutFileOutputs(project);
+ }
+ else {
+ var outputs = [];
+ for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
+ var inputFile = _a[_i];
+ outputs.push.apply(outputs, getOutputFileNames(inputFile, project));
+ }
+ return outputs;
+ }
+ }
+ ts.getAllProjectOutputs = getAllProjectOutputs;
+ function formatUpToDateStatus(configFileName, status, relName, formatMessage) {
+ switch (status.type) {
+ case UpToDateStatusType.OutOfDateWithSelf:
+ return formatMessage(ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(configFileName), relName(status.outOfDateOutputFileName), relName(status.newerInputFileName));
+ case UpToDateStatusType.OutOfDateWithUpstream:
+ return formatMessage(ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(configFileName), relName(status.outOfDateOutputFileName), relName(status.newerProjectName));
+ case UpToDateStatusType.OutputMissing:
+ return formatMessage(ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(configFileName), relName(status.missingOutputFileName));
+ case UpToDateStatusType.UpToDate:
+ if (status.newestInputFileTime !== undefined) {
+ return formatMessage(ts.Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relName(configFileName), relName(status.newestInputFileName), relName(status.oldestOutputFileName));
+ }
+ break;
+ case UpToDateStatusType.UpToDateWithUpstreamTypes:
+ return formatMessage(ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(configFileName));
+ case UpToDateStatusType.UpstreamOutOfDate:
+ return formatMessage(ts.Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, relName(configFileName), relName(status.upstreamProjectName));
+ case UpToDateStatusType.UpstreamBlocked:
+ return formatMessage(ts.Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, relName(configFileName), relName(status.upstreamProjectName));
+ case UpToDateStatusType.Unbuildable:
+ return formatMessage(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(configFileName), status.reason);
+ case UpToDateStatusType.ContainerOnly:
+ break;
+ default:
+ ts.assertTypeIsNever(status);
+ }
+ }
+ ts.formatUpToDateStatus = formatUpToDateStatus;
})(ts || (ts = {}));
//# sourceMappingURL=compiler.release.js.map
var ts;
@@ -70375,4 +70808,3 @@ if (ts.sys.setBlocking) {
ts.sys.setBlocking();
}
ts.executeCommandLine(ts.sys.args);
-//# sourceMappingURL=tsc.js.map
\ No newline at end of file
diff --git a/lib/tsserver.js b/lib/tsserver.js
index 47de11d43f..de09a6a2e0 100644
--- a/lib/tsserver.js
+++ b/lib/tsserver.js
@@ -2349,20 +2349,21 @@ var ts;
SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 292] = "JSDocCallbackTag";
SyntaxKind[SyntaxKind["JSDocParameterTag"] = 293] = "JSDocParameterTag";
SyntaxKind[SyntaxKind["JSDocReturnTag"] = 294] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 295] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 296] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 297] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 298] = "JSDocPropertyTag";
+ SyntaxKind[SyntaxKind["JSDocThisTag"] = 295] = "JSDocThisTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 296] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 297] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 298] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 299] = "JSDocPropertyTag";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 299] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 300] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 300] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 301] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["CommaListExpression"] = 302] = "CommaListExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 303] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 304] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 301] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 302] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["CommaListExpression"] = 303] = "CommaListExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 304] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 305] = "EndOfDeclarationMarker";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 305] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 306] = "Count";
// Markers
SyntaxKind[SyntaxKind["FirstAssignment"] = 58] = "FirstAssignment";
SyntaxKind[SyntaxKind["LastAssignment"] = 70] = "LastAssignment";
@@ -2390,9 +2391,9 @@ var ts;
SyntaxKind[SyntaxKind["LastBinaryOperator"] = 70] = "LastBinaryOperator";
SyntaxKind[SyntaxKind["FirstNode"] = 146] = "FirstNode";
SyntaxKind[SyntaxKind["FirstJSDocNode"] = 278] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 298] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 299] = "LastJSDocNode";
SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 289] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 298] = "LastJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 299] = "LastJSDocTagNode";
/* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 117] = "FirstContextualKeyword";
/* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 145] = "LastContextualKeyword";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
@@ -4476,7 +4477,7 @@ var ts;
}
})(ts || (ts = {}));
//
-// generated from './diagnosticInformationMap.generated.ts' by 'src\compiler'
+// generated from './diagnosticInformationMap.generated.ts' by 'src/compiler'
/* @internal */
var ts;
(function (ts) {
@@ -5438,7 +5439,7 @@ var ts;
Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0: diag(7035, ts.DiagnosticCategory.Error, "Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_mod_7035", "Try `npm install @types/{0}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`"),
Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0: diag(7036, ts.DiagnosticCategory.Error, "Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036", "Dynamic import's specifier must be of type 'string', but here has type '{0}'."),
Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports: diag(7037, ts.DiagnosticCategory.Message, "Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037", "Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'."),
- A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime: diag(7038, ts.DiagnosticCategory.Error, "A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038", "A namespace-style import cannot be called or constructed, and will cause a failure at runtime."),
+ 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: diag(7038, ts.DiagnosticCategory.Error, "Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cau_7038", "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."),
Mapped_object_type_implicitly_has_an_any_template_type: diag(7039, ts.DiagnosticCategory.Error, "Mapped_object_type_implicitly_has_an_any_template_type_7039", "Mapped object type implicitly has an 'any' template type."),
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
@@ -7882,7 +7883,7 @@ var ts;
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 299 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 300 /* SyntaxList */ && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -8099,7 +8100,7 @@ var ts;
case 205 /* ClassExpression */:
case 236 /* InterfaceDeclaration */:
case 237 /* TypeAliasDeclaration */:
- case 296 /* JSDocTemplateTag */:
+ case 297 /* JSDocTemplateTag */:
case 234 /* FunctionDeclaration */:
case 154 /* MethodDeclaration */:
case 155 /* Constructor */:
@@ -8108,7 +8109,7 @@ var ts;
case 192 /* FunctionExpression */:
case 193 /* ArrowFunction */:
case 292 /* JSDocCallbackTag */:
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
case 288 /* JSDocSignature */:
return true;
default:
@@ -8207,7 +8208,7 @@ var ts;
return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3);
}
ts.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile;
- function createDiagnosticForNodeFromMessageChain(node, messageChain) {
+ function createDiagnosticForNodeFromMessageChain(node, messageChain, relatedInformation) {
var sourceFile = getSourceFileOfNode(node);
var span = getErrorSpanForNode(sourceFile, node);
return {
@@ -8216,7 +8217,8 @@ var ts;
length: span.length,
code: messageChain.code,
category: messageChain.category,
- messageText: messageChain.next ? messageChain : messageChain.messageText
+ messageText: messageChain.next ? messageChain : messageChain.messageText,
+ relatedInformation: relatedInformation
};
}
ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;
@@ -9126,6 +9128,12 @@ var ts;
return node.initializer;
}
ts.getEffectiveInitializer = getEffectiveInitializer;
+ /** Get the declaration initializer when it is container-like (See getJavascriptInitializer). */
+ function getDeclaredJavascriptInitializer(node) {
+ var init = getEffectiveInitializer(node);
+ return init && getJavascriptInitializer(init, isPrototypeAccess(node.name));
+ }
+ ts.getDeclaredJavascriptInitializer = getDeclaredJavascriptInitializer;
/**
* 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.
@@ -9373,7 +9381,7 @@ var ts;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 297 /* JSDocTypedefTag */ || node.kind === 292 /* JSDocCallbackTag */;
+ return node.kind === 298 /* JSDocTypedefTag */ || node.kind === 292 /* JSDocCallbackTag */;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -9446,7 +9454,12 @@ var ts;
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 58 /* EqualsToken */ ||
ts.isBinaryExpression(parent) && parent.operatorToken.kind === 58 /* EqualsToken */ ||
node.kind === 185 /* PropertyAccessExpression */ && node.parent && node.parent.kind === 216 /* ExpressionStatement */) {
- getJSDocCommentsAndTagsWorker(parent);
+ if (ts.isBinaryExpression(parent)) {
+ getJSDocCommentsAndTagsWorker(parent.parent);
+ }
+ else {
+ getJSDocCommentsAndTagsWorker(parent);
+ }
}
// Pull parameter comments from declaring function as well
if (node.kind === 149 /* Parameter */) {
@@ -10040,7 +10053,7 @@ var ts;
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 302 /* CommaListExpression */:
+ case 303 /* CommaListExpression */:
return 0;
case 204 /* SpreadElement */:
return 1;
@@ -10356,8 +10369,8 @@ var ts;
decreaseIndent: function () { indent--; },
getIndent: function () { return indent; },
getTextPos: function () { return output.length; },
- getLine: function () { return lineCount + 1; },
- getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; },
+ getLine: function () { return lineCount; },
+ getColumn: function () { return lineStart ? indent * getIndentSize() : output.length - linePos; },
getText: function () { return output; },
isAtStartOfLine: function () { return lineStart; },
clear: reset,
@@ -11521,6 +11534,8 @@ var ts;
switch (options.target) {
case 6 /* ESNext */:
return "lib.esnext.full.d.ts";
+ case 5 /* ES2018 */:
+ return "lib.es2018.full.d.ts";
case 4 /* ES2017 */:
return "lib.es2017.full.d.ts";
case 3 /* ES2016 */:
@@ -11997,7 +12012,7 @@ var ts;
break;
case 71 /* Identifier */:
return declaration;
- case 298 /* JSDocPropertyTag */:
+ case 299 /* JSDocPropertyTag */:
case 293 /* JSDocParameterTag */: {
var name = declaration.name;
if (name.kind === 146 /* QualifiedName */) {
@@ -12019,7 +12034,7 @@ var ts;
}
case 292 /* JSDocCallbackTag */:
return declaration.name;
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
return getNameOfJSDocTypedef(declaration);
case 249 /* ExportAssignment */: {
var expression = declaration.expression;
@@ -12097,6 +12112,11 @@ var ts;
return getFirstJSDocTag(node, ts.isJSDocClassTag);
}
ts.getJSDocClassTag = getJSDocClassTag;
+ /** Gets the JSDoc this tag for the node if present */
+ function getJSDocThisTag(node) {
+ return getFirstJSDocTag(node, ts.isJSDocThisTag);
+ }
+ ts.getJSDocThisTag = getJSDocThisTag;
/** Gets the JSDoc return tag for the node if present */
function getJSDocReturnTag(node) {
return getFirstJSDocTag(node, ts.isJSDocReturnTag);
@@ -12405,7 +12425,7 @@ var ts;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 301 /* PartiallyEmittedExpression */) {
+ while (node.kind === 302 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
@@ -12808,6 +12828,10 @@ var ts;
return node.kind === 291 /* JSDocClassTag */;
}
ts.isJSDocClassTag = isJSDocClassTag;
+ function isJSDocThisTag(node) {
+ return node.kind === 295 /* JSDocThisTag */;
+ }
+ ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
return node.kind === 293 /* JSDocParameterTag */;
}
@@ -12817,23 +12841,23 @@ var ts;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 295 /* JSDocTypeTag */;
+ return node.kind === 296 /* JSDocTypeTag */;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 296 /* JSDocTemplateTag */;
+ return node.kind === 297 /* JSDocTemplateTag */;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 297 /* JSDocTypedefTag */;
+ return node.kind === 298 /* JSDocTypedefTag */;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 298 /* JSDocPropertyTag */;
+ return node.kind === 299 /* JSDocPropertyTag */;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 298 /* JSDocPropertyTag */ || node.kind === 293 /* JSDocParameterTag */;
+ return node.kind === 299 /* JSDocPropertyTag */ || node.kind === 293 /* JSDocParameterTag */;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
@@ -12856,7 +12880,7 @@ var ts;
(function (ts) {
/* @internal */
function isSyntaxList(n) {
- return n.kind === 299 /* SyntaxList */;
+ return n.kind === 300 /* SyntaxList */;
}
ts.isSyntaxList = isSyntaxList;
/* @internal */
@@ -13321,8 +13345,8 @@ var ts;
case 204 /* SpreadElement */:
case 208 /* AsExpression */:
case 206 /* OmittedExpression */:
- case 302 /* CommaListExpression */:
- case 301 /* PartiallyEmittedExpression */:
+ case 303 /* CommaListExpression */:
+ case 302 /* PartiallyEmittedExpression */:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -13336,12 +13360,12 @@ var ts;
ts.isAssertionExpression = isAssertionExpression;
/* @internal */
function isPartiallyEmittedExpression(node) {
- return node.kind === 301 /* PartiallyEmittedExpression */;
+ return node.kind === 302 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
/* @internal */
function isNotEmittedStatement(node) {
- return node.kind === 300 /* NotEmittedStatement */;
+ return node.kind === 301 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
/* @internal */
@@ -13452,9 +13476,9 @@ var ts;
|| kind === 237 /* TypeAliasDeclaration */
|| kind === 148 /* TypeParameter */
|| kind === 232 /* VariableDeclaration */
- || kind === 297 /* JSDocTypedefTag */
+ || kind === 298 /* JSDocTypedefTag */
|| kind === 292 /* JSDocCallbackTag */
- || kind === 298 /* JSDocPropertyTag */;
+ || kind === 299 /* JSDocPropertyTag */;
}
function isDeclarationStatementKind(kind) {
return kind === 234 /* FunctionDeclaration */
@@ -13489,14 +13513,14 @@ var ts;
|| kind === 214 /* VariableStatement */
|| kind === 219 /* WhileStatement */
|| kind === 226 /* WithStatement */
- || kind === 300 /* NotEmittedStatement */
- || kind === 304 /* EndOfDeclarationMarker */
- || kind === 303 /* MergeDeclarationMarker */;
+ || kind === 301 /* NotEmittedStatement */
+ || kind === 305 /* EndOfDeclarationMarker */
+ || kind === 304 /* MergeDeclarationMarker */;
}
/* @internal */
function isDeclaration(node) {
if (node.kind === 148 /* TypeParameter */) {
- return node.parent.kind !== 296 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node);
+ return node.parent.kind !== 297 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -13591,7 +13615,7 @@ var ts;
/** True if node is of some JSDoc syntax kind. */
/* @internal */
function isJSDocNode(node) {
- return node.kind >= 278 /* FirstJSDocNode */ && node.kind <= 298 /* LastJSDocNode */;
+ return node.kind >= 278 /* FirstJSDocNode */ && node.kind <= 299 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
/** True if node is of a kind that may contain comment text. */
@@ -13602,7 +13626,7 @@ var ts;
// TODO: determine what this does before making it public.
/* @internal */
function isJSDocTag(node) {
- return node.kind >= 289 /* FirstJSDocTagNode */ && node.kind <= 298 /* LastJSDocTagNode */;
+ return node.kind >= 289 /* FirstJSDocTagNode */ && node.kind <= 299 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
@@ -14905,7 +14929,7 @@ var ts;
}
ts.isAnySupportedFileExtension = isAnySupportedFileExtension;
function tryGetExtensionFromPath(path) {
- return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (e) { return ts.fileExtensionIs(path, e); }) || ts.find(ts.supportedJavascriptExtensions, function (e) { return ts.fileExtensionIs(path, e); });
+ return ts.find(extensionsToRemove, function (e) { return ts.fileExtensionIs(path, e); });
}
ts.tryGetExtensionFromPath = tryGetExtensionFromPath;
function getAnyExtensionFromPathWorker(path, extensions, stringEqualityComparer) {
@@ -15384,7 +15408,7 @@ var ts;
return visitNode(cbNode, node.expression);
case 253 /* MissingDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 302 /* CommaListExpression */:
+ case 303 /* CommaListExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
case 255 /* JsxElement */:
return visitNode(cbNode, node.openingElement) ||
@@ -15427,7 +15451,7 @@ var ts;
case 286 /* JSDocComment */:
return visitNodes(cbNode, cbNodes, node.tags);
case 293 /* JSDocParameterTag */:
- case 298 /* JSDocPropertyTag */:
+ case 299 /* JSDocPropertyTag */:
if (node.isNameFirst) {
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression);
@@ -15438,13 +15462,13 @@ var ts;
}
case 294 /* JSDocReturnTag */:
return visitNode(cbNode, node.typeExpression);
- case 295 /* JSDocTypeTag */:
+ case 296 /* JSDocTypeTag */:
return visitNode(cbNode, node.typeExpression);
case 290 /* JSDocAugmentsTag */:
return visitNode(cbNode, node.class);
- case 296 /* JSDocTemplateTag */:
+ case 297 /* JSDocTemplateTag */:
return visitNodes(cbNode, cbNodes, node.typeParameters);
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
if (node.typeExpression &&
node.typeExpression.kind === 278 /* JSDocTypeExpression */) {
return visitNode(cbNode, node.typeExpression) ||
@@ -15457,6 +15481,8 @@ var ts;
case 292 /* JSDocCallbackTag */:
return visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
+ case 295 /* JSDocThisTag */:
+ return visitNode(cbNode, node.typeExpression);
case 288 /* JSDocSignature */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
@@ -15471,7 +15497,7 @@ var ts;
}
}
return;
- case 301 /* PartiallyEmittedExpression */:
+ case 302 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
}
}
@@ -20775,6 +20801,9 @@ var ts;
case "constructor":
tag = parseClassTag(atToken, tagName);
break;
+ case "this":
+ tag = parseThisTag(atToken, tagName);
+ break;
case "arg":
case "argument":
case "param":
@@ -20926,7 +20955,7 @@ var ts;
typeExpression = tryParseTypeExpression();
}
var result = target === 1 /* Property */ ?
- createNode(298 /* JSDocPropertyTag */, atToken.pos) :
+ createNode(299 /* JSDocPropertyTag */, atToken.pos) :
createNode(293 /* JSDocParameterTag */, atToken.pos);
var comment;
if (indent !== undefined)
@@ -20953,7 +20982,7 @@ var ts;
var start_2 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, name); })) {
- if (child.kind === 293 /* JSDocParameterTag */ || child.kind === 298 /* JSDocPropertyTag */) {
+ if (child.kind === 293 /* JSDocParameterTag */ || child.kind === 299 /* JSDocPropertyTag */) {
children = ts.append(children, child);
}
}
@@ -20979,10 +21008,10 @@ var ts;
return finishNode(result);
}
function parseTypeTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 295 /* JSDocTypeTag */; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 296 /* JSDocTypeTag */; })) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(295 /* JSDocTypeTag */, atToken.pos);
+ var result = createNode(296 /* JSDocTypeTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
@@ -21022,10 +21051,18 @@ var ts;
tag.tagName = tagName;
return finishNode(tag);
}
+ function parseThisTag(atToken, tagName) {
+ var tag = createNode(295 /* JSDocThisTag */, atToken.pos);
+ tag.atToken = atToken;
+ tag.tagName = tagName;
+ tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
+ skipWhitespace();
+ return finishNode(tag);
+ }
function parseTypedefTag(atToken, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespace();
- var typedefTag = createNode(297 /* JSDocTypedefTag */, atToken.pos);
+ var typedefTag = createNode(298 /* JSDocTypedefTag */, atToken.pos);
typedefTag.atToken = atToken;
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
@@ -21043,7 +21080,7 @@ var ts;
if (!jsdocTypeLiteral) {
jsdocTypeLiteral = createNode(287 /* JSDocTypeLiteral */, start_3);
}
- if (child.kind === 295 /* JSDocTypeTag */) {
+ if (child.kind === 296 /* JSDocTypeTag */) {
if (childTypeTag) {
break;
}
@@ -21227,7 +21264,7 @@ var ts;
if (constraint) {
ts.first(typeParameters).constraint = constraint.type;
}
- var result = createNode(296 /* JSDocTemplateTag */, atToken.pos);
+ var result = createNode(297 /* JSDocTemplateTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
@@ -22454,7 +22491,6 @@ var ts;
{
name: "sourceRoot",
type: "string",
- isFilePath: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
@@ -22462,7 +22498,6 @@ var ts;
{
name: "mapRoot",
type: "string",
- isFilePath: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -26011,7 +26046,7 @@ var ts;
case 187 /* CallExpression */:
bindCallExpressionFlow(node);
break;
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
case 292 /* JSDocCallbackTag */:
bindJSDocTypeAlias(node);
break;
@@ -26776,7 +26811,7 @@ var ts;
case 192 /* FunctionExpression */:
case 193 /* ArrowFunction */:
case 284 /* JSDocFunctionType */:
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
case 292 /* JSDocCallbackTag */:
case 237 /* TypeAliasDeclaration */:
case 177 /* MappedType */:
@@ -27394,13 +27429,13 @@ var ts;
break;
}
// falls through
- case 298 /* JSDocPropertyTag */:
+ case 299 /* JSDocPropertyTag */:
var propTag = node;
var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 283 /* JSDocOptionalType */ ?
4 /* Property */ | 16777216 /* Optional */ :
4 /* Property */;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */);
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
case 292 /* JSDocCallbackTag */:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
@@ -27481,17 +27516,21 @@ var ts;
}
}
function setCommonJsModuleIndicator(node) {
+ if (file.externalModuleIndicator) {
+ return false;
+ }
if (!file.commonJsModuleIndicator) {
file.commonJsModuleIndicator = node;
- if (!file.externalModuleIndicator) {
- bindSourceFileAsExternalModule();
- }
+ bindSourceFileAsExternalModule();
}
+ return true;
}
function bindExportsPropertyAssignment(node) {
// When we create a property via 'exports.foo = bar', the 'exports.foo' property access
// expression is the declaration
- setCommonJsModuleIndicator(node);
+ if (!setCommonJsModuleIndicator(node)) {
+ return;
+ }
var lhs = node.left;
var symbol = forEachIdentifierInEntityName(lhs.expression, /*parent*/ undefined, function (id, symbol) {
if (symbol) {
@@ -27511,14 +27550,14 @@ var ts;
// is still pointing to 'module.exports'.
// We do not want to consider this as 'export=' since a module can have only one of these.
// Similarly we do not want to treat 'module.exports = exports' as an 'export='.
+ if (!setCommonJsModuleIndicator(node)) {
+ return;
+ }
var assignedExpression = ts.getRightMostAssignedExpression(node.right);
if (ts.isEmptyObjectLiteral(assignedExpression) || container === file && isExportsOrModuleExportsOrAlias(file, assignedExpression)) {
- // Mark it as a module in case there are no other exports in the file
- setCommonJsModuleIndicator(node);
return;
}
// 'module.exports = expr' assignment
- setCommonJsModuleIndicator(node);
var flags = ts.exportAssignmentIsAlias(node)
? 2097152 /* Alias */
: 4 /* Property */ | 1048576 /* ExportValue */ | 512 /* ValueModule */;
@@ -27676,6 +27715,7 @@ var ts;
ts.isBinaryExpression(node) ? node.right :
ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) ? node.parent.right :
undefined;
+ init = init && ts.getRightMostAssignedExpression(init);
if (init) {
var isPrototypeAssignment = ts.isPrototypeAccess(ts.isVariableDeclaration(node) ? node.name : ts.isBinaryExpression(node) ? node.left : node);
return !!ts.getJavascriptInitializer(ts.isBinaryExpression(init) && init.operatorToken.kind === 54 /* BarBarToken */ ? init.right : init, isPrototypeAssignment);
@@ -28492,7 +28532,7 @@ var ts;
break;
case 190 /* TypeAssertionExpression */:
case 208 /* AsExpression */:
- case 301 /* PartiallyEmittedExpression */:
+ case 302 /* PartiallyEmittedExpression */:
// These nodes are TypeScript syntax.
transformFlags |= 3 /* AssertTypeScript */;
excludeFlags = 536872257 /* OuterExpressionExcludes */;
@@ -28767,7 +28807,7 @@ var ts;
return 940049729 /* BindingPatternExcludes */;
case 190 /* TypeAssertionExpression */:
case 208 /* AsExpression */:
- case 301 /* PartiallyEmittedExpression */:
+ case 302 /* PartiallyEmittedExpression */:
case 191 /* ParenthesizedExpression */:
case 97 /* SuperKeyword */:
return 536872257 /* OuterExpressionExcludes */;
@@ -29739,6 +29779,7 @@ var ts;
? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3)
: ts.createCompilerDiagnostic(message, arg0, arg1, arg2, arg3);
diagnostics.add(diagnostic);
+ return diagnostic;
}
function addErrorOrSuggestion(isError, diagnostic) {
if (isError) {
@@ -30326,7 +30367,7 @@ var ts;
location = location.parent;
}
break;
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
case 292 /* JSDocCallbackTag */:
// js type aliases do not resolve names from their host, so skip past it
location = ts.getJSDocHost(location);
@@ -32708,7 +32749,7 @@ var ts;
}
else {
var contextFile = ts.getSourceFileOfNode(ts.getOriginalNode(context.enclosingDeclaration));
- return "\"" + (file.moduleName || ts.moduleSpecifiers.getModuleSpecifier(compilerOptions, contextFile, contextFile.path, file.path, context.tracker.moduleResolverHost)) + "\"";
+ return "\"" + (file.moduleName || ts.moduleSpecifiers.getModuleSpecifiers(symbol, compilerOptions, contextFile, context.tracker.moduleResolverHost, context.tracker.moduleResolverHost.getSourceFiles(), { importModuleSpecifierPreference: "non-relative" })[0]) + "\"";
}
}
var declaration = symbol.declarations[0];
@@ -32753,7 +32794,7 @@ var ts;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
case 292 /* JSDocCallbackTag */:
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
// Top-level jsdoc type aliases are considered exported
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
@@ -33431,7 +33472,9 @@ var ts;
// binding pattern [x, s = ""]. Because the contextual type is a tuple type, the resulting type of [1, "one"] is the
// tuple type [number, string]. Thus, the type inferred for 'x' is number and the type inferred for 's' is string.
function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) {
- var type = getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true);
+ return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true), declaration, reportErrors);
+ }
+ function widenTypeForVariableLikeDeclaration(type, declaration, reportErrors) {
if (type) {
if (reportErrors) {
reportErrorsFromWidening(declaration, type);
@@ -33487,57 +33530,47 @@ var ts;
if (declaration.kind === 249 /* ExportAssignment */) {
return links.type = checkExpression(declaration.expression);
}
- if (ts.isInJavaScriptFile(declaration) && ts.isJSDocPropertyLikeTag(declaration) && declaration.typeExpression) {
- return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
- }
// Handle variable, parameter or property
if (!pushTypeResolution(symbol, 0 /* Type */)) {
return errorType;
}
- var type = void 0;
- // Handle certain special assignment kinds, which happen to union across multiple declarations:
- // * module.exports = expr
- // * exports.p = expr
- // * this.p = expr
- // * className.prototype.method = expr
- if (declaration.kind === 200 /* BinaryExpression */ ||
- declaration.kind === 185 /* PropertyAccessExpression */ && declaration.parent.kind === 200 /* BinaryExpression */) {
- type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol);
- }
- else if (ts.isJSDocPropertyLikeTag(declaration)
- || ts.isPropertyAccessExpression(declaration)
- || ts.isIdentifier(declaration)
- || ts.isClassDeclaration(declaration)
- || ts.isFunctionDeclaration(declaration)
- || (ts.isMethodDeclaration(declaration) && !ts.isObjectLiteralMethod(declaration))
- || ts.isMethodSignature(declaration)) {
- // Symbol is property of some kind that is merged with something - should use `getTypeOfFuncClassEnumModule` and not `getTypeOfVariableOrParameterOrProperty`
- if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) {
- return getTypeOfFuncClassEnumModule(symbol);
+ var type = getJSSpecialType(symbol, declaration);
+ if (!type) {
+ if (ts.isJSDocPropertyLikeTag(declaration)
+ || ts.isPropertyAccessExpression(declaration)
+ || ts.isIdentifier(declaration)
+ || ts.isClassDeclaration(declaration)
+ || ts.isFunctionDeclaration(declaration)
+ || (ts.isMethodDeclaration(declaration) && !ts.isObjectLiteralMethod(declaration))
+ || ts.isMethodSignature(declaration)) {
+ // Symbol is property of some kind that is merged with something - should use `getTypeOfFuncClassEnumModule` and not `getTypeOfVariableOrParameterOrProperty`
+ if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) {
+ return getTypeOfFuncClassEnumModule(symbol);
+ }
+ type = tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
+ }
+ else if (ts.isPropertyAssignment(declaration)) {
+ type = tryGetTypeFromEffectiveTypeNode(declaration) || checkPropertyAssignment(declaration);
+ }
+ else if (ts.isJsxAttribute(declaration)) {
+ type = tryGetTypeFromEffectiveTypeNode(declaration) || checkJsxAttribute(declaration);
+ }
+ else if (ts.isShorthandPropertyAssignment(declaration)) {
+ type = tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionForMutableLocation(declaration.name, 0 /* Normal */);
+ }
+ else if (ts.isObjectLiteralMethod(declaration)) {
+ type = tryGetTypeFromEffectiveTypeNode(declaration) || checkObjectLiteralMethod(declaration, 0 /* Normal */);
+ }
+ else if (ts.isParameter(declaration)
+ || ts.isPropertyDeclaration(declaration)
+ || ts.isPropertySignature(declaration)
+ || ts.isVariableDeclaration(declaration)
+ || ts.isBindingElement(declaration)) {
+ type = getWidenedTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true);
+ }
+ else {
+ return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.showSyntaxKind(declaration) + " for " + ts.Debug.showSymbol(symbol));
}
- type = tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
- }
- else if (ts.isPropertyAssignment(declaration)) {
- type = tryGetTypeFromEffectiveTypeNode(declaration) || checkPropertyAssignment(declaration);
- }
- else if (ts.isJsxAttribute(declaration)) {
- type = tryGetTypeFromEffectiveTypeNode(declaration) || checkJsxAttribute(declaration);
- }
- else if (ts.isShorthandPropertyAssignment(declaration)) {
- type = tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionForMutableLocation(declaration.name, 0 /* Normal */);
- }
- else if (ts.isObjectLiteralMethod(declaration)) {
- type = tryGetTypeFromEffectiveTypeNode(declaration) || checkObjectLiteralMethod(declaration, 0 /* Normal */);
- }
- else if (ts.isParameter(declaration)
- || ts.isPropertyDeclaration(declaration)
- || ts.isPropertySignature(declaration)
- || ts.isVariableDeclaration(declaration)
- || ts.isBindingElement(declaration)) {
- type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
- }
- else {
- return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.showSyntaxKind(declaration) + " for " + ts.Debug.showSymbol(symbol));
}
if (!popTypeResolution()) {
type = reportCircularityError(symbol);
@@ -33546,6 +33579,54 @@ var ts;
}
return links.type;
}
+ function getJSSpecialType(symbol, decl) {
+ if (!ts.isInJavaScriptFile(decl)) {
+ return undefined;
+ }
+ else if (ts.isJSDocPropertyLikeTag(decl) && decl.typeExpression) {
+ return getTypeFromTypeNode(decl.typeExpression.type);
+ }
+ // Handle certain special assignment kinds, which happen to union across multiple declarations:
+ // * module.exports = expr
+ // * exports.p = expr
+ // * this.p = expr
+ // * className.prototype.method = expr
+ else if (ts.isBinaryExpression(decl) ||
+ ts.isPropertyAccessExpression(decl) && ts.isBinaryExpression(decl.parent)) {
+ return getJSInitializerType(decl, symbol, ts.getAssignedJavascriptInitializer(ts.isBinaryExpression(decl) ? decl.left : decl)) ||
+ getWidenedTypeFromJSSpecialPropertyDeclarations(symbol);
+ }
+ else if (ts.isParameter(decl)
+ || ts.isPropertyDeclaration(decl)
+ || ts.isPropertySignature(decl)
+ || ts.isVariableDeclaration(decl)
+ || ts.isBindingElement(decl)) {
+ // Use type from type annotation if one is present
+ var isOptional = ts.isParameter(decl) && isJSDocOptionalParameter(decl) ||
+ !ts.isBindingElement(decl) && !ts.isVariableDeclaration(decl) && !!decl.questionToken;
+ var declaredType = tryGetTypeFromEffectiveTypeNode(decl);
+ return declaredType && addOptionality(declaredType, isOptional) ||
+ getJSInitializerType(decl, symbol, ts.getDeclaredJavascriptInitializer(decl)) ||
+ getWidenedTypeForVariableLikeDeclaration(decl, /*includeOptionality*/ true);
+ }
+ }
+ function getJSInitializerType(decl, symbol, init) {
+ if (init && ts.isInJavaScriptFile(init) && ts.isObjectLiteralExpression(init)) {
+ var exports_1 = ts.createSymbolTable();
+ while (ts.isBinaryExpression(decl) || ts.isPropertyAccessExpression(decl)) {
+ var s_1 = getSymbolOfNode(decl);
+ if (s_1 && ts.hasEntries(s_1.exports)) {
+ mergeSymbolTable(exports_1, s_1.exports);
+ }
+ decl = ts.isBinaryExpression(decl) ? decl.parent : decl.parent.parent;
+ }
+ var s = getSymbolOfNode(decl);
+ if (s && ts.hasEntries(s.exports)) {
+ mergeSymbolTable(exports_1, s.exports);
+ }
+ return createAnonymousType(symbol, exports_1, ts.emptyArray, ts.emptyArray, jsObjectLiteralIndexInfo, undefined);
+ }
+ }
function getAnnotatedAccessorType(accessor) {
if (accessor) {
if (accessor.kind === 156 /* GetAccessor */) {
@@ -33802,8 +33883,8 @@ var ts;
case 192 /* FunctionExpression */:
case 193 /* ArrowFunction */:
case 237 /* TypeAliasDeclaration */:
- case 296 /* JSDocTemplateTag */:
- case 297 /* JSDocTypedefTag */:
+ case 297 /* JSDocTemplateTag */:
+ case 298 /* JSDocTypedefTag */:
case 292 /* JSDocCallbackTag */:
case 177 /* MappedType */:
case 171 /* ConditionalType */:
@@ -38565,18 +38646,20 @@ var ts;
errorInfo = ts.concatenateDiagnosticMessageChains(chain_1, errorInfo);
}
}
- diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo)); // TODO: GH#18217
- }
- // Check if we should issue an extra diagnostic to produce a quickfix for a slightly incorrect import statement
- if (headMessage && errorNode && !result && source.symbol) {
- var links = getSymbolLinks(source.symbol);
- if (links.originatingImport && !ts.isImportCall(links.originatingImport)) {
- var helpfulRetry = checkTypeRelatedTo(getTypeOfSymbol(links.target), target, relation, /*errorNode*/ undefined);
- if (helpfulRetry) {
- // Likely an incorrect import. Issue a helpful diagnostic to produce a quickfix to change the import
- diagnostics.add(ts.createDiagnosticForNode(links.originatingImport, ts.Diagnostics.A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime));
+ var relatedInformation = void 0;
+ // Check if we should issue an extra diagnostic to produce a quickfix for a slightly incorrect import statement
+ if (headMessage && errorNode && !result && source.symbol) {
+ var links = getSymbolLinks(source.symbol);
+ if (links.originatingImport && !ts.isImportCall(links.originatingImport)) {
+ var helpfulRetry = checkTypeRelatedTo(getTypeOfSymbol(links.target), target, relation, /*errorNode*/ undefined);
+ if (helpfulRetry) {
+ // Likely an incorrect import. Issue a helpful diagnostic to produce a quickfix to change the import
+ var diag = ts.createDiagnosticForNode(links.originatingImport, ts.Diagnostics.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);
+ relatedInformation = ts.append(relatedInformation, diag); // Cause the error to appear with the error that triggered it
+ }
}
}
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, relatedInformation)); // TODO: GH#18217
}
return result !== 0 /* False */;
function reportError(message, arg0, arg1, arg2) {
@@ -40215,14 +40298,6 @@ var ts;
// widen accessor based properties here.
return prop;
}
- if (prop.flags & 67108864 /* JSContainer */) {
- var node = prop.declarations && ts.first(prop.declarations);
- var init = ts.getAssignedJavascriptInitializer(node);
- if (init && init.kind !== 184 /* ObjectLiteralExpression */) {
- // for JS special declarations, the only kind of initializer that will widen is object literals
- return prop;
- }
- }
var original = getTypeOfSymbol(prop);
var propContext = context && createWideningContext(context, prop.escapedName, /*siblings*/ undefined);
var widened = getWidenedTypeWithContext(original, propContext);
@@ -42690,6 +42765,10 @@ var ts;
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
}
}
+ var thisTag = ts.getJSDocThisTag(node);
+ if (thisTag && thisTag.typeExpression) {
+ return getTypeFromTypeNode(thisTag.typeExpression);
+ }
}
function isInConstructorArgumentInitializer(node, constructorDecl) {
return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : n.kind === 149 /* Parameter */; });
@@ -43744,18 +43823,6 @@ var ts;
var patternWithComputedProperties = false;
var hasComputedStringProperty = false;
var hasComputedNumberProperty = false;
- if (isInJSFile) {
- var decl = ts.getDeclarationOfJSInitializer(node);
- if (decl) {
- // a JS object literal whose declaration's symbol has exports is a JS namespace
- var symbol = getSymbolOfNode(decl);
- if (symbol && ts.hasEntries(symbol.exports)) {
- propertiesTable = symbol.exports;
- symbol.exports.forEach(function (s) { return propertiesArray.push(getMergedSymbol(s)); });
- return createObjectLiteralType();
- }
- }
- }
propertiesTable = ts.createSymbolTable();
var offset = 0;
for (var i = 0; i < node.properties.length; i++) {
@@ -46301,12 +46368,11 @@ var ts;
return true;
}
function invocationError(node, apparentType, kind) {
- error(node, kind === 0 /* Call */
+ invocationErrorRecovery(apparentType, kind, error(node, kind === 0 /* Call */
? ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures
- : ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature, typeToString(apparentType));
- invocationErrorRecovery(apparentType, kind);
+ : ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature, typeToString(apparentType)));
}
- function invocationErrorRecovery(apparentType, kind) {
+ function invocationErrorRecovery(apparentType, kind, diagnostic) {
if (!apparentType.symbol) {
return;
}
@@ -46317,7 +46383,8 @@ var ts;
var sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind);
if (!sigs || !sigs.length)
return;
- error(importNode, ts.Diagnostics.A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime);
+ diagnostic.relatedInformation = diagnostic.relatedInformation || [];
+ diagnostic.relatedInformation.push(ts.createDiagnosticForNode(importNode, ts.Diagnostics.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));
}
}
function resolveTaggedTemplateExpression(node, candidatesOutArray) {
@@ -46381,8 +46448,9 @@ var ts;
if (!callSignatures.length) {
var errorInfo = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType));
errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage);
- diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo));
- invocationErrorRecovery(apparentType, 0 /* Call */);
+ var diag = ts.createDiagnosticForNodeFromMessageChain(node, errorInfo);
+ diagnostics.add(diag);
+ invocationErrorRecovery(apparentType, 0 /* Call */, diag);
return resolveErrorCall(node);
}
return resolveCall(node, callSignatures, candidatesOutArray, headMessage);
@@ -47762,9 +47830,15 @@ var ts;
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
leftType;
case 58 /* EqualsToken */:
- checkSpecialAssignment(left, right);
- checkAssignmentOperator(rightType);
- return getRegularTypeOfObjectLiteral(rightType);
+ var special = ts.getSpecialPropertyAssignmentKind(left.parent);
+ checkSpecialAssignment(special, right);
+ if (isJSSpecialPropertyAssignment(special)) {
+ return leftType;
+ }
+ else {
+ checkAssignmentOperator(rightType);
+ return getRegularTypeOfObjectLiteral(rightType);
+ }
case 26 /* CommaToken */:
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right)) {
error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
@@ -47773,8 +47847,7 @@ var ts;
default:
return ts.Debug.fail();
}
- function checkSpecialAssignment(left, right) {
- var special = ts.getSpecialPropertyAssignmentKind(left.parent);
+ function checkSpecialAssignment(special, right) {
if (special === 2 /* ModuleExports */) {
var rightType_1 = checkExpression(right, checkMode);
for (var _i = 0, _a = getPropertiesOfObjectType(rightType_1); _i < _a.length; _i++) {
@@ -47835,6 +47908,22 @@ var ts;
}
}
}
+ function isJSSpecialPropertyAssignment(special) {
+ switch (special) {
+ case 1 /* ExportsProperty */:
+ case 2 /* ModuleExports */:
+ case 5 /* Property */:
+ case 6 /* Prototype */:
+ case 3 /* PrototypeProperty */:
+ case 4 /* ThisProperty */:
+ var symbol = getSymbolOfNode(left);
+ var init = ts.getAssignedJavascriptInitializer(right);
+ return init && ts.isObjectLiteralExpression(init) &&
+ symbol && ts.hasEntries(symbol.exports);
+ default:
+ return false;
+ }
+ }
function reportOperatorError() {
error(errorNode || operatorToken, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), typeToString(leftType), typeToString(rightType));
}
@@ -49164,7 +49253,7 @@ var ts;
case 236 /* InterfaceDeclaration */:
case 237 /* TypeAliasDeclaration */:
// A jsdoc typedef and callback are, by definition, type aliases
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
case 292 /* JSDocCallbackTag */:
return 2 /* ExportType */;
case 239 /* ModuleDeclaration */:
@@ -49649,6 +49738,9 @@ var ts;
}
checkSourceElement(node.typeExpression);
}
+ function checkJSDocTypeTag(node) {
+ checkSourceElement(node.typeExpression);
+ }
function checkJSDocParameterTag(node) {
checkSourceElement(node.typeExpression);
if (!ts.getParameterSymbolFromJSDoc(node)) {
@@ -49909,8 +50001,10 @@ var ts;
}
for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (ts.isAmbientModule(declaration))
+ if (ts.isAmbientModule(declaration) ||
+ (ts.isVariableDeclaration(declaration) && ts.isForInOrOfStatement(declaration.parent.parent) || isImportedDeclaration(declaration)) && isIdentifierThatStartsWithUnderScore(declaration.name)) {
continue;
+ }
if (isImportedDeclaration(declaration)) {
addToGroup(unusedImports, importClauseFromImported(declaration), declaration, getNodeId);
}
@@ -49922,9 +50016,7 @@ var ts;
}
}
else if (ts.isVariableDeclaration(declaration)) {
- if (!isIdentifierThatStartsWithUnderScore(declaration.name) || !ts.isForInOrOfStatement(declaration.parent.parent)) {
- addToGroup(unusedVariables, declaration.parent, declaration, getNodeId);
- }
+ addToGroup(unusedVariables, declaration.parent, declaration, getNodeId);
}
else {
var parameter = local.valueDeclaration && tryGetRootParameterDeclaration(local.valueDeclaration);
@@ -50332,9 +50424,15 @@ var ts;
// Node is the primary declaration of the symbol, just validate the initializer
// Don't validate for-in initializer as it is already an error
var initializer = ts.getEffectiveInitializer(node);
- if (initializer && node.parent.parent.kind !== 221 /* ForInStatement */) {
- checkTypeAssignableTo(checkExpressionCached(initializer), type, node, /*headMessage*/ undefined);
- checkParameterInitializer(node);
+ if (initializer) {
+ var isJSObjectLiteralInitializer = ts.isInJavaScriptFile(node) &&
+ ts.isObjectLiteralExpression(initializer) &&
+ (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) &&
+ ts.hasEntries(symbol.exports);
+ if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 221 /* ForInStatement */) {
+ checkTypeAssignableTo(checkExpressionCached(initializer), type, node, /*headMessage*/ undefined);
+ checkParameterInitializer(node);
+ }
}
}
else {
@@ -52209,9 +52307,9 @@ var ts;
}
}
// Checks for export * conflicts
- var exports_1 = getExportsOfModule(moduleSymbol);
- if (exports_1) {
- exports_1.forEach(function (_a, id) {
+ var exports_2 = getExportsOfModule(moduleSymbol);
+ if (exports_2) {
+ exports_2.forEach(function (_a, id) {
var declarations = _a.declarations, flags = _a.flags;
if (id === "__export") {
return;
@@ -52319,9 +52417,11 @@ var ts;
return checkImportType(node);
case 290 /* JSDocAugmentsTag */:
return checkJSDocAugmentsTag(node);
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
case 292 /* JSDocCallbackTag */:
return checkJSDocTypeAliasTag(node);
+ case 296 /* JSDocTypeTag */:
+ return checkJSDocTypeTag(node);
case 293 /* JSDocParameterTag */:
return checkJSDocParameterTag(node);
case 284 /* JSDocFunctionType */:
@@ -52851,7 +52951,7 @@ var ts;
if (entityName.parent.kind === 293 /* JSDocParameterTag */) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 148 /* TypeParameter */ && entityName.parent.parent.kind === 296 /* JSDocTemplateTag */) {
+ if (entityName.parent.kind === 148 /* TypeParameter */ && entityName.parent.parent.kind === 297 /* JSDocTemplateTag */) {
ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); // Otherwise `isDeclarationName` would have been true.
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -55385,7 +55485,7 @@ var ts;
ts.updateQualifiedName = updateQualifiedName;
function parenthesizeForComputedName(expression) {
return (ts.isBinaryExpression(expression) && expression.operatorToken.kind === 26 /* CommaToken */) ||
- expression.kind === 302 /* CommaListExpression */ ?
+ expression.kind === 303 /* CommaListExpression */ ?
createParen(expression) :
expression;
}
@@ -57370,7 +57470,7 @@ var ts;
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(300 /* NotEmittedStatement */);
+ var node = createSynthesizedNode(301 /* NotEmittedStatement */);
node.original = original;
setTextRange(node, original);
return node;
@@ -57382,7 +57482,7 @@ var ts;
*/
/* @internal */
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(304 /* EndOfDeclarationMarker */);
+ var node = createSynthesizedNode(305 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -57394,7 +57494,7 @@ var ts;
*/
/* @internal */
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(303 /* MergeDeclarationMarker */);
+ var node = createSynthesizedNode(304 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -57409,7 +57509,7 @@ var ts;
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(301 /* PartiallyEmittedExpression */);
+ var node = createSynthesizedNode(302 /* PartiallyEmittedExpression */);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -57425,7 +57525,7 @@ var ts;
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 302 /* CommaListExpression */) {
+ if (node.kind === 303 /* CommaListExpression */) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26 /* CommaToken */) {
@@ -57435,7 +57535,7 @@ var ts;
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(302 /* CommaListExpression */);
+ var node = createSynthesizedNode(303 /* CommaListExpression */);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -57454,18 +57554,21 @@ var ts;
return node;
}
ts.createBundle = createBundle;
- function createUnparsedSourceFile(text, map) {
+ function createUnparsedSourceFile(text, mapPath, map) {
var node = ts.createNode(276 /* UnparsedSource */);
node.text = text;
+ node.sourceMapPath = mapPath;
node.sourceMapText = map;
return node;
}
ts.createUnparsedSourceFile = createUnparsedSourceFile;
- function createInputFiles(javascript, declaration, javascriptMapText, declarationMapText) {
+ function createInputFiles(javascript, declaration, javascriptMapPath, javascriptMapText, declarationMapPath, declarationMapText) {
var node = ts.createNode(277 /* InputFiles */);
node.javascriptText = javascript;
+ node.javascriptMapPath = javascriptMapPath;
node.javascriptMapText = javascriptMapText;
node.declarationText = declaration;
+ node.declarationMapPath = declarationMapPath;
node.declarationMapText = declarationMapText;
return node;
}
@@ -58727,7 +58830,7 @@ var ts;
// if should be wrapped in parens since comma operator has the lowest precedence
var emittedExpression = ts.skipPartiallyEmittedExpressions(e);
return emittedExpression.kind === 200 /* BinaryExpression */ && emittedExpression.operatorToken.kind === 26 /* CommaToken */ ||
- emittedExpression.kind === 302 /* CommaListExpression */
+ emittedExpression.kind === 303 /* CommaListExpression */
? ts.createParen(e)
: e;
}
@@ -58747,7 +58850,7 @@ var ts;
var check = ts.skipPartiallyEmittedExpressions(e);
return (check.kind === 205 /* ClassExpression */ ||
check.kind === 192 /* FunctionExpression */ ||
- check.kind === 302 /* CommaListExpression */ ||
+ check.kind === 303 /* CommaListExpression */ ||
ts.isBinaryExpression(check) && check.operatorToken.kind === 26 /* CommaToken */)
? ts.createParen(e)
: e;
@@ -58912,7 +59015,7 @@ var ts;
case 185 /* PropertyAccessExpression */:
node = node.expression;
continue;
- case 301 /* PartiallyEmittedExpression */:
+ case 302 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -58942,7 +59045,7 @@ var ts;
case 208 /* AsExpression */:
case 209 /* NonNullExpression */:
return (kinds & 2 /* Assertions */) !== 0;
- case 301 /* PartiallyEmittedExpression */:
+ case 302 /* PartiallyEmittedExpression */:
return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0;
}
return false;
@@ -58979,7 +59082,7 @@ var ts;
case 190 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
case 208 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
case 209 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
- case 301 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 302 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
/**
@@ -59765,9 +59868,9 @@ var ts;
case 274 /* SourceFile */:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 301 /* PartiallyEmittedExpression */:
+ case 302 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 302 /* CommaListExpression */:
+ case 303 /* CommaListExpression */:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
// No need to visit nodes with no children.
@@ -59823,7 +59926,7 @@ var ts;
case 215 /* EmptyStatement */:
case 206 /* OmittedExpression */:
case 231 /* DebuggerStatement */:
- case 300 /* NotEmittedStatement */:
+ case 301 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
@@ -60202,10 +60305,10 @@ var ts;
result = reduceNodes(node.statements, cbNodes, result);
break;
// Transformation nodes
- case 301 /* PartiallyEmittedExpression */:
+ case 302 /* PartiallyEmittedExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 302 /* CommaListExpression */:
+ case 303 /* CommaListExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -60364,6 +60467,292 @@ var ts;
})(ts || (ts = {}));
/* @internal */
var ts;
+(function (ts) {
+ function createSourceFileLikeCache(host) {
+ var cached = ts.createMap();
+ return {
+ get: function (path) {
+ if (cached.has(path)) {
+ return cached.get(path);
+ }
+ if (!host.fileExists || !host.readFile || !host.fileExists(path))
+ return;
+ // And failing that, check the disk
+ var text = host.readFile(path); // TODO: GH#18217
+ var file = {
+ text: text,
+ lineMap: undefined,
+ getLineAndCharacterOfPosition: function (pos) {
+ return ts.computeLineAndCharacterOfPosition(ts.getLineStarts(this), pos);
+ }
+ };
+ cached.set(path, file);
+ return file;
+ }
+ };
+ }
+ ts.createSourceFileLikeCache = createSourceFileLikeCache;
+})(ts || (ts = {}));
+/* @internal */
+(function (ts) {
+ var sourcemaps;
+ (function (sourcemaps) {
+ sourcemaps.identitySourceMapper = { getOriginalPosition: ts.identity, getGeneratedPosition: ts.identity };
+ function decode(host, mapPath, map, program, fallbackCache) {
+ if (fallbackCache === void 0) { fallbackCache = ts.createSourceFileLikeCache(host); }
+ var currentDirectory = ts.getDirectoryPath(mapPath);
+ var sourceRoot = map.sourceRoot || currentDirectory;
+ var decodedMappings;
+ var generatedOrderedMappings;
+ var sourceOrderedMappings;
+ return {
+ getOriginalPosition: getOriginalPosition,
+ getGeneratedPosition: getGeneratedPosition
+ };
+ function getGeneratedPosition(loc) {
+ var maps = getSourceOrderedMappings();
+ if (!ts.length(maps))
+ return loc;
+ var targetIndex = ts.binarySearch(maps, { sourcePath: loc.fileName, sourcePosition: loc.position }, ts.identity, compareProcessedPositionSourcePositions);
+ if (targetIndex < 0 && maps.length > 0) {
+ // if no exact match, closest is 2's compliment of result
+ targetIndex = ~targetIndex;
+ }
+ if (!maps[targetIndex] || ts.comparePaths(loc.fileName, maps[targetIndex].sourcePath, sourceRoot) !== 0) {
+ return loc;
+ }
+ return { fileName: ts.toPath(map.file, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].emittedPosition }; // Closest pos
+ }
+ function getOriginalPosition(loc) {
+ var maps = getGeneratedOrderedMappings();
+ if (!ts.length(maps))
+ return loc;
+ var targetIndex = ts.binarySearch(maps, { emittedPosition: loc.position }, ts.identity, compareProcessedPositionEmittedPositions);
+ if (targetIndex < 0 && maps.length > 0) {
+ // if no exact match, closest is 2's compliment of result
+ targetIndex = ~targetIndex;
+ }
+ return { fileName: ts.toPath(maps[targetIndex].sourcePath, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].sourcePosition }; // Closest pos
+ }
+ function getSourceFileLike(fileName, location) {
+ // Lookup file in program, if provided
+ var file = program && program.getSourceFile(fileName);
+ if (!file) {
+ // Otherwise check the cache (which may hit disk)
+ var path = ts.toPath(fileName, location, host.getCanonicalFileName);
+ return fallbackCache.get(path);
+ }
+ return file;
+ }
+ function getPositionOfLineAndCharacterUsingName(fileName, directory, line, character) {
+ var file = getSourceFileLike(fileName, directory);
+ if (!file) {
+ return -1;
+ }
+ return ts.getPositionOfLineAndCharacter(file, line, character);
+ }
+ function getDecodedMappings() {
+ return decodedMappings || (decodedMappings = calculateDecodedMappings(map, processPosition, host));
+ }
+ function getSourceOrderedMappings() {
+ return sourceOrderedMappings || (sourceOrderedMappings = getDecodedMappings().slice().sort(compareProcessedPositionSourcePositions));
+ }
+ function getGeneratedOrderedMappings() {
+ return generatedOrderedMappings || (generatedOrderedMappings = getDecodedMappings().slice().sort(compareProcessedPositionEmittedPositions));
+ }
+ function compareProcessedPositionSourcePositions(a, b) {
+ return ts.comparePaths(a.sourcePath, b.sourcePath, sourceRoot) ||
+ ts.compareValues(a.sourcePosition, b.sourcePosition);
+ }
+ function compareProcessedPositionEmittedPositions(a, b) {
+ return ts.compareValues(a.emittedPosition, b.emittedPosition);
+ }
+ function processPosition(position) {
+ var sourcePath = map.sources[position.sourceIndex];
+ return {
+ emittedPosition: getPositionOfLineAndCharacterUsingName(map.file, currentDirectory, position.emittedLine, position.emittedColumn),
+ sourcePosition: getPositionOfLineAndCharacterUsingName(sourcePath, sourceRoot, position.sourceLine, position.sourceColumn),
+ sourcePath: sourcePath,
+ };
+ }
+ }
+ sourcemaps.decode = decode;
+ /*@internal*/
+ function decodeMappings(map) {
+ var state = {
+ encodedText: map.mappings,
+ currentNameIndex: undefined,
+ sourceMapNamesLength: map.names ? map.names.length : undefined,
+ currentEmittedColumn: 0,
+ currentEmittedLine: 0,
+ currentSourceColumn: 0,
+ currentSourceLine: 0,
+ currentSourceIndex: 0,
+ decodingIndex: 0
+ };
+ function captureSpan() {
+ return {
+ emittedColumn: state.currentEmittedColumn,
+ emittedLine: state.currentEmittedLine,
+ sourceColumn: state.currentSourceColumn,
+ sourceIndex: state.currentSourceIndex,
+ sourceLine: state.currentSourceLine,
+ nameIndex: state.currentNameIndex
+ };
+ }
+ return {
+ get decodingIndex() { return state.decodingIndex; },
+ get error() { return state.error; },
+ get lastSpan() { return captureSpan(); },
+ next: function () {
+ if (hasCompletedDecoding(state) || state.error)
+ return { done: true, value: undefined };
+ if (!decodeSinglePosition(state))
+ return { done: true, value: undefined };
+ return { done: false, value: captureSpan() };
+ }
+ };
+ }
+ sourcemaps.decodeMappings = decodeMappings;
+ function calculateDecodedMappings(map, processPosition, host) {
+ var decoder = decodeMappings(map);
+ var positions = ts.arrayFrom(decoder, processPosition);
+ if (decoder.error) {
+ if (host && host.log) {
+ host.log("Encountered error while decoding sourcemap: " + decoder.error);
+ }
+ return [];
+ }
+ return positions;
+ }
+ sourcemaps.calculateDecodedMappings = calculateDecodedMappings;
+ function hasCompletedDecoding(state) {
+ return state.decodingIndex === state.encodedText.length;
+ }
+ function decodeSinglePosition(state) {
+ while (state.decodingIndex < state.encodedText.length) {
+ var char = state.encodedText.charCodeAt(state.decodingIndex);
+ if (char === 59 /* semicolon */) {
+ // New line
+ state.currentEmittedLine++;
+ state.currentEmittedColumn = 0;
+ state.decodingIndex++;
+ continue;
+ }
+ if (char === 44 /* comma */) {
+ // Next entry is on same line - no action needed
+ state.decodingIndex++;
+ continue;
+ }
+ // Read the current position
+ // 1. Column offset from prev read jsColumn
+ state.currentEmittedColumn += base64VLQFormatDecode();
+ // Incorrect emittedColumn dont support this map
+ if (createErrorIfCondition(state.currentEmittedColumn < 0, "Invalid emittedColumn found")) {
+ return false;
+ }
+ // Dont support reading mappings that dont have information about original source and its line numbers
+ if (createErrorIfCondition(isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: No entries after emitted column")) {
+ return false;
+ }
+ // 2. Relative sourceIndex
+ state.currentSourceIndex += base64VLQFormatDecode();
+ // Incorrect sourceIndex dont support this map
+ if (createErrorIfCondition(state.currentSourceIndex < 0, "Invalid sourceIndex found")) {
+ return false;
+ }
+ // Dont support reading mappings that dont have information about original source position
+ if (createErrorIfCondition(isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: No entries after sourceIndex")) {
+ return false;
+ }
+ // 3. Relative sourceLine 0 based
+ state.currentSourceLine += base64VLQFormatDecode();
+ // Incorrect sourceLine dont support this map
+ if (createErrorIfCondition(state.currentSourceLine < 0, "Invalid sourceLine found")) {
+ return false;
+ }
+ // Dont support reading mappings that dont have information about original source and its line numbers
+ if (createErrorIfCondition(isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: No entries after emitted Line")) {
+ return false;
+ }
+ // 4. Relative sourceColumn 0 based
+ state.currentSourceColumn += base64VLQFormatDecode();
+ // Incorrect sourceColumn dont support this map
+ if (createErrorIfCondition(state.currentSourceColumn < 0, "Invalid sourceLine found")) {
+ return false;
+ }
+ // 5. Check if there is name:
+ if (!isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex)) {
+ if (state.currentNameIndex === undefined) {
+ state.currentNameIndex = 0;
+ }
+ state.currentNameIndex += base64VLQFormatDecode();
+ // Incorrect nameIndex dont support this map
+ // TODO: If we start using `name`s, issue errors when they aren't correct in the sourcemap
+ // if (createErrorIfCondition(state.currentNameIndex < 0 || state.currentNameIndex >= state.sourceMapNamesLength, "Invalid name index for the source map entry")) {
+ // return;
+ // }
+ }
+ // Dont support reading mappings that dont have information about original source and its line numbers
+ if (createErrorIfCondition(!isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: There are more entries after " + (state.currentNameIndex === undefined ? "sourceColumn" : "nameIndex"))) {
+ return false;
+ }
+ // Entry should be complete
+ return true;
+ }
+ createErrorIfCondition(/*condition*/ true, "No encoded entry found");
+ return false;
+ function createErrorIfCondition(condition, errormsg) {
+ if (state.error) {
+ // An error was already reported
+ return true;
+ }
+ if (condition) {
+ state.error = errormsg;
+ }
+ return condition;
+ }
+ function base64VLQFormatDecode() {
+ var moreDigits = true;
+ var shiftCount = 0;
+ var value = 0;
+ for (; moreDigits; state.decodingIndex++) {
+ if (createErrorIfCondition(state.decodingIndex >= state.encodedText.length, "Error in decoding base64VLQFormatDecode, past the mapping string")) {
+ return undefined; // TODO: GH#18217
+ }
+ // 6 digit number
+ var currentByte = base64FormatDecode(state.encodedText.charAt(state.decodingIndex));
+ // If msb is set, we still have more bits to continue
+ moreDigits = (currentByte & 32) !== 0;
+ // least significant 5 bits are the next msbs in the final value.
+ value = value | ((currentByte & 31) << shiftCount);
+ shiftCount += 5;
+ }
+ // Least significant bit if 1 represents negative and rest of the msb is actual absolute value
+ if ((value & 1) === 0) {
+ // + number
+ value = value >> 1;
+ }
+ else {
+ // - number
+ value = value >> 1;
+ value = -value;
+ }
+ return value;
+ }
+ }
+ function base64FormatDecode(char) {
+ return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(char);
+ }
+ function isSourceMappingSegmentEnd(encodedText, pos) {
+ return (pos === encodedText.length ||
+ encodedText.charCodeAt(pos) === 44 /* comma */ ||
+ encodedText.charCodeAt(pos) === 59 /* semicolon */);
+ }
+ })(sourcemaps = ts.sourcemaps || (ts.sourcemaps = {}));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
(function (ts) {
function getOriginalNodeId(node) {
node = ts.getOriginalNode(node);
@@ -61161,7 +61550,7 @@ var ts;
function transformBundle(node) {
return ts.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) {
if (prepend.kind === 277 /* InputFiles */) {
- return ts.createUnparsedSourceFile(prepend.javascriptText, prepend.javascriptMapText);
+ return ts.createUnparsedSourceFile(prepend.javascriptText, prepend.javascriptMapPath, prepend.javascriptMapText);
}
return prepend;
}));
@@ -71851,9 +72240,9 @@ var ts;
return visitFunctionDeclaration(node);
case 235 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 303 /* MergeDeclarationMarker */:
+ case 304 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 304 /* EndOfDeclarationMarker */:
+ case 305 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -73785,9 +74174,9 @@ var ts;
return visitCatchClause(node);
case 213 /* Block */:
return visitBlock(node);
- case 303 /* MergeDeclarationMarker */:
+ case 304 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 304 /* EndOfDeclarationMarker */:
+ case 305 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -74965,7 +75354,7 @@ var ts;
return ts.updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
}), ts.mapDefined(node.prepends, function (prepend) {
if (prepend.kind === 277 /* InputFiles */) {
- return ts.createUnparsedSourceFile(prepend.declarationText, prepend.declarationMapText);
+ return ts.createUnparsedSourceFile(prepend.declarationText, prepend.declarationMapPath, prepend.declarationMapText);
}
}));
bundle.syntheticFileReferences = [];
@@ -75958,7 +76347,7 @@ var ts;
* @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files.
*/
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(305 /* Count */);
+ var enabledSyntaxKindFeatures = new Array(306 /* Count */);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -76221,10 +76610,10 @@ var ts;
(function (ts) {
// Used for initialize lastEncodedSourceMapSpan and reset lastEncodedSourceMapSpan when updateLastEncodedAndRecordedSpans
var defaultLastEncodedSourceMapSpan = {
- emittedLine: 1,
- emittedColumn: 1,
- sourceLine: 1,
- sourceColumn: 1,
+ emittedLine: 0,
+ emittedColumn: 0,
+ sourceLine: 0,
+ sourceColumn: 0,
sourceIndex: 0
};
function createSourceMapWriter(host, writer, compilerOptions) {
@@ -76243,9 +76632,6 @@ var ts;
var sourceMapData;
var sourceMapDataList;
var disabled = !(compilerOptions.sourceMap || compilerOptions.inlineSourceMap);
- var completedSections;
- var sectionStartLine;
- var sectionStartColumn;
return {
initialize: initialize,
reset: reset,
@@ -76286,9 +76672,6 @@ var ts;
lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan;
lastEncodedNameIndex = 0;
// Initialize source map data
- completedSections = [];
- sectionStartLine = 1;
- sectionStartColumn = 1;
sourceMapData = {
sourceMapFilePath: sourceMapFilePath,
jsSourceMappingURL: !compilerOptions.inlineSourceMap ? ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)) : undefined,
@@ -76349,9 +76732,6 @@ var ts;
lastEncodedNameIndex = undefined;
sourceMapData = undefined;
sourceMapDataList = undefined;
- completedSections = undefined;
- sectionStartLine = undefined;
- sectionStartColumn = undefined;
}
function captureSection() {
return {
@@ -76364,30 +76744,15 @@ var ts;
sourcesContent: sourceMapData.sourceMapSourcesContent,
};
}
- function resetSectionalData() {
- sourceMapData.sourceMapSources = [];
- sourceMapData.sourceMapNames = [];
- sourceMapData.sourceMapMappings = "";
- sourceMapData.sourceMapSourcesContent = compilerOptions.inlineSources ? [] : undefined;
- }
- function generateMap() {
- if (completedSections.length) {
- captureSectionalSpanIfNeeded(/*reset*/ false);
- return {
- version: 3,
- file: sourceMapData.sourceMapFile,
- sections: completedSections
- };
- }
- else {
- return captureSection();
- }
- }
// Encoding for sourcemap span
function encodeLastRecordedSourceMapSpan() {
if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) {
return;
}
+ ts.Debug.assert(lastRecordedSourceMapSpan.emittedColumn >= 0, "lastEncodedSourceMapSpan.emittedColumn was negative");
+ ts.Debug.assert(lastRecordedSourceMapSpan.sourceIndex >= 0, "lastEncodedSourceMapSpan.sourceIndex was negative");
+ ts.Debug.assert(lastRecordedSourceMapSpan.sourceLine >= 0, "lastEncodedSourceMapSpan.sourceLine was negative");
+ ts.Debug.assert(lastRecordedSourceMapSpan.sourceColumn >= 0, "lastEncodedSourceMapSpan.sourceColumn was negative");
var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn;
// Line/Comma delimiters
if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) {
@@ -76401,7 +76766,7 @@ var ts;
for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) {
sourceMapData.sourceMapMappings += ";";
}
- prevEncodedEmittedColumn = 1;
+ prevEncodedEmittedColumn = 0;
}
// 1. Relative Column 0 based
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn);
@@ -76436,11 +76801,8 @@ var ts;
ts.performance.mark("beforeSourcemap");
}
var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSource, pos);
- // Convert the location to be one-based.
- sourceLinePos.line++;
- sourceLinePos.character++;
- var emittedLine = writer.getLine() - sectionStartLine + 1;
- var emittedColumn = emittedLine === 0 ? (writer.getColumn() - sectionStartColumn + 1) : writer.getColumn();
+ var emittedLine = writer.getLine();
+ var 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 ||
@@ -76470,13 +76832,8 @@ var ts;
ts.performance.measure("Source Map", "beforeSourcemap", "afterSourcemap");
}
}
- function captureSectionalSpanIfNeeded(reset) {
- if (lastRecordedSourceMapSpan && lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { // If we've recorded some spans, save them
- completedSections.push({ offset: { line: sectionStartLine - 1, column: sectionStartColumn - 1 }, map: captureSection() });
- if (reset) {
- resetSectionalData();
- }
- }
+ function isPossiblySourceMap(x) {
+ return typeof x === "object" && !!x.mappings && typeof x.mappings === "string" && !!x.sources;
}
/**
* Emits a node with possible leading and trailing source maps.
@@ -76491,7 +76848,6 @@ var ts;
}
if (node) {
if (ts.isUnparsedSource(node) && node.sourceMapText !== undefined) {
- captureSectionalSpanIfNeeded(/*reset*/ true);
var text = node.sourceMapText;
var parsed = void 0;
try {
@@ -76500,23 +76856,31 @@ var ts;
catch (_a) {
// empty
}
- var offset = { line: writer.getLine() - 1, column: writer.getColumn() - 1 };
- completedSections.push(parsed
- ? {
- offset: offset,
- map: parsed
- }
- : {
- offset: offset,
- // This is just passes the buck on sourcemaps we don't really understand, instead of issuing an error (which would be difficult this late)
- url: "data:application/json;charset=utf-8;base64," + ts.base64encode(ts.sys, text)
- });
- var emitResult = emitCallback(hint, node);
- sectionStartLine = writer.getLine();
- sectionStartColumn = writer.getColumn();
- lastRecordedSourceMapSpan = undefined;
- lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan;
- return emitResult;
+ if (!parsed || !isPossiblySourceMap(parsed)) {
+ return emitCallback(hint, node);
+ }
+ var offsetLine_1 = writer.getLine();
+ var firstLineColumnOffset_1 = writer.getColumn();
+ // First, decode the old component sourcemap
+ var originalMap_1 = parsed;
+ ts.sourcemaps.calculateDecodedMappings(originalMap_1, function (raw) {
+ // Apply offsets to each position and fixup source entries
+ var rawPath = originalMap_1.sources[raw.sourceIndex];
+ var relativePath = originalMap_1.sourceRoot ? ts.combinePaths(originalMap_1.sourceRoot, rawPath) : rawPath;
+ var combinedPath = ts.combinePaths(ts.getDirectoryPath(node.sourceMapPath), relativePath);
+ var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
+ var resolvedPath = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, combinedPath, host.getCurrentDirectory(), host.getCanonicalFileName,
+ /*isAbsolutePathAnUrl*/ true);
+ var absolutePath = ts.getNormalizedAbsolutePath(resolvedPath, sourcesDirectoryPath);
+ // tslint:disable-next-line:no-null-keyword
+ setupSourceEntry(absolutePath, originalMap_1.sourcesContent ? originalMap_1.sourcesContent[raw.sourceIndex] : null); // TODO: Lookup content for inlining?
+ var newIndex = sourceMapData.sourceMapSources.indexOf(resolvedPath);
+ // Then reencode all the updated spans into the overall map
+ encodeLastRecordedSourceMapSpan();
+ lastRecordedSourceMapSpan = __assign({}, raw, { emittedLine: raw.emittedLine + offsetLine_1, emittedColumn: raw.emittedLine === 0 ? (raw.emittedColumn + firstLineColumnOffset_1) : raw.emittedColumn, sourceIndex: newIndex });
+ });
+ // And actually emit the text these sourcemaps are for
+ return emitCallback(hint, node);
}
var emitNode = node.emitNode;
var emitFlags = emitNode && emitNode.flags || 0 /* None */;
@@ -76528,7 +76892,7 @@ var ts;
source = undefined;
if (source)
setSourceFile(source);
- if (node.kind !== 300 /* NotEmittedStatement */
+ if (node.kind !== 301 /* NotEmittedStatement */
&& (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitPos(skipSourceTrivia(pos));
@@ -76545,7 +76909,7 @@ var ts;
}
if (source)
setSourceFile(source);
- if (node.kind !== 300 /* NotEmittedStatement */
+ if (node.kind !== 301 /* NotEmittedStatement */
&& (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitPos(end);
@@ -76598,20 +76962,23 @@ var ts;
if (isJsonSourceMapSource(sourceFile)) {
return;
}
+ setupSourceEntry(sourceFile.fileName, sourceFile.text);
+ }
+ function setupSourceEntry(fileName, content) {
// 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
var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
- var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSource.fileName, host.getCurrentDirectory(), host.getCanonicalFileName,
+ var source = ts.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(currentSource.fileName);
+ sourceMapData.inputSourceFileNames.push(fileName);
if (compilerOptions.inlineSources) {
- sourceMapData.sourceMapSourcesContent.push(currentSource.text);
+ sourceMapData.sourceMapSourcesContent.push(content);
}
}
}
@@ -76623,7 +76990,7 @@ var ts;
return undefined; // TODO: GH#18217
}
encodeLastRecordedSourceMapSpan();
- return JSON.stringify(generateMap());
+ return JSON.stringify(captureSection());
}
/**
* Gets the SourceMappingURL for the source map.
@@ -76719,7 +77086,7 @@ var ts;
if (extendedDiagnostics) {
ts.performance.mark("preEmitNodeWithComment");
}
- var isEmittedNode = node.kind !== 300 /* NotEmittedStatement */;
+ var isEmittedNode = node.kind !== 301 /* NotEmittedStatement */;
// We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation.
// It is expensive to walk entire tree just to set one kind of node to have no comments.
var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 10 /* JsxText */;
@@ -77863,9 +78230,9 @@ var ts;
case 259 /* JsxFragment */:
return emitJsxFragment(node);
// Transformation nodes
- case 301 /* PartiallyEmittedExpression */:
+ case 302 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
- case 302 /* CommaListExpression */:
+ case 303 /* CommaListExpression */:
return emitCommaList(node);
}
}
@@ -80816,6 +81183,8 @@ var ts;
var gutterSeparator = " ";
var resetEscapeSequence = "\u001b[0m";
var ellipsis = "...";
+ var halfIndent = " ";
+ var indent = " ";
function getCategoryFormat(category) {
switch (category) {
case ts.DiagnosticCategory.Error: return ForegroundColorEscapeSequences.Red;
@@ -80835,62 +81204,71 @@ var ts;
}
return s;
}
+ function formatCodeSpan(file, start, length, indent, squiggleColor, host) {
+ var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character;
+ var _b = ts.getLineAndCharacterOfPosition(file, start + length), lastLine = _b.line, lastLineChar = _b.character;
+ var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line;
+ var hasMoreThanFiveLines = (lastLine - firstLine) >= 4;
+ var gutterWidth = (lastLine + 1 + "").length;
+ if (hasMoreThanFiveLines) {
+ gutterWidth = Math.max(ellipsis.length, gutterWidth);
+ }
+ var context = "";
+ for (var i = firstLine; i <= lastLine; i++) {
+ context += host.getNewLine();
+ // If the error spans over 5 lines, we'll only show the first 2 and last 2 lines,
+ // so we'll skip ahead to the second-to-last line.
+ if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) {
+ context += indent + formatColorAndReset(padLeft(ellipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine();
+ i = lastLine - 1;
+ }
+ var lineStart = ts.getPositionOfLineAndCharacter(file, i, 0);
+ var lineEnd = i < lastLineInFile ? ts.getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length;
+ var lineContent = file.text.slice(lineStart, lineEnd);
+ lineContent = lineContent.replace(/\s+$/g, ""); // trim from end
+ lineContent = lineContent.replace("\t", " "); // convert tabs to single spaces
+ // Output the gutter and the actual contents of the line.
+ context += indent + formatColorAndReset(padLeft(i + 1 + "", gutterWidth), gutterStyleSequence) + gutterSeparator;
+ context += lineContent + host.getNewLine();
+ // Output the gutter and the error span for the line using tildes.
+ context += indent + formatColorAndReset(padLeft("", gutterWidth), gutterStyleSequence) + gutterSeparator;
+ context += squiggleColor;
+ if (i === firstLine) {
+ // If we're on the last line, then limit it to the last character of the last line.
+ // Otherwise, we'll just squiggle the rest of the line, giving 'slice' no end position.
+ var lastCharForLine = i === lastLine ? lastLineChar : undefined;
+ context += lineContent.slice(0, firstLineChar).replace(/\S/g, " ");
+ context += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~");
+ }
+ else if (i === lastLine) {
+ context += lineContent.slice(0, lastLineChar).replace(/./g, "~");
+ }
+ else {
+ // Squiggle the entire line.
+ context += lineContent.replace(/./g, "~");
+ }
+ context += resetEscapeSequence;
+ }
+ return context;
+ }
+ function formatLocation(file, start, host) {
+ var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character; // TODO: GH#18217
+ var relativeFileName = host ? ts.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : file.fileName;
+ var output = "";
+ output += formatColorAndReset(relativeFileName, ForegroundColorEscapeSequences.Cyan);
+ output += ":";
+ output += formatColorAndReset("" + (firstLine + 1), ForegroundColorEscapeSequences.Yellow);
+ output += ":";
+ output += formatColorAndReset("" + (firstLineChar + 1), ForegroundColorEscapeSequences.Yellow);
+ return output;
+ }
function formatDiagnosticsWithColorAndContext(diagnostics, host) {
var output = "";
for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) {
var diagnostic = diagnostics_2[_i];
- var context = "";
if (diagnostic.file) {
- var start = diagnostic.start, length_4 = diagnostic.length, file = diagnostic.file;
- var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character; // TODO: GH#18217
- var _b = ts.getLineAndCharacterOfPosition(file, start + length_4), lastLine = _b.line, lastLineChar = _b.character;
- var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line;
- var relativeFileName = host ? ts.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : file.fileName;
- var hasMoreThanFiveLines = (lastLine - firstLine) >= 4;
- var gutterWidth = (lastLine + 1 + "").length;
- if (hasMoreThanFiveLines) {
- gutterWidth = Math.max(ellipsis.length, gutterWidth);
- }
- for (var i = firstLine; i <= lastLine; i++) {
- context += host.getNewLine();
- // If the error spans over 5 lines, we'll only show the first 2 and last 2 lines,
- // so we'll skip ahead to the second-to-last line.
- if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) {
- context += formatColorAndReset(padLeft(ellipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine();
- i = lastLine - 1;
- }
- var lineStart = ts.getPositionOfLineAndCharacter(file, i, 0);
- var lineEnd = i < lastLineInFile ? ts.getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length;
- var lineContent = file.text.slice(lineStart, lineEnd);
- lineContent = lineContent.replace(/\s+$/g, ""); // trim from end
- lineContent = lineContent.replace("\t", " "); // convert tabs to single spaces
- // Output the gutter and the actual contents of the line.
- context += formatColorAndReset(padLeft(i + 1 + "", gutterWidth), gutterStyleSequence) + gutterSeparator;
- context += lineContent + host.getNewLine();
- // Output the gutter and the error span for the line using tildes.
- context += formatColorAndReset(padLeft("", gutterWidth), gutterStyleSequence) + gutterSeparator;
- context += ForegroundColorEscapeSequences.Red;
- if (i === firstLine) {
- // If we're on the last line, then limit it to the last character of the last line.
- // Otherwise, we'll just squiggle the rest of the line, giving 'slice' no end position.
- var lastCharForLine = i === lastLine ? lastLineChar : undefined;
- context += lineContent.slice(0, firstLineChar).replace(/\S/g, " ");
- context += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~");
- }
- else if (i === lastLine) {
- context += lineContent.slice(0, lastLineChar).replace(/./g, "~");
- }
- else {
- // Squiggle the entire line.
- context += lineContent.replace(/./g, "~");
- }
- context += resetEscapeSequence;
- }
- output += formatColorAndReset(relativeFileName, ForegroundColorEscapeSequences.Cyan);
- output += ":";
- output += formatColorAndReset("" + (firstLine + 1), ForegroundColorEscapeSequences.Yellow);
- output += ":";
- output += formatColorAndReset("" + (firstLineChar + 1), ForegroundColorEscapeSequences.Yellow);
+ var file = diagnostic.file, start = diagnostic.start;
+ output += formatLocation(file, start, host); // TODO: GH#18217
output += " - ";
}
output += formatColorAndReset(ts.diagnosticCategoryName(diagnostic), getCategoryFormat(diagnostic.category));
@@ -80898,7 +81276,20 @@ var ts;
output += flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine());
if (diagnostic.file) {
output += host.getNewLine();
- output += context;
+ output += formatCodeSpan(diagnostic.file, diagnostic.start, diagnostic.length, "", getCategoryFormat(diagnostic.category), host); // TODO: GH#18217
+ if (diagnostic.relatedInformation) {
+ output += host.getNewLine();
+ for (var _a = 0, _b = diagnostic.relatedInformation; _a < _b.length; _a++) {
+ var _c = _b[_a], file = _c.file, start = _c.start, length_4 = _c.length, messageText = _c.messageText;
+ if (file) {
+ output += host.getNewLine();
+ output += halfIndent + formatLocation(file, start, host); // TODO: GH#18217
+ output += formatCodeSpan(file, start, length_4, indent, ForegroundColorEscapeSequences.Cyan, host); // TODO: GH#18217
+ }
+ output += host.getNewLine();
+ output += indent + flattenDiagnosticMessageText(messageText, host.getNewLine());
+ }
+ }
}
output += host.getNewLine();
}
@@ -80912,16 +81303,16 @@ var ts;
else {
var diagnosticChain = messageText;
var result = "";
- var indent = 0;
+ var indent_1 = 0;
while (diagnosticChain) {
- if (indent) {
+ if (indent_1) {
result += newLine;
- for (var i = 0; i < indent; i++) {
+ for (var i = 0; i < indent_1; i++) {
result += " ";
}
}
result += diagnosticChain.messageText;
- indent++;
+ indent_1++;
diagnosticChain = diagnosticChain.next;
}
return result;
@@ -81613,6 +82004,7 @@ var ts;
fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile);
}
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
+ resolvedProjectReferences = oldProgram.getProjectReferences();
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
redirectTargetsSet = oldProgram.redirectTargetsSet;
return oldProgram.structureIsReused = 2 /* Completely */;
@@ -81640,10 +82032,12 @@ var ts;
continue;
var dtsFilename = ts.changeExtension(resolvedRefOpts.options.outFile, ".d.ts");
var js = host.readFile(resolvedRefOpts.options.outFile) || "/* Input file " + resolvedRefOpts.options.outFile + " was missing */\r\n";
- var jsMap = host.readFile(resolvedRefOpts.options.outFile + ".map"); // TODO: try to read sourceMappingUrl comment from the js file
+ var jsMapPath = resolvedRefOpts.options.outFile + ".map"; // TODO: try to read sourceMappingUrl comment from the file
+ var jsMap = host.readFile(jsMapPath);
var dts = host.readFile(dtsFilename) || "/* Input file " + dtsFilename + " was missing */\r\n";
- var dtsMap = host.readFile(dtsFilename + ".map");
- var node = ts.createInputFiles(js, dts, jsMap, dtsMap);
+ var dtsMapPath = dtsFilename + ".map";
+ var dtsMap = host.readFile(dtsMapPath);
+ var node = ts.createInputFiles(js, dts, jsMap && jsMapPath, jsMap, dtsMap && dtsMapPath, dtsMap);
nodes.push(node);
}
}
@@ -83994,6 +84388,7 @@ var ts;
}
function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath) {
if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
+ // Always watch root directory recursively
return { dir: rootDir, dirPath: rootPath }; // TODO: GH#18217
}
return getDirectoryToWatchFromFailedLookupLocationDirectory(ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())), ts.getDirectoryPath(failedLookupLocationPath));
@@ -84004,10 +84399,11 @@ var ts;
dir = ts.getDirectoryPath(dir);
dirPath = ts.getDirectoryPath(dirPath);
}
- // If the directory is node_modules use it to watch
+ // If the directory is node_modules use it to watch, always watch it recursively
if (isNodeModulesDirectory(dirPath)) {
return filterFSRootDirectoriesToWatch({ dir: dir, dirPath: dirPath }, ts.getDirectoryPath(dirPath));
}
+ var nonRecursive = true;
// Use some ancestor of the root directory
var subDirectoryPath, subDirectory;
if (rootPath !== undefined) {
@@ -84016,13 +84412,14 @@ var ts;
if (parentPath === dirPath) {
break;
}
+ nonRecursive = false;
subDirectoryPath = dirPath;
subDirectory = dir;
dirPath = parentPath;
dir = ts.getDirectoryPath(dir);
}
}
- return filterFSRootDirectoriesToWatch({ dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath }, dirPath);
+ return filterFSRootDirectoriesToWatch({ dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive: nonRecursive }, dirPath);
}
function isPathWithDefaultFailedLookupExtension(path) {
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
@@ -84042,7 +84439,7 @@ var ts;
for (var _i = 0, failedLookupLocations_1 = failedLookupLocations; _i < failedLookupLocations_1.length; _i++) {
var failedLookupLocation = failedLookupLocations_1[_i];
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
- var _a = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath), dir = _a.dir, dirPath = _a.dirPath, ignore = _a.ignore;
+ var _a = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath), dir = _a.dir, dirPath = _a.dirPath, nonRecursive = _a.nonRecursive, ignore = _a.ignore;
if (!ignore) {
// If the failed lookup location path is not one of the supported extensions,
// store it in the custom path
@@ -84054,21 +84451,23 @@ var ts;
setAtRoot = true;
}
else {
- setDirectoryWatcher(dir, dirPath);
+ setDirectoryWatcher(dir, dirPath, nonRecursive);
}
}
}
if (setAtRoot) {
+ // This is always recursive
setDirectoryWatcher(rootDir, rootPath); // TODO: GH#18217
}
}
- function setDirectoryWatcher(dir, dirPath) {
+ function setDirectoryWatcher(dir, dirPath, nonRecursive) {
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
if (dirWatcher) {
+ ts.Debug.assert(!!nonRecursive === !!dirWatcher.nonRecursive);
dirWatcher.refCount++;
}
else {
- directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath), refCount: 1 });
+ directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive: nonRecursive });
}
}
function stopWatchFailedLookupLocationOfResolution(resolution) {
@@ -84113,7 +84512,7 @@ var ts;
// Do not close the watcher yet since it might be needed by other failed lookup locations.
dirWatcher.refCount--;
}
- function createDirectoryWatcher(directory, dirPath) {
+ function createDirectoryWatcher(directory, dirPath, nonRecursive) {
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, function (fileOrDirectory) {
var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
if (cachedDirectoryStructureHost) {
@@ -84123,7 +84522,7 @@ var ts;
if (!allFilesHaveInvalidatedResolution && invalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath)) {
resolutionHost.onInvalidatedResolution();
}
- }, 1 /* Recursive */);
+ }, nonRecursive ? 0 /* None */ : 1 /* Recursive */);
}
function removeResolutionsOfFileFromCache(cache, filePath) {
// Deleted file, stop watching failed lookups for all the resolutions in the file
@@ -84310,13 +84709,15 @@ var ts;
}
moduleSpecifiers.getModuleSpecifier = getModuleSpecifier;
// For each symlink/original for a module, returns a list of ways to import that file.
- function getModuleSpecifiers(moduleSymbol, program, importingSourceFile, host, preferences) {
+ function getModuleSpecifiers(moduleSymbol, compilerOptions, importingSourceFile, host, files, preferences) {
var ambient = tryGetModuleNameFromAmbientModule(moduleSymbol);
if (ambient)
return [[ambient]];
- var compilerOptions = program.getCompilerOptions();
- var info = getInfo(compilerOptions, importingSourceFile, importingSourceFile.fileName, host);
- var modulePaths = getAllModulePaths(program, ts.getSourceFileOfNode(moduleSymbol.valueDeclaration));
+ var info = getInfo(compilerOptions, importingSourceFile, importingSourceFile.path, host);
+ if (!files) {
+ return ts.Debug.fail("Files list must be present to resolve symlinks in specifier resolution");
+ }
+ var modulePaths = getAllModulePaths(files, ts.getSourceFileOfNode(moduleSymbol.valueDeclaration), info.getCanonicalFileName, host);
var global = ts.mapDefined(modulePaths, function (moduleFileName) { return getGlobalModuleSpecifier(moduleFileName, info, host, compilerOptions); });
return global.length ? global.map(function (g) { return [g]; }) : modulePaths.map(function (moduleFileName) {
return getLocalModuleSpecifiers(moduleFileName, info, compilerOptions, preferences);
@@ -84401,18 +84802,64 @@ var ts;
return ts.pathIsRelative(text) ? ts.fileExtensionIs(text, ".js" /* Js */) : undefined;
}) || false;
}
+ function discoverProbableSymlinks(files, getCanonicalFileName, host) {
+ var symlinks = ts.mapDefined(files, function (sf) {
+ return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) {
+ return res && res.originalPath && res.resolvedFileName !== res.originalPath ? [res.resolvedFileName, res.originalPath] : undefined;
+ });
+ });
+ var result = ts.createMap();
+ if (symlinks) {
+ var currentDirectory = host.getCurrentDirectory ? host.getCurrentDirectory() : "";
+ for (var _i = 0, symlinks_1 = symlinks; _i < symlinks_1.length; _i++) {
+ var _a = symlinks_1[_i], resolvedPath = _a[0], originalPath = _a[1];
+ var resolvedParts = ts.getPathComponents(ts.toPath(resolvedPath, currentDirectory, getCanonicalFileName));
+ var originalParts = ts.getPathComponents(ts.toPath(originalPath, currentDirectory, getCanonicalFileName));
+ while (resolvedParts[resolvedParts.length - 1] === originalParts[originalParts.length - 1]) {
+ resolvedParts.pop();
+ originalParts.pop();
+ }
+ result.set(ts.getPathFromPathComponents(originalParts), ts.getPathFromPathComponents(resolvedParts));
+ }
+ }
+ return result;
+ }
+ function getAllModulePathsUsingIndirectSymlinks(files, target, getCanonicalFileName, host) {
+ var links = discoverProbableSymlinks(files, getCanonicalFileName, host);
+ var paths = ts.arrayFrom(links.keys());
+ var options;
+ var compareStrings = (!host.useCaseSensitiveFileNames || host.useCaseSensitiveFileNames()) ? ts.compareStringsCaseSensitive : ts.compareStringsCaseInsensitive;
+ for (var _i = 0, paths_2 = paths; _i < paths_2.length; _i++) {
+ var path = paths_2[_i];
+ var resolved = links.get(path);
+ if (compareStrings(target.slice(0, resolved.length + 1), resolved + "/") === 0 /* EqualTo */) {
+ var relative = ts.getRelativePathFromDirectory(resolved, target, getCanonicalFileName);
+ var option = ts.resolvePath(path, relative);
+ if (!host.fileExists || host.fileExists(option)) {
+ if (!options)
+ options = [];
+ options.push(option);
+ }
+ }
+ }
+ if (options) {
+ options.push(target); // Since these are speculative, we also include the original resolved name as a possibility
+ return options;
+ }
+ return [target];
+ }
/**
* Looks for a existing imports that use symlinks to this module.
* Only if no symlink is available, the real path will be used.
*/
- function getAllModulePaths(program, _a) {
+ function getAllModulePaths(files, _a, getCanonicalFileName, host) {
var fileName = _a.fileName;
- var symlinks = ts.mapDefined(program.getSourceFiles(), function (sf) {
+ var symlinks = ts.mapDefined(files, function (sf) {
return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) {
return res && res.resolvedFileName === fileName ? res.originalPath : undefined;
});
});
- return symlinks.length === 0 ? [fileName] : symlinks;
+ return symlinks.length === 0 ? getAllModulePathsUsingIndirectSymlinks(files, ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory ? host.getCurrentDirectory() : ""), getCanonicalFileName, host) : symlinks;
}
function getRelativePathNParents(relativePath) {
var components = ts.getPathComponents(relativePath);
@@ -85630,6 +86077,14 @@ var ts;
var configFileCache = createConfigFileCache(compilerHost);
var context = createBuildContext(defaultOptions);
var existingWatchersForWildcards = ts.createMap();
+ var upToDateHost = {
+ fileExists: function (fileName) { return compilerHost.fileExists(fileName); },
+ getModifiedTime: function (fileName) { return compilerHost.getModifiedTime(fileName); },
+ getUnchangedTime: function (fileName) { return context.unchangedOutputs.getValueOrUndefined(fileName); },
+ getLastStatus: function (fileName) { return context.projectStatus.getValueOrUndefined(fileName); },
+ setLastStatus: function (fileName, status) { return context.projectStatus.setValue(fileName, status); },
+ parseConfigFile: function (configFilePath) { return configFileCache.parseConfigFile(configFilePath); }
+ };
return {
buildAllProjects: buildAllProjects,
getUpToDateStatus: getUpToDateStatus,
@@ -85705,16 +86160,7 @@ var ts;
return getBuildGraph(rootNames);
}
function getUpToDateStatus(project) {
- if (project === undefined) {
- return { type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
- }
- var prior = context.projectStatus.getValueOrUndefined(project.options.configFilePath);
- if (prior !== undefined) {
- return prior;
- }
- var actual = getUpToDateStatusWorker(project);
- context.projectStatus.setValue(project.options.configFilePath, actual);
- return actual;
+ return ts.getUpToDateStatus(upToDateHost, project);
}
function invalidateProject(configFileName) {
var resolved = resolveProjectName(configFileName);
@@ -85734,7 +86180,6 @@ var ts;
}
// Mark all downstream projects of this one needing to be built "later"
function queueBuildForDownstreamReferences(root) {
- debugger;
var deps = graph.dependencyMap.getReferencesTo(root);
for (var _i = 0, deps_1 = deps; _i < deps_1.length; _i++) {
var ref = deps_1[_i];
@@ -85777,158 +86222,6 @@ var ts;
buildSingleProject(next);
}
}
- function getAllProjectOutputs(project) {
- if (project.options.outFile) {
- return getOutFileOutputs(project);
- }
- else {
- var outputs = [];
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
- var inputFile = _a[_i];
- outputs.push.apply(outputs, getOutputFileNames(inputFile, project));
- }
- return outputs;
- }
- }
- function getUpToDateStatusWorker(project) {
- var newestInputFileName = undefined;
- var newestInputFileTime = minimumDate;
- // Get timestamps of input files
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
- var inputFile = _a[_i];
- if (!compilerHost.fileExists(inputFile)) {
- return {
- type: UpToDateStatusType.Unbuildable,
- reason: inputFile + " does not exist"
- };
- }
- var inputTime = compilerHost.getModifiedTime(inputFile);
- if (inputTime > newestInputFileTime) {
- newestInputFileName = inputFile;
- newestInputFileTime = inputTime;
- }
- }
- // Collect the expected outputs of this project
- var outputs = getAllProjectOutputs(project);
- if (outputs.length === 0) {
- return {
- type: UpToDateStatusType.ContainerOnly
- };
- }
- // Now see if all outputs are newer than the newest input
- var oldestOutputFileName = "(none)";
- var oldestOutputFileTime = maximumDate;
- var newestOutputFileName = "(none)";
- var newestOutputFileTime = minimumDate;
- var missingOutputFileName;
- var newestDeclarationFileContentChangedTime = minimumDate;
- var isOutOfDateWithInputs = false;
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
- var output = outputs_1[_b];
- // Output is missing; can stop checking
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
- if (!compilerHost.fileExists(output)) {
- missingOutputFileName = output;
- break;
- }
- var outputTime = compilerHost.getModifiedTime(output);
- if (outputTime < oldestOutputFileTime) {
- oldestOutputFileTime = outputTime;
- oldestOutputFileName = output;
- }
- // If an output is older than the newest input, we can stop checking
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
- if (outputTime < newestInputFileTime) {
- isOutOfDateWithInputs = true;
- break;
- }
- if (outputTime > newestOutputFileTime) {
- newestOutputFileTime = outputTime;
- newestOutputFileName = output;
- }
- // Keep track of when the most recent time a .d.ts file was changed.
- // In addition to file timestamps, we also keep track of when a .d.ts file
- // had its file touched but not had its contents changed - this allows us
- // to skip a downstream typecheck
- if (isDeclarationFile(output)) {
- var unchangedTime = context.unchangedOutputs.getValueOrUndefined(output);
- if (unchangedTime !== undefined) {
- newestDeclarationFileContentChangedTime = newer(unchangedTime, newestDeclarationFileContentChangedTime);
- }
- else {
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, compilerHost.getModifiedTime(output));
- }
- }
- }
- var pseudoUpToDate = false;
- var usesPrepend = false;
- if (project.projectReferences) {
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
- var ref = _d[_c];
- usesPrepend = usesPrepend || !!(ref.prepend);
- var resolvedRef = ts.resolveProjectReferencePath(compilerHost, ref);
- var refStatus = getUpToDateStatus(configFileCache.parseConfigFile(resolvedRef));
- // An upstream project is blocked
- if (refStatus.type === UpToDateStatusType.Unbuildable) {
- return {
- type: UpToDateStatusType.UpstreamBlocked,
- upstreamProjectName: ref.path
- };
- }
- // If the upstream project is out of date, then so are we (someone shouldn't have asked, though?)
- if (refStatus.type !== UpToDateStatusType.UpToDate) {
- return {
- type: UpToDateStatusType.UpstreamOutOfDate,
- upstreamProjectName: ref.path
- };
- }
- // If the upstream project's newest file is older than our oldest output, we
- // can't be out of date because of it
- if (refStatus.newestInputFileTime <= oldestOutputFileTime) {
- continue;
- }
- // If the upstream project has only change .d.ts files, and we've built
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
- if (refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
- pseudoUpToDate = true;
- continue;
- }
- // We have an output older than an upstream output - we are out of date
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
- return {
- type: UpToDateStatusType.OutOfDateWithUpstream,
- outOfDateOutputFileName: oldestOutputFileName,
- newerProjectName: ref.path
- };
- }
- }
- if (missingOutputFileName !== undefined) {
- return {
- type: UpToDateStatusType.OutputMissing,
- missingOutputFileName: missingOutputFileName
- };
- }
- if (isOutOfDateWithInputs) {
- return {
- type: UpToDateStatusType.OutOfDateWithSelf,
- outOfDateOutputFileName: oldestOutputFileName,
- newerInputFileName: newestInputFileName
- };
- }
- if (usesPrepend) {
- pseudoUpToDate = false;
- }
- // Up to date
- return {
- type: pseudoUpToDate ? UpToDateStatusType.UpToDateWithUpstreamTypes : UpToDateStatusType.UpToDate,
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
- newestInputFileTime: newestInputFileTime,
- newestOutputFileTime: newestOutputFileTime,
- newestInputFileName: newestInputFileName,
- newestOutputFileName: newestOutputFileName,
- oldestOutputFileName: oldestOutputFileName
- };
- }
function createDependencyGraph(roots) {
var temporaryMarks = {};
var permanentMarks = {};
@@ -86074,8 +86367,8 @@ var ts;
var now = new Date();
var outputs = getAllProjectOutputs(proj);
var priorNewestUpdateTime = minimumDate;
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
- var file = outputs_2[_i];
+ for (var _i = 0, outputs_1 = outputs; _i < outputs_1.length; _i++) {
+ var file = outputs_1[_i];
if (isDeclarationFile(file)) {
priorNewestUpdateTime = newer(priorNewestUpdateTime, compilerHost.getModifiedTime(file));
}
@@ -86100,8 +86393,8 @@ var ts;
continue;
}
var outputs = getAllProjectOutputs(parsed);
- for (var _b = 0, outputs_3 = outputs; _b < outputs_3.length; _b++) {
- var output = outputs_3[_b];
+ for (var _b = 0, outputs_2 = outputs; _b < outputs_2.length; _b++) {
+ var output = outputs_2[_b];
if (compilerHost.fileExists(output)) {
filesToDelete.push(output);
}
@@ -86228,43 +86521,231 @@ var ts;
function relName(path) {
return ts.convertToRelativePath(path, compilerHost.getCurrentDirectory(), function (f) { return compilerHost.getCanonicalFileName(f); });
}
+ function reportVerbose(message) {
+ var args = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ args[_i - 1] = arguments[_i];
+ }
+ buildHost.verbose.apply(buildHost, [message].concat(args));
+ }
/**
* Report the up-to-date status of a project if we're in verbose mode
*/
function verboseReportProjectStatus(configFileName, status) {
if (!context.options.verbose)
return;
- switch (status.type) {
- case UpToDateStatusType.OutOfDateWithSelf:
- return buildHost.verbose(ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(configFileName), relName(status.outOfDateOutputFileName), relName(status.newerInputFileName));
- case UpToDateStatusType.OutOfDateWithUpstream:
- return buildHost.verbose(ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(configFileName), relName(status.outOfDateOutputFileName), relName(status.newerProjectName));
- case UpToDateStatusType.OutputMissing:
- return buildHost.verbose(ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(configFileName), relName(status.missingOutputFileName));
- case UpToDateStatusType.UpToDate:
- if (status.newestInputFileTime !== undefined) {
- return buildHost.verbose(ts.Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relName(configFileName), relName(status.newestInputFileName), relName(status.oldestOutputFileName));
- }
- // Don't report anything for "up to date because it was already built" -- too verbose
- break;
- case UpToDateStatusType.UpToDateWithUpstreamTypes:
- return buildHost.verbose(ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(configFileName));
- case UpToDateStatusType.UpstreamOutOfDate:
- return buildHost.verbose(ts.Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, relName(configFileName), relName(status.upstreamProjectName));
- case UpToDateStatusType.UpstreamBlocked:
- return buildHost.verbose(ts.Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, relName(configFileName), relName(status.upstreamProjectName));
- case UpToDateStatusType.Unbuildable:
- return buildHost.verbose(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(configFileName), status.reason);
- case UpToDateStatusType.ContainerOnly:
- // Don't report status on "solution" projects
- break;
- default:
- ts.assertTypeIsNever(status);
- }
+ return formatUpToDateStatus(configFileName, status, relName, reportVerbose);
}
}
ts.createSolutionBuilder = createSolutionBuilder;
+ /**
+ * Gets the UpToDateStatus for a project
+ */
+ function getUpToDateStatus(host, project) {
+ if (project === undefined) {
+ return {
+ type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build"
+ };
+ }
+ if (project === undefined) {
+ return { type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
+ }
+ var prior = host.getLastStatus ? host.getLastStatus(project.options.configFilePath) : undefined;
+ if (prior !== undefined) {
+ return prior;
+ }
+ var actual = getUpToDateStatusWorker(host, project);
+ if (host.setLastStatus) {
+ host.setLastStatus(project.options.configFilePath, actual);
+ }
+ return actual;
+ }
+ ts.getUpToDateStatus = getUpToDateStatus;
+ function getUpToDateStatusWorker(host, project) {
+ var newestInputFileName = undefined;
+ var newestInputFileTime = minimumDate;
+ // Get timestamps of input files
+ for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
+ var inputFile = _a[_i];
+ if (!host.fileExists(inputFile)) {
+ return {
+ type: UpToDateStatusType.Unbuildable,
+ reason: inputFile + " does not exist"
+ };
+ }
+ var inputTime = host.getModifiedTime(inputFile);
+ if (inputTime > newestInputFileTime) {
+ newestInputFileName = inputFile;
+ newestInputFileTime = inputTime;
+ }
+ }
+ // Collect the expected outputs of this project
+ var outputs = getAllProjectOutputs(project);
+ if (outputs.length === 0) {
+ return {
+ type: UpToDateStatusType.ContainerOnly
+ };
+ }
+ // Now see if all outputs are newer than the newest input
+ var oldestOutputFileName = "(none)";
+ var oldestOutputFileTime = maximumDate;
+ var newestOutputFileName = "(none)";
+ var newestOutputFileTime = minimumDate;
+ var missingOutputFileName;
+ var newestDeclarationFileContentChangedTime = minimumDate;
+ var isOutOfDateWithInputs = false;
+ for (var _b = 0, outputs_3 = outputs; _b < outputs_3.length; _b++) {
+ var output = outputs_3[_b];
+ // Output is missing; can stop checking
+ // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
+ if (!host.fileExists(output)) {
+ missingOutputFileName = output;
+ break;
+ }
+ var outputTime = host.getModifiedTime(output);
+ if (outputTime < oldestOutputFileTime) {
+ oldestOutputFileTime = outputTime;
+ oldestOutputFileName = output;
+ }
+ // If an output is older than the newest input, we can stop checking
+ // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
+ if (outputTime < newestInputFileTime) {
+ isOutOfDateWithInputs = true;
+ break;
+ }
+ if (outputTime > newestOutputFileTime) {
+ newestOutputFileTime = outputTime;
+ newestOutputFileName = output;
+ }
+ // Keep track of when the most recent time a .d.ts file was changed.
+ // In addition to file timestamps, we also keep track of when a .d.ts file
+ // had its file touched but not had its contents changed - this allows us
+ // to skip a downstream typecheck
+ if (isDeclarationFile(output)) {
+ var unchangedTime = host.getUnchangedTime ? host.getUnchangedTime(output) : undefined;
+ if (unchangedTime !== undefined) {
+ newestDeclarationFileContentChangedTime = newer(unchangedTime, newestDeclarationFileContentChangedTime);
+ }
+ else {
+ newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, host.getModifiedTime(output));
+ }
+ }
+ }
+ var pseudoUpToDate = false;
+ var usesPrepend = false;
+ if (project.projectReferences && host.parseConfigFile) {
+ for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
+ var ref = _d[_c];
+ usesPrepend = usesPrepend || !!(ref.prepend);
+ var resolvedRef = ts.resolveProjectReferencePath(host, ref);
+ var refStatus = getUpToDateStatus(host, host.parseConfigFile(resolvedRef));
+ // An upstream project is blocked
+ if (refStatus.type === UpToDateStatusType.Unbuildable) {
+ return {
+ type: UpToDateStatusType.UpstreamBlocked,
+ upstreamProjectName: ref.path
+ };
+ }
+ // If the upstream project is out of date, then so are we (someone shouldn't have asked, though?)
+ if (refStatus.type !== UpToDateStatusType.UpToDate) {
+ return {
+ type: UpToDateStatusType.UpstreamOutOfDate,
+ upstreamProjectName: ref.path
+ };
+ }
+ // If the upstream project's newest file is older than our oldest output, we
+ // can't be out of date because of it
+ if (refStatus.newestInputFileTime <= oldestOutputFileTime) {
+ continue;
+ }
+ // If the upstream project has only change .d.ts files, and we've built
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
+ if (refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
+ pseudoUpToDate = true;
+ continue;
+ }
+ // We have an output older than an upstream output - we are out of date
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
+ return {
+ type: UpToDateStatusType.OutOfDateWithUpstream,
+ outOfDateOutputFileName: oldestOutputFileName,
+ newerProjectName: ref.path
+ };
+ }
+ }
+ if (missingOutputFileName !== undefined) {
+ return {
+ type: UpToDateStatusType.OutputMissing,
+ missingOutputFileName: missingOutputFileName
+ };
+ }
+ if (isOutOfDateWithInputs) {
+ return {
+ type: UpToDateStatusType.OutOfDateWithSelf,
+ outOfDateOutputFileName: oldestOutputFileName,
+ newerInputFileName: newestInputFileName
+ };
+ }
+ if (usesPrepend) {
+ pseudoUpToDate = false;
+ }
+ // Up to date
+ return {
+ type: pseudoUpToDate ? UpToDateStatusType.UpToDateWithUpstreamTypes : UpToDateStatusType.UpToDate,
+ newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
+ newestInputFileTime: newestInputFileTime,
+ newestOutputFileTime: newestOutputFileTime,
+ newestInputFileName: newestInputFileName,
+ newestOutputFileName: newestOutputFileName,
+ oldestOutputFileName: oldestOutputFileName
+ };
+ }
+ function getAllProjectOutputs(project) {
+ if (project.options.outFile) {
+ return getOutFileOutputs(project);
+ }
+ else {
+ var outputs = [];
+ for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
+ var inputFile = _a[_i];
+ outputs.push.apply(outputs, getOutputFileNames(inputFile, project));
+ }
+ return outputs;
+ }
+ }
+ ts.getAllProjectOutputs = getAllProjectOutputs;
+ function formatUpToDateStatus(configFileName, status, relName, formatMessage) {
+ switch (status.type) {
+ case UpToDateStatusType.OutOfDateWithSelf:
+ return formatMessage(ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(configFileName), relName(status.outOfDateOutputFileName), relName(status.newerInputFileName));
+ case UpToDateStatusType.OutOfDateWithUpstream:
+ return formatMessage(ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(configFileName), relName(status.outOfDateOutputFileName), relName(status.newerProjectName));
+ case UpToDateStatusType.OutputMissing:
+ return formatMessage(ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(configFileName), relName(status.missingOutputFileName));
+ case UpToDateStatusType.UpToDate:
+ if (status.newestInputFileTime !== undefined) {
+ return formatMessage(ts.Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relName(configFileName), relName(status.newestInputFileName), relName(status.oldestOutputFileName));
+ }
+ // Don't report anything for "up to date because it was already built" -- too verbose
+ break;
+ case UpToDateStatusType.UpToDateWithUpstreamTypes:
+ return formatMessage(ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(configFileName));
+ case UpToDateStatusType.UpstreamOutOfDate:
+ return formatMessage(ts.Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, relName(configFileName), relName(status.upstreamProjectName));
+ case UpToDateStatusType.UpstreamBlocked:
+ return formatMessage(ts.Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, relName(configFileName), relName(status.upstreamProjectName));
+ case UpToDateStatusType.Unbuildable:
+ return formatMessage(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(configFileName), status.reason);
+ case UpToDateStatusType.ContainerOnly:
+ // Don't report status on "solution" projects
+ break;
+ default:
+ ts.assertTypeIsNever(status);
+ }
+ }
+ ts.formatUpToDateStatus = formatUpToDateStatus;
})(ts || (ts = {}));
+
//# sourceMappingURL=compiler.js.map
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
@@ -86572,7 +87053,7 @@ var ts;
case 237 /* TypeAliasDeclaration */:
case 166 /* TypeLiteral */:
return 2 /* Type */;
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
// If it has no name node, it shares the name with the value declaration below it.
return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */;
case 273 /* EnumMember */:
@@ -86823,7 +87304,7 @@ var ts;
case 236 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
case 237 /* TypeAliasDeclaration */:
case 292 /* JSDocCallbackTag */:
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
return "type" /* typeElement */;
case 238 /* EnumDeclaration */: return "enum" /* enumElement */;
case 232 /* VariableDeclaration */:
@@ -87797,6 +88278,17 @@ var ts;
return ts.textSpanContainsPosition(span, node.getStart(file)) &&
node.getEnd() <= ts.textSpanEnd(span);
}
+ /* @internal */
+ function insertImport(changes, sourceFile, importDecl) {
+ var lastImportDeclaration = ts.findLast(sourceFile.statements, ts.isAnyImportSyntax);
+ if (lastImportDeclaration) {
+ changes.insertNodeAfter(sourceFile, lastImportDeclaration, importDecl);
+ }
+ else {
+ changes.insertNodeAtTopOfFile(sourceFile, importDecl, /*blankLineBetween*/ true);
+ }
+ }
+ ts.insertImport = insertImport;
})(ts || (ts = {}));
// Display-part writer helpers
/* @internal */
@@ -88834,11 +89326,11 @@ var ts;
case 293 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 296 /* JSDocTemplateTag */:
+ case 297 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
pos = tag.end;
break;
- case 295 /* JSDocTypeTag */:
+ case 296 /* JSDocTypeTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
@@ -90167,7 +90659,7 @@ var ts;
currentToken = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ true);
if (!currentToken ||
(!ts.isDeclarationName(currentToken) &&
- (currentToken.parent.kind !== 298 /* JSDocPropertyTag */ ||
+ (currentToken.parent.kind !== 299 /* JSDocPropertyTag */ ||
currentToken.parent.name !== currentToken))) {
// Use as type location if inside tag's type expression
insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression);
@@ -90332,10 +90824,10 @@ var ts;
function isTagWithTypeExpression(tag) {
switch (tag.kind) {
case 293 /* JSDocParameterTag */:
- case 298 /* JSDocPropertyTag */:
+ case 299 /* JSDocPropertyTag */:
case 294 /* JSDocReturnTag */:
- case 295 /* JSDocTypeTag */:
- case 297 /* JSDocTypedefTag */:
+ case 296 /* JSDocTypeTag */:
+ case 298 /* JSDocTypedefTag */:
return true;
default:
return false;
@@ -91377,7 +91869,7 @@ var ts;
function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location) {
// class c { method() { } | method2() { } }
switch (location.kind) {
- case 299 /* SyntaxList */:
+ case 300 /* SyntaxList */:
return ts.tryCast(location.parent, ts.isObjectTypeDeclaration);
case 1 /* EndOfFileToken */:
var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration);
@@ -92103,22 +92595,16 @@ var ts;
case 71 /* Identifier */: // for 'const x = require("y");
break; // TODO: GH#23879
case 243 /* ImportEqualsDeclaration */:
- handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1 /* Export */));
+ handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1 /* Export */), /*alreadyAddedDirect*/ false);
break;
case 244 /* ImportDeclaration */:
+ directImports.push(direct);
var namedBindings = direct.importClause && direct.importClause.namedBindings;
if (namedBindings && namedBindings.kind === 246 /* NamespaceImport */) {
- handleNamespaceImport(direct, namedBindings.name);
+ handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true);
}
- else if (ts.isDefaultImport(direct)) {
- var sourceFileLike = getSourceFileLikeForImportDeclaration(direct);
- if (!isAvailableThroughGlobal) {
- addIndirectUser(sourceFileLike); // Add a check for indirect uses to handle synthetic default imports
- }
- directImports.push(direct);
- }
- else {
- directImports.push(direct);
+ else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) {
+ addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports
}
break;
case 250 /* ExportDeclaration */:
@@ -92140,10 +92626,11 @@ var ts;
}
}
}
- function handleNamespaceImport(importDeclaration, name, isReExport) {
+ function handleNamespaceImport(importDeclaration, name, isReExport, alreadyAddedDirect) {
if (exportKind === 2 /* ExportEquals */) {
// This is a direct import, not import-as-namespace.
- directImports.push(importDeclaration);
+ if (!alreadyAddedDirect)
+ directImports.push(importDeclaration);
}
else if (!isAvailableThroughGlobal) {
var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration);
@@ -92231,32 +92718,29 @@ var ts;
searchForNamedImport(decl.exportClause);
return;
}
- var importClause = decl.importClause;
- if (!importClause) {
- return;
- }
- var namedBindings = importClause.namedBindings;
- if (namedBindings && namedBindings.kind === 246 /* NamespaceImport */) {
- handleNamespaceImportLike(namedBindings.name);
- return;
- }
- if (exportKind === 0 /* Named */) {
- searchForNamedImport(namedBindings); // tslint:disable-line no-unnecessary-type-assertion (TODO: GH#18217)
- }
- else {
- // `export =` might be imported by a default import if `--allowSyntheticDefaultImports` is on, so this handles both ExportKind.Default and ExportKind.ExportEquals
- var name = importClause.name;
- // If a default import has the same name as the default export, allow to rename it.
- // Given `import f` and `export default function f`, we will rename both, but for `import g` we will rename just that.
- if (name && (!isForRename || name.escapedText === ts.symbolEscapedNameNoDefault(exportSymbol))) {
- var defaultImportAlias = checker.getSymbolAtLocation(name);
- addSearch(name, defaultImportAlias);
- }
- // 'default' might be accessed as a named import `{ default as foo }`.
- if (exportKind === 1 /* Default */) {
- searchForNamedImport(namedBindings);
+ var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings;
+ if (namedBindings) {
+ switch (namedBindings.kind) {
+ case 246 /* NamespaceImport */:
+ handleNamespaceImportLike(namedBindings.name);
+ break;
+ case 247 /* NamedImports */:
+ // 'default' might be accessed as a named import `{ default as foo }`.
+ if (exportKind === 0 /* Named */ || exportKind === 1 /* Default */) {
+ searchForNamedImport(namedBindings);
+ }
+ break;
+ default:
+ ts.Debug.assertNever(namedBindings);
}
}
+ // `export =` might be imported by a default import if `--allowSyntheticDefaultImports` is on, so this handles both ExportKind.Default and ExportKind.ExportEquals.
+ // If a default import has the same name as the default export, allow to rename it.
+ // Given `import f` and `export default function f`, we will rename both, but for `import g` we will rename just that.
+ if (name && (exportKind === 1 /* Default */ || exportKind === 2 /* ExportEquals */) && (!isForRename || name.escapedText === ts.symbolEscapedNameNoDefault(exportSymbol))) {
+ var defaultImportAlias = checker.getSymbolAtLocation(name);
+ addSearch(name, defaultImportAlias);
+ }
}
/**
* `import x = require("./x") or `import * as x from "./x"`.
@@ -94052,11 +94536,13 @@ var ts;
}
function updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName, preferences) {
var _loop_3 = function (sourceFile) {
- var newImportFromPath = oldToNew(sourceFile.fileName) || sourceFile.fileName;
+ var newFromOld = oldToNew(sourceFile.fileName);
+ var newImportFromPath = newFromOld !== undefined ? newFromOld : sourceFile.fileName;
var newImportFromDirectory = ts.getDirectoryPath(newImportFromPath);
var oldFromNew = newToOld(sourceFile.fileName);
var oldImportFromPath = oldFromNew || sourceFile.fileName;
var oldImportFromDirectory = ts.getDirectoryPath(oldImportFromPath);
+ var importingSourceFileMoved = newFromOld !== undefined || oldFromNew !== undefined;
updateImportsWorker(sourceFile, changeTracker, function (referenceText) {
if (!ts.pathIsRelative(referenceText))
return undefined;
@@ -94069,7 +94555,10 @@ var ts;
// TODO:GH#18217
? getSourceFileToImportFromResolved(ts.resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host), oldToNew, program)
: getSourceFileToImport(importLiteral, sourceFile, program, host, oldToNew);
- return toImport === undefined ? undefined : ts.moduleSpecifiers.getModuleSpecifier(program.getCompilerOptions(), sourceFile, newImportFromPath, toImport, host, preferences);
+ // If neither the importing source file nor the imported file moved, do nothing.
+ return toImport === undefined || !toImport.updated && !importingSourceFileMoved
+ ? undefined
+ : ts.moduleSpecifiers.getModuleSpecifier(program.getCompilerOptions(), sourceFile, newImportFromPath, toImport.newFileName, host, preferences);
});
};
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
@@ -94089,7 +94578,8 @@ var ts;
if (symbol.declarations.some(function (d) { return ts.isAmbientModule(d); }))
return undefined; // No need to update if it's an ambient module
var oldFileName = ts.find(symbol.declarations, ts.isSourceFile).fileName;
- return oldToNew(oldFileName) || oldFileName;
+ var newFileName = oldToNew(oldFileName);
+ return newFileName === undefined ? { newFileName: oldFileName, updated: false } : { newFileName: newFileName, updated: true };
}
else {
var resolved = host.resolveModuleNames
@@ -94103,7 +94593,7 @@ var ts;
function getIfInProgram(oldLocation) {
var newLocation = oldToNew(oldLocation);
return program.getSourceFile(oldLocation) || newLocation !== undefined && program.getSourceFile(newLocation)
- ? newLocation || oldLocation
+ ? newLocation !== undefined ? { newFileName: newLocation, updated: true } : { newFileName: oldLocation, updated: false }
: undefined;
}
}
@@ -94489,10 +94979,10 @@ var ts;
function getCommentHavingNodes(declaration) {
switch (declaration.kind) {
case 293 /* JSDocParameterTag */:
- case 298 /* JSDocPropertyTag */:
+ case 299 /* JSDocPropertyTag */:
return [declaration];
case 292 /* JSDocCallbackTag */:
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
return [declaration, declaration.parent];
default:
return ts.getJSDocCommentsAndTags(declaration);
@@ -94515,13 +95005,13 @@ var ts;
switch (tag.kind) {
case 290 /* JSDocAugmentsTag */:
return withNode(tag.class);
- case 296 /* JSDocTemplateTag */:
+ case 297 /* JSDocTemplateTag */:
return withList(tag.typeParameters);
- case 295 /* JSDocTypeTag */:
+ case 296 /* JSDocTypeTag */:
return withNode(tag.typeExpression);
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
case 292 /* JSDocCallbackTag */:
- case 298 /* JSDocPropertyTag */:
+ case 299 /* JSDocPropertyTag */:
case 293 /* JSDocParameterTag */:
var name = tag.name;
return name ? withNode(name) : comment;
@@ -95348,7 +95838,7 @@ var ts;
case 239 /* ModuleDeclaration */:
case 274 /* SourceFile */:
case 237 /* TypeAliasDeclaration */:
- case 297 /* JSDocTypedefTag */:
+ case 298 /* JSDocTypedefTag */:
case 292 /* JSDocCallbackTag */:
return true;
case 155 /* Constructor */:
@@ -97230,7 +97720,7 @@ var ts;
function getExpressionFromInvocation(invocation) {
return invocation.kind === 0 /* Call */ ? ts.getInvokedExpression(invocation.node) : invocation.called;
}
- var signatureHelpNodeBuilderFlags = 8192 /* OmitParameterModifiers */ | 3112960 /* IgnoreErrors */;
+ var signatureHelpNodeBuilderFlags = 8192 /* OmitParameterModifiers */ | 3112960 /* IgnoreErrors */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
function createSignatureHelpItems(candidates, resolvedSignature, argumentListInfo, sourceFile, typeChecker) {
var argumentCount = argumentListInfo.argumentCount, applicableSpan = argumentListInfo.argumentsSpan, invocation = argumentListInfo.invocation, argumentIndex = argumentListInfo.argumentIndex;
var isTypeParameterList = argumentListInfo.kind === 0 /* TypeArguments */;
@@ -102816,7 +103306,6 @@ var ts;
function getCodeActionForNewImport(context, _a) {
var moduleSpecifier = _a.moduleSpecifier, importKind = _a.importKind;
var sourceFile = context.sourceFile, symbolName = context.symbolName, preferences = context.preferences;
- var lastImportDeclaration = ts.findLast(sourceFile.statements, ts.isAnyImportSyntax);
var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier);
var quotedModuleSpecifier = ts.makeStringLiteral(moduleSpecifierWithoutQuotes, ts.getQuotePreference(sourceFile, preferences));
var importDecl = importKind !== 3 /* Equals */
@@ -102826,14 +103315,7 @@ var ts;
: ts.createImportEqualsDeclaration(
/*decorators*/ undefined,
/*modifiers*/ undefined, ts.createIdentifier(symbolName), ts.createExternalModuleReference(quotedModuleSpecifier));
- var changes = ChangeTracker.with(context, function (changeTracker) {
- if (lastImportDeclaration) {
- changeTracker.insertNodeAfter(sourceFile, lastImportDeclaration, importDecl);
- }
- else {
- changeTracker.insertNodeAtTopOfFile(sourceFile, importDecl, /*blankLineBetween*/ true);
- }
- });
+ var changes = ChangeTracker.with(context, function (t) { return ts.insertImport(t, sourceFile, importDecl); });
// if this file doesn't have any import statements, insert an import statement and then insert a new line
// between the only import statement and user code. Otherwise just insert the statement because chances
// are there are already a new line separating code and import statements.
@@ -102855,7 +103337,7 @@ var ts;
function getNewImportInfos(program, sourceFile, moduleSymbols, host, preferences) {
var choicesForEachExportingModule = ts.flatMap(moduleSymbols, function (_a) {
var moduleSymbol = _a.moduleSymbol, importKind = _a.importKind;
- var modulePathsGroups = ts.moduleSpecifiers.getModuleSpecifiers(moduleSymbol, program, sourceFile, host, preferences);
+ var modulePathsGroups = ts.moduleSpecifiers.getModuleSpecifiers(moduleSymbol, program.getCompilerOptions(), sourceFile, host, program.getSourceFiles(), preferences);
return modulePathsGroups.map(function (group) { return group.map(function (moduleSpecifier) { return ({ moduleSpecifier: moduleSpecifier, importKind: importKind }); }); });
});
// Sort to keep the shortest paths first, but keep [relativePath, importRelativeToBaseUrl] groups together
@@ -105046,22 +105528,6 @@ var ts;
var codefix;
(function (codefix) {
var fixName = "invalidImportSyntax";
- codefix.registerCodeFix({
- errorCodes: [ts.Diagnostics.A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime.code],
- getCodeActions: getActionsForInvalidImport
- });
- function getActionsForInvalidImport(context) {
- var sourceFile = context.sourceFile;
- // This is the whole import statement, eg:
- // import * as Bluebird from 'bluebird';
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- var node = ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false).parent;
- if (!ts.isImportDeclaration(node)) {
- // No import quick fix for import calls
- return [];
- }
- return getCodeFixesForImportDeclaration(context, node);
- }
function getCodeFixesForImportDeclaration(context, node) {
var sourceFile = ts.getSourceFileOfNode(node);
var namespace = ts.getNamespaceDeclarationNode(node);
@@ -105079,7 +105545,7 @@ var ts;
}
function createAction(context, sourceFile, node, replacement) {
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile, node, replacement); });
- return codefix.createCodeFixActionNoFixId("invalidImportSyntax", changes, [ts.Diagnostics.Replace_import_with_0, changes[0].textChanges[0].newText]);
+ return codefix.createCodeFixActionNoFixId(fixName, changes, [ts.Diagnostics.Replace_import_with_0, changes[0].textChanges[0].newText]);
}
codefix.registerCodeFix({
errorCodes: [
@@ -105096,6 +105562,35 @@ var ts;
return [];
}
var expr = node.expression;
+ return getImportCodeFixesForExpression(context, expr);
+ }
+ codefix.registerCodeFix({
+ errorCodes: [
+ // The following error codes cover pretty much all assignability errors that could involve an expression
+ ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,
+ ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code,
+ ts.Diagnostics.Type_0_is_not_assignable_to_type_1.code,
+ ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated.code,
+ ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1.code,
+ ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2.code,
+ ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2.code,
+ ts.Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1.code,
+ ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2.code,
+ ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code,
+ ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property.code,
+ ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1.code,
+ ],
+ getCodeActions: getActionsForInvalidImportLocation
+ });
+ function getActionsForInvalidImportLocation(context) {
+ var sourceFile = context.sourceFile;
+ var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false), function (a) { return a.getStart() === context.span.start && a.getEnd() === (context.span.start + context.span.length); });
+ if (!node) {
+ return [];
+ }
+ return getImportCodeFixesForExpression(context, node);
+ }
+ function getImportCodeFixesForExpression(context, expr) {
var type = context.program.getTypeChecker().getTypeAtLocation(expr); // TODO: GH#18217
if (!(type.symbol && type.symbol.originatingImport)) {
return [];
@@ -105105,8 +105600,11 @@ var ts;
if (!ts.isImportCall(relatedImport)) {
ts.addRange(fixes, getCodeFixesForImportDeclaration(context, relatedImport));
}
- var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile, expr, ts.createPropertyAccess(expr, "default"), {}); });
- fixes.push(codefix.createCodeFixActionNoFixId(fixName, changes, ts.Diagnostics.Use_synthetic_default_member));
+ if (ts.isExpression(expr) && !(ts.isNamedDeclaration(expr.parent) && expr.parent.name === expr)) {
+ var sourceFile_1 = context.sourceFile;
+ var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile_1, expr, ts.createPropertyAccess(expr, "default"), {}); });
+ fixes.push(codefix.createCodeFixActionNoFixId(fixName, changes, ts.Diagnostics.Use_synthetic_default_member));
+ }
return fixes;
}
})(codefix = ts.codefix || (ts.codefix = {}));
@@ -107299,7 +107797,7 @@ var ts;
var quotePreference = ts.getQuotePreference(oldFile, preferences);
var importsFromNewFile = createOldFileImportsFromNewFile(usage.oldFileImportsFromNewFile, newModuleName, useEs6ModuleSyntax, quotePreference);
if (importsFromNewFile) {
- changes.insertNodeBefore(oldFile, oldFile.statements[0], importsFromNewFile, /*blankLineBetween*/ true);
+ ts.insertImport(changes, oldFile, importsFromNewFile);
}
deleteUnusedOldImports(oldFile, toMove.all, changes, usage.unusedImportsFromOldFile, checker);
deleteMovedStatements(oldFile, toMove.ranges, changes);
@@ -107949,250 +108447,6 @@ var ts;
})(addOrRemoveBracesToArrowFunction = refactor.addOrRemoveBracesToArrowFunction || (refactor.addOrRemoveBracesToArrowFunction = {}));
})(refactor = ts.refactor || (ts.refactor = {}));
})(ts || (ts = {}));
-/* @internal */
-var ts;
-(function (ts) {
- var sourcemaps;
- (function (sourcemaps) {
- sourcemaps.identitySourceMapper = { getOriginalPosition: ts.identity, getGeneratedPosition: ts.identity };
- function decode(host, mapPath, map, program, fallbackCache) {
- if (fallbackCache === void 0) { fallbackCache = ts.createSourceFileLikeCache(host); }
- var currentDirectory = ts.getDirectoryPath(mapPath);
- var sourceRoot = map.sourceRoot || currentDirectory;
- var decodedMappings;
- var generatedOrderedMappings;
- var sourceOrderedMappings;
- return {
- getOriginalPosition: getOriginalPosition,
- getGeneratedPosition: getGeneratedPosition
- };
- function getGeneratedPosition(loc) {
- var maps = getGeneratedOrderedMappings();
- if (!ts.length(maps))
- return loc;
- var targetIndex = ts.binarySearch(maps, { sourcePath: loc.fileName, sourcePosition: loc.position }, ts.identity, compareProcessedPositionSourcePositions);
- if (targetIndex < 0 && maps.length > 0) {
- // if no exact match, closest is 2's compliment of result
- targetIndex = ~targetIndex;
- }
- if (!maps[targetIndex] || ts.comparePaths(loc.fileName, maps[targetIndex].sourcePath, sourceRoot) !== 0) {
- return loc;
- }
- return { fileName: ts.toPath(map.file, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].emittedPosition }; // Closest pos
- }
- function getOriginalPosition(loc) {
- var maps = getSourceOrderedMappings();
- if (!ts.length(maps))
- return loc;
- var targetIndex = ts.binarySearch(maps, { emittedPosition: loc.position }, ts.identity, compareProcessedPositionEmittedPositions);
- if (targetIndex < 0 && maps.length > 0) {
- // if no exact match, closest is 2's compliment of result
- targetIndex = ~targetIndex;
- }
- return { fileName: ts.toPath(maps[targetIndex].sourcePath, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].sourcePosition }; // Closest pos
- }
- function getSourceFileLike(fileName, location) {
- // Lookup file in program, if provided
- var file = program && program.getSourceFile(fileName);
- if (!file) {
- // Otherwise check the cache (which may hit disk)
- var path = ts.toPath(fileName, location, host.getCanonicalFileName);
- return fallbackCache.get(path);
- }
- return file;
- }
- function getPositionOfLineAndCharacterUsingName(fileName, directory, line, character) {
- var file = getSourceFileLike(fileName, directory);
- if (!file) {
- return -1;
- }
- return ts.getPositionOfLineAndCharacter(file, line, character);
- }
- function getDecodedMappings() {
- return decodedMappings || (decodedMappings = calculateDecodedMappings());
- }
- function getSourceOrderedMappings() {
- return sourceOrderedMappings || (sourceOrderedMappings = getDecodedMappings().slice().sort(compareProcessedPositionSourcePositions));
- }
- function getGeneratedOrderedMappings() {
- return generatedOrderedMappings || (generatedOrderedMappings = getDecodedMappings().slice().sort(compareProcessedPositionEmittedPositions));
- }
- function calculateDecodedMappings() {
- var state = {
- encodedText: map.mappings,
- currentNameIndex: undefined,
- sourceMapNamesLength: map.names ? map.names.length : undefined,
- currentEmittedColumn: 0,
- currentEmittedLine: 0,
- currentSourceColumn: 0,
- currentSourceLine: 0,
- currentSourceIndex: 0,
- positions: [],
- decodingIndex: 0,
- processPosition: processPosition,
- };
- while (!hasCompletedDecoding(state)) {
- decodeSinglePosition(state);
- if (state.error) {
- host.log("Encountered error while decoding sourcemap found at " + mapPath + ": " + state.error);
- return [];
- }
- }
- return state.positions;
- }
- function compareProcessedPositionSourcePositions(a, b) {
- return ts.comparePaths(a.sourcePath, b.sourcePath, sourceRoot) ||
- ts.compareValues(a.sourcePosition, b.sourcePosition);
- }
- function compareProcessedPositionEmittedPositions(a, b) {
- return ts.compareValues(a.emittedPosition, b.emittedPosition);
- }
- function processPosition(position) {
- var sourcePath = map.sources[position.sourceIndex];
- return {
- emittedPosition: getPositionOfLineAndCharacterUsingName(map.file, currentDirectory, position.emittedLine, position.emittedColumn),
- sourcePosition: getPositionOfLineAndCharacterUsingName(sourcePath, sourceRoot, position.sourceLine, position.sourceColumn),
- sourcePath: sourcePath,
- };
- }
- }
- sourcemaps.decode = decode;
- function hasCompletedDecoding(state) {
- return state.decodingIndex === state.encodedText.length;
- }
- function decodeSinglePosition(state) {
- while (state.decodingIndex < state.encodedText.length) {
- var char = state.encodedText.charCodeAt(state.decodingIndex);
- if (char === 59 /* semicolon */) {
- // New line
- state.currentEmittedLine++;
- state.currentEmittedColumn = 0;
- state.decodingIndex++;
- continue;
- }
- if (char === 44 /* comma */) {
- // Next entry is on same line - no action needed
- state.decodingIndex++;
- continue;
- }
- // Read the current position
- // 1. Column offset from prev read jsColumn
- state.currentEmittedColumn += base64VLQFormatDecode();
- // Incorrect emittedColumn dont support this map
- if (createErrorIfCondition(state.currentEmittedColumn < 0, "Invalid emittedColumn found")) {
- return;
- }
- // Dont support reading mappings that dont have information about original source and its line numbers
- if (createErrorIfCondition(isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: No entries after emitted column")) {
- return;
- }
- // 2. Relative sourceIndex
- state.currentSourceIndex += base64VLQFormatDecode();
- // Incorrect sourceIndex dont support this map
- if (createErrorIfCondition(state.currentSourceIndex < 0, "Invalid sourceIndex found")) {
- return;
- }
- // Dont support reading mappings that dont have information about original source position
- if (createErrorIfCondition(isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: No entries after sourceIndex")) {
- return;
- }
- // 3. Relative sourceLine 0 based
- state.currentSourceLine += base64VLQFormatDecode();
- // Incorrect sourceLine dont support this map
- if (createErrorIfCondition(state.currentSourceLine < 0, "Invalid sourceLine found")) {
- return;
- }
- // Dont support reading mappings that dont have information about original source and its line numbers
- if (createErrorIfCondition(isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: No entries after emitted Line")) {
- return;
- }
- // 4. Relative sourceColumn 0 based
- state.currentSourceColumn += base64VLQFormatDecode();
- // Incorrect sourceColumn dont support this map
- if (createErrorIfCondition(state.currentSourceColumn < 0, "Invalid sourceLine found")) {
- return;
- }
- // 5. Check if there is name:
- if (!isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex)) {
- if (state.currentNameIndex === undefined) {
- state.currentNameIndex = 0;
- }
- state.currentNameIndex += base64VLQFormatDecode();
- // Incorrect nameIndex dont support this map
- // TODO: If we start using `name`s, issue errors when they aren't correct in the sourcemap
- // if (createErrorIfCondition(state.currentNameIndex < 0 || state.currentNameIndex >= state.sourceMapNamesLength, "Invalid name index for the source map entry")) {
- // return;
- // }
- }
- // Dont support reading mappings that dont have information about original source and its line numbers
- if (createErrorIfCondition(!isSourceMappingSegmentEnd(state.encodedText, state.decodingIndex), "Unsupported Error Format: There are more entries after " + (state.currentNameIndex === undefined ? "sourceColumn" : "nameIndex"))) {
- return;
- }
- // Entry should be complete
- capturePosition();
- return;
- }
- createErrorIfCondition(/*condition*/ true, "No encoded entry found");
- return;
- function capturePosition() {
- state.positions.push(state.processPosition({
- emittedColumn: state.currentEmittedColumn,
- emittedLine: state.currentEmittedLine,
- sourceColumn: state.currentSourceColumn,
- sourceIndex: state.currentSourceIndex,
- sourceLine: state.currentSourceLine,
- nameIndex: state.currentNameIndex
- }));
- }
- function createErrorIfCondition(condition, errormsg) {
- if (state.error) {
- // An error was already reported
- return true;
- }
- if (condition) {
- state.error = errormsg;
- }
- return condition;
- }
- function base64VLQFormatDecode() {
- var moreDigits = true;
- var shiftCount = 0;
- var value = 0;
- for (; moreDigits; state.decodingIndex++) {
- if (createErrorIfCondition(state.decodingIndex >= state.encodedText.length, "Error in decoding base64VLQFormatDecode, past the mapping string")) {
- return undefined; // TODO: GH#18217
- }
- // 6 digit number
- var currentByte = base64FormatDecode(state.encodedText.charAt(state.decodingIndex));
- // If msb is set, we still have more bits to continue
- moreDigits = (currentByte & 32) !== 0;
- // least significant 5 bits are the next msbs in the final value.
- value = value | ((currentByte & 31) << shiftCount);
- shiftCount += 5;
- }
- // Least significant bit if 1 represents negative and rest of the msb is actual absolute value
- if ((value & 1) === 0) {
- // + number
- value = value >> 1;
- }
- else {
- // - number
- value = value >> 1;
- value = -value;
- }
- return value;
- }
- }
- function base64FormatDecode(char) {
- return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(char);
- }
- function isSourceMappingSegmentEnd(encodedText, pos) {
- return (pos === encodedText.length ||
- encodedText.charCodeAt(pos) === 44 /* comma */ ||
- encodedText.charCodeAt(pos) === 59 /* semicolon */);
- }
- })(sourcemaps = ts.sourcemaps || (ts.sourcemaps = {}));
-})(ts || (ts = {}));
var ts;
(function (ts) {
/** The version of the language service API */
@@ -108272,7 +108526,7 @@ var ts;
if (!children.length) {
return undefined;
}
- var child = ts.find(children, function (kid) { return kid.kind < 278 /* FirstJSDocNode */ || kid.kind > 298 /* LastJSDocNode */; });
+ var child = ts.find(children, function (kid) { return kid.kind < 278 /* FirstJSDocNode */ || kid.kind > 299 /* LastJSDocNode */; });
return child.kind < 146 /* FirstNode */ ?
child :
child.getFirstToken(sourceFile);
@@ -108342,7 +108596,7 @@ var ts;
}
}
function createSyntaxList(nodes, parent) {
- var list = createNode(299 /* SyntaxList */, nodes.pos, nodes.end, parent);
+ var list = createNode(300 /* SyntaxList */, nodes.pos, nodes.end, parent);
list._children = [];
var pos = nodes.pos;
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
@@ -109058,31 +109312,6 @@ var ts;
return ThrottledCancellationToken;
}());
ts.ThrottledCancellationToken = ThrottledCancellationToken;
- /* @internal */
- function createSourceFileLikeCache(host) {
- var cached = ts.createMap();
- return {
- get: function (path) {
- if (cached.has(path)) {
- return cached.get(path);
- }
- if (!host.fileExists || !host.readFile || !host.fileExists(path))
- return;
- // And failing that, check the disk
- var text = host.readFile(path); // TODO: GH#18217
- var file = {
- text: text,
- lineMap: undefined,
- getLineAndCharacterOfPosition: function (pos) {
- return ts.computeLineAndCharacterOfPosition(ts.getLineStarts(this), pos);
- }
- };
- cached.set(path, file);
- return file;
- }
- };
- }
- ts.createSourceFileLikeCache = createSourceFileLikeCache;
function createLanguageService(host, documentRegistry, syntaxOnly) {
if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); }
if (syntaxOnly === void 0) { syntaxOnly = false; }
@@ -109202,7 +109431,7 @@ var ts;
// We reset this cache on structure invalidation so we don't hold on to outdated files for long; however we can't use the `compilerHost` above,
// Because it only functions until `hostCache` is cleared, while we'll potentially need the functionality to lazily read sourcemap files during
// the course of whatever called `synchronizeHostData`
- sourcemappedFileCache = createSourceFileLikeCache(host);
+ sourcemappedFileCache = ts.createSourceFileLikeCache(host);
// Make sure all the nodes in the program are both bound, and have their parent
// pointers set property.
program.getTypeChecker();
@@ -111574,6 +111803,7 @@ var TypeScript;
// TODO: it should be moved into a namespace though.
/* @internal */
var toolsVersion = ts.versionMajorMinor;
+
//# sourceMappingURL=services.js.map
"use strict";
/* @internal */
@@ -111984,6 +112214,7 @@ var ts;
}());
ts.Semver = Semver;
})(ts || (ts = {}));
+
//# sourceMappingURL=jsTyping.js.map
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
@@ -115613,7 +115844,23 @@ var ts;
code: diag.code,
category: ts.diagnosticCategoryName(diag),
reportsUnnecessary: diag.reportsUnnecessary,
- source: diag.source
+ source: diag.source,
+ relatedInformation: ts.map(diag.relatedInformation, formatRelatedInformation),
+ };
+ }
+ function formatRelatedInformation(info) {
+ if (!info.file) {
+ return {
+ message: ts.flattenDiagnosticMessageText(info.messageText, "\n")
+ };
+ }
+ return {
+ span: {
+ start: convertToLocation(ts.getLineAndCharacterOfPosition(info.file, info.start)),
+ end: convertToLocation(ts.getLineAndCharacterOfPosition(info.file, info.start + info.length)),
+ file: info.file.fileName
+ },
+ message: ts.flattenDiagnosticMessageText(info.messageText, "\n")
};
}
function convertToLocation(lineAndCharacter) {
@@ -115625,8 +115872,18 @@ var ts;
var text = ts.flattenDiagnosticMessageText(diag.messageText, "\n");
var code = diag.code, source = diag.source;
var category = ts.diagnosticCategoryName(diag);
- return includeFileName ? { start: start, end: end, text: text, code: code, category: category, source: source, reportsUnnecessary: diag.reportsUnnecessary, fileName: diag.file && diag.file.fileName } :
- { start: start, end: end, text: text, code: code, category: category, reportsUnnecessary: diag.reportsUnnecessary, source: source };
+ var common = {
+ start: start,
+ end: end,
+ text: text,
+ code: code,
+ category: category,
+ reportsUnnecessary: diag.reportsUnnecessary,
+ source: source,
+ relatedInformation: ts.map(diag.relatedInformation, formatRelatedInformation),
+ };
+ return includeFileName
+ ? __assign({}, common, { fileName: diag.file && diag.file.fileName }) : common;
}
function allEditsBeforePos(edits, pos) {
for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) {
@@ -116292,7 +116549,8 @@ var ts;
category: ts.diagnosticCategoryName(d),
code: d.code,
startLocation: (d.file && convertToLocation(ts.getLineAndCharacterOfPosition(d.file, d.start))),
- endLocation: (d.file && convertToLocation(ts.getLineAndCharacterOfPosition(d.file, d.start + d.length)))
+ endLocation: (d.file && convertToLocation(ts.getLineAndCharacterOfPosition(d.file, d.start + d.length))),
+ relatedInformation: ts.map(d.relatedInformation, formatRelatedInformation)
}); });
};
Session.prototype.getCompilerOptionsDiagnostics = function (args) {
@@ -116310,7 +116568,8 @@ var ts;
source: d.source,
startLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start),
endLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start + d.length),
- reportsUnnecessary: d.reportsUnnecessary
+ reportsUnnecessary: d.reportsUnnecessary,
+ relatedInformation: ts.map(d.relatedInformation, formatRelatedInformation),
}); });
};
Session.prototype.getDiagnosticsWorker = function (args, isSemantic, selector, includeLinePosition) {
@@ -118160,8 +118419,8 @@ var ts;
}());
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
+
//# sourceMappingURL=server.js.map
-// tslint:disable no-unnecessary-type-assertion (TODO: tslint can't find node types)
var ts;
(function (ts) {
var server;
@@ -118213,7 +118472,7 @@ var ts;
output: process.stdout,
terminal: false,
});
- var Logger = /** @class */ (function () {
+ var Logger = (function () {
function Logger(logFilename, traceToConsole, level) {
this.logFilename = logFilename;
this.traceToConsole = traceToConsole;
@@ -118227,7 +118486,6 @@ var ts;
this.fd = fs.openSync(this.logFilename, "w");
}
catch (_) {
- // swallow the error and keep logging disabled if file cannot be opened
}
}
}
@@ -118288,8 +118546,7 @@ var ts;
Logger.prototype.write = function (s) {
if (this.fd >= 0) {
var buf = new Buffer(s);
- // tslint:disable-next-line no-null-keyword
- fs.writeSync(this.fd, buf, 0, buf.length, /*position*/ null); // TODO: GH#18217
+ fs.writeSync(this.fd, buf, 0, buf.length, null);
}
if (this.traceToConsole) {
console.warn(s);
@@ -118297,7 +118554,7 @@ var ts;
};
return Logger;
}());
- var NodeTypingsInstaller = /** @class */ (function () {
+ var NodeTypingsInstaller = (function () {
function NodeTypingsInstaller(telemetryEnabled, logger, host, globalTypingsCacheLocation, typingSafeListLocation, typesMapLocation, npmLocation, event) {
this.telemetryEnabled = telemetryEnabled;
this.logger = logger;
@@ -118309,12 +118566,11 @@ var ts;
this.event = event;
this.activeRequestCount = 0;
this.requestQueue = [];
- this.requestMap = ts.createMap(); // Maps operation ID to newest requestQueue entry with that ID
+ this.requestMap = ts.createMap();
}
NodeTypingsInstaller.prototype.isKnownTypesPackageName = function (name) {
- // We want to avoid looking this up in the registry as that is expensive. So first check that it's actually an NPM package.
var validationResult = ts.JsTyping.validatePackageName(name);
- if (validationResult !== 0 /* Ok */) {
+ if (validationResult !== 0) {
return false;
}
if (this.requestedRegistry) {
@@ -118360,8 +118616,6 @@ var ts;
var arg = _a[_i];
var match = /^--((?:debug|inspect)(?:-brk)?)(?:=(\d+))?$/.exec(arg);
if (match) {
- // if port is specified - use port + 1
- // otherwise pick a default port depending on if 'debug' or 'inspect' and use its value + 1
var currentPort = match[2] !== undefined
? +match[2]
: match[1].charAt(0) === "d" ? 5858 : 9229;
@@ -118427,7 +118681,6 @@ var ts;
}
this.packageInstalledPromise = undefined;
this.projectService.updateTypingsForProject(response);
- // The behavior is the same as for setTypings, so send the same event.
this.event(response, "setTypings");
break;
}
@@ -118512,16 +118765,11 @@ var ts;
this.activeRequestCount++;
this.host.setTimeout(request.operation, NodeTypingsInstaller.requestDelayMillis);
};
- // This number is essentially arbitrary. Processing more than one typings request
- // at a time makes sense, but having too many in the pipe results in a hang
- // (see https://github.com/nodejs/node/issues/7657).
- // It would be preferable to base our limit on the amount of space left in the
- // buffer, but we have yet to find a way to retrieve that value.
NodeTypingsInstaller.maxActiveRequestCount = 10;
NodeTypingsInstaller.requestDelayMillis = 100;
return NodeTypingsInstaller;
}());
- var IOSession = /** @class */ (function (_super) {
+ var IOSession = (function (_super) {
__extends(IOSession, _super);
function IOSession() {
var _this = this;
@@ -118530,10 +118778,6 @@ var ts;
_this.event(body, eventName);
}
else {
- // It is unsafe to dereference `this` before initialization completes,
- // so we defer until the next tick.
- //
- // Construction should finish before the next tick fires, so we do not need to do this recursively.
setImmediate(function () { return _this.event(body, eventName); });
}
};
@@ -118563,7 +118807,6 @@ var ts;
var s_1 = net.connect({ port: _this.eventPort }, function () {
_this.eventSocket = s_1;
if (_this.socketEventQueue) {
- // flush queue.
for (var _i = 0, _a = _this.socketEventQueue; _i < _a.length; _i++) {
var event_1 = _a[_i];
_this.writeToEventSocket(event_1.body, event_1.eventName);
@@ -118647,13 +118890,13 @@ var ts;
function getEntireValue(initialIndex) {
var pathStart = args[initialIndex];
var extraPartCounter = 0;
- if (pathStart.charCodeAt(0) === 34 /* doubleQuote */ &&
- pathStart.charCodeAt(pathStart.length - 1) !== 34 /* doubleQuote */) {
+ if (pathStart.charCodeAt(0) === 34 &&
+ pathStart.charCodeAt(pathStart.length - 1) !== 34) {
for (var i = initialIndex + 1; i < args.length; i++) {
pathStart += " ";
pathStart += args[i];
extraPartCounter++;
- if (pathStart.charCodeAt(pathStart.length - 1) === 34 /* doubleQuote */)
+ if (pathStart.charCodeAt(pathStart.length - 1) === 34)
break;
}
}
@@ -118671,7 +118914,6 @@ var ts;
}
return undefined;
}
- // TSS_LOG "{ level: "normal | verbose | terse", file?: string}"
function createLogger() {
var cmdLineLogFileName = server.findArgument("--logFile");
var cmdLineVerbosity = getLogLevel(server.findArgument("--logVerbosity"));
@@ -118682,12 +118924,8 @@ var ts;
? envLogOptions.file || (__dirname + "/.log" + process.pid.toString())
: undefined;
var logVerbosity = cmdLineVerbosity || envLogOptions.detailLevel;
- return new Logger(logFileName, envLogOptions.traceToConsole, logVerbosity); // TODO: GH#18217
+ return new Logger(logFileName, envLogOptions.traceToConsole, logVerbosity);
}
- // This places log file in the directory containing editorServices.js
- // TODO: check that this location is writable
- // average async stat takes about 30 microseconds
- // set chunk size to do 30 files in < 1 millisecond
function createPollingWatchedFileSet(interval, chunkSize) {
if (interval === void 0) { interval = 2500; }
if (chunkSize === void 0) { chunkSize = 30; }
@@ -118719,9 +118957,6 @@ var ts;
}
});
}
- // this implementation uses polling and
- // stat due to inconsistencies of fs.watch
- // and efficiency of stat on modern filesystems
function startWatchTimer() {
setInterval(function () {
var count = 0;
@@ -118747,7 +118982,7 @@ var ts;
callback: callback,
mtime: sys.fileExists(fileName)
? getModifiedTime(fileName)
- : ts.missingFileModifiedTime // Any subsequent modification will occur after this time
+ : ts.missingFileModifiedTime
};
watchedFiles.push(file);
if (watchedFiles.length === 1) {
@@ -118759,19 +118994,6 @@ var ts;
ts.unorderedRemoveItem(watchedFiles, file);
}
}
- // REVIEW: for now this implementation uses polling.
- // The advantage of polling is that it works reliably
- // on all os and with network mounted files.
- // For 90 referenced files, the average time to detect
- // changes is 2*msInterval (by default 5 seconds).
- // The overhead of this is .04 percent (1/2500) with
- // average pause of < 1 millisecond (and max
- // pause less than 1.5 milliseconds); question is
- // do we anticipate reference sets in the 100s and
- // do we care about waiting 10-20 seconds to detect
- // changes for large reference sets? If so, do we want
- // to increase the chunk size or decrease the interval
- // time dynamically to match the large reference set?
var pollingWatchedFileSet = createPollingWatchedFileSet();
var pending = [];
var canWrite = true;
@@ -118793,40 +119015,30 @@ var ts;
function extractWatchDirectoryCacheKey(path, currentDriveKey) {
path = ts.normalizeSlashes(path);
if (isUNCPath(path)) {
- // UNC path: extract server name
- // //server/location
- // ^ <- from 0 to this position
var firstSlash = path.indexOf(ts.directorySeparator, 2);
return firstSlash !== -1 ? path.substring(0, firstSlash).toLowerCase() : path;
}
var rootLength = ts.getRootLength(path);
if (rootLength === 0) {
- // relative path - assume file is on the current drive
return currentDriveKey;
}
- if (path.charCodeAt(1) === 58 /* colon */ && path.charCodeAt(2) === 47 /* slash */) {
- // rooted path that starts with c:/... - extract drive letter
+ if (path.charCodeAt(1) === 58 && path.charCodeAt(2) === 47) {
return path.charAt(0).toLowerCase();
}
- if (path.charCodeAt(0) === 47 /* slash */ && path.charCodeAt(1) !== 47 /* slash */) {
- // rooted path that starts with slash - /somename - use key for current drive
+ if (path.charCodeAt(0) === 47 && path.charCodeAt(1) !== 47) {
return currentDriveKey;
}
- // do not cache any other cases
return undefined;
}
function isUNCPath(s) {
- return s.length > 2 && s.charCodeAt(0) === 47 /* slash */ && s.charCodeAt(1) === 47 /* slash */;
+ return s.length > 2 && s.charCodeAt(0) === 47 && s.charCodeAt(1) === 47;
}
var logger = createLogger();
var sys = ts.sys;
var nodeVersion = ts.getNodeMajorVersion();
- // use watchGuard process on Windows when node version is 4 or later
var useWatchGuard = process.platform === "win32" && nodeVersion >= 4;
var originalWatchDirectory = sys.watchDirectory.bind(sys);
var noopWatcher = { close: ts.noop };
- // This is the function that catches the exceptions when watching directory, and yet lets project service continue to function
- // Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
function watchDirectorySwallowingException(path, callback, recursive) {
try {
return originalWatchDirectory(path, callback, recursive);
@@ -118837,7 +119049,7 @@ var ts;
}
}
if (useWatchGuard) {
- var currentDrive_1 = extractWatchDirectoryCacheKey(sys.resolvePath(sys.getCurrentDirectory()), /*currentDriveKey*/ undefined);
+ var currentDrive_1 = extractWatchDirectoryCacheKey(sys.resolvePath(sys.getCurrentDirectory()), undefined);
var statusCache_1 = ts.createMap();
sys.watchDirectory = function (path, callback, recursive) {
var cacheKey = extractWatchDirectoryCacheKey(path, currentDrive_1);
@@ -118871,11 +119083,9 @@ var ts;
logger.info("watchDirectory for " + path + " uses cached drive information.");
}
if (status) {
- // this drive is safe to use - call real 'watchDirectory'
return watchDirectorySwallowingException(path, callback, recursive);
}
else {
- // this drive is unsafe - return no-op watcher
return noopWatcher;
}
};
@@ -118883,7 +119093,6 @@ var ts;
else {
sys.watchDirectory = watchDirectorySwallowingException;
}
- // Override sys.write because fs.writeSync is not reliable on Node 4
sys.write = function (s) { return writeMessage(new Buffer(s, "utf8")); };
sys.watchFile = function (fileName, callback) {
var watchedFile = pollingWatchedFileSet.addFile(fileName, callback);
@@ -118927,7 +119136,7 @@ var ts;
ts.validateLocaleAndSetLanguage(localeStr, sys);
}
ts.setStackTraceLimit();
- var typingSafeListLocation = server.findArgument(server.Arguments.TypingSafeListLocation); // TODO: GH#18217
+ var typingSafeListLocation = server.findArgument(server.Arguments.TypingSafeListLocation);
var typesMapLocation = server.findArgument(server.Arguments.TypesMapLocation) || ts.combinePaths(sys.getExecutingFilePath(), "../typesMap.json");
var npmLocation = server.findArgument(server.Arguments.NpmLocation);
function parseStringArray(argName) {
@@ -118955,11 +119164,9 @@ var ts;
process.on("uncaughtException", function (err) {
ioSession.logError(err, "unknown");
});
- // See https://github.com/Microsoft/TypeScript/issues/11348
- // tslint:disable-next-line no-unnecessary-type-assertion-2
process.noAsar = true;
- // Start listening
ioSession.listen();
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
-//# sourceMappingURL=tsserver.js.map
\ No newline at end of file
+
+//# sourceMappingURL=tsserver.js.map
diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts
index 6de868d459..785921fa68 100644
--- a/lib/tsserverlibrary.d.ts
+++ b/lib/tsserverlibrary.d.ts
@@ -14,7 +14,6 @@ and limitations under the License.
***************************************************************************** */
-
declare namespace ts {
const versionMajorMinor = "3.0";
/** The version of the TypeScript compiler release */
@@ -889,17 +888,18 @@ declare namespace ts {
JSDocCallbackTag = 292,
JSDocParameterTag = 293,
JSDocReturnTag = 294,
- JSDocTypeTag = 295,
- JSDocTemplateTag = 296,
- JSDocTypedefTag = 297,
- JSDocPropertyTag = 298,
- SyntaxList = 299,
- NotEmittedStatement = 300,
- PartiallyEmittedExpression = 301,
- CommaListExpression = 302,
- MergeDeclarationMarker = 303,
- EndOfDeclarationMarker = 304,
- Count = 305,
+ JSDocThisTag = 295,
+ JSDocTypeTag = 296,
+ JSDocTemplateTag = 297,
+ JSDocTypedefTag = 298,
+ JSDocPropertyTag = 299,
+ SyntaxList = 300,
+ NotEmittedStatement = 301,
+ PartiallyEmittedExpression = 302,
+ CommaListExpression = 303,
+ MergeDeclarationMarker = 304,
+ EndOfDeclarationMarker = 305,
+ Count = 306,
FirstAssignment = 58,
LastAssignment = 70,
FirstCompoundAssignment = 59,
@@ -926,9 +926,9 @@ declare namespace ts {
LastBinaryOperator = 70,
FirstNode = 146,
FirstJSDocNode = 278,
- LastJSDocNode = 298,
+ LastJSDocNode = 299,
FirstJSDocTagNode = 289,
- LastJSDocTagNode = 298,
+ LastJSDocTagNode = 299,
FirstContextualKeyword = 117,
LastContextualKeyword = 145
}
@@ -2164,6 +2164,10 @@ declare namespace ts {
interface JSDocClassTag extends JSDocTag {
kind: SyntaxKind.JSDocClassTag;
}
+ interface JSDocThisTag extends JSDocTag {
+ kind: SyntaxKind.JSDocThisTag;
+ typeExpression?: JSDocTypeExpression;
+ }
interface JSDocTemplateTag extends JSDocTag {
kind: SyntaxKind.JSDocTemplateTag;
typeParameters: NodeArray;
@@ -2376,13 +2380,16 @@ declare namespace ts {
interface InputFiles extends Node {
kind: SyntaxKind.InputFiles;
javascriptText: string;
+ javascriptMapPath?: string;
javascriptMapText?: string;
declarationText: string;
+ declarationMapPath?: string;
declarationMapText?: string;
}
interface UnparsedSource extends Node {
kind: SyntaxKind.UnparsedSource;
text: string;
+ sourceMapPath?: string;
sourceMapText?: string;
}
interface JsonSourceFile extends SourceFile {
@@ -2415,6 +2422,14 @@ declare namespace ts {
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;
+ };
type WriteFileCallback = (fileName: string, data: string, writeByteOrderMark: boolean, onError: ((message: string) => void) | undefined, sourceFiles?: ReadonlyArray) => void;
class OperationCanceledException {
}
@@ -2521,7 +2536,7 @@ declare namespace ts {
sourceMapFile: string;
sourceMapSourceRoot: string;
sourceMapSources: string[];
- sourceMapSourcesContent?: string[];
+ sourceMapSourcesContent?: (string | null)[];
inputSourceFileNames: string[];
sourceMapNames?: string[];
sourceMapMappings: string;
@@ -3569,16 +3584,19 @@ declare namespace ts {
code: number;
next?: DiagnosticMessageChain;
}
- interface Diagnostic {
- file: SourceFile | undefined;
- start: number | undefined;
- length: number | undefined;
- messageText: string | DiagnosticMessageChain;
+ 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;
+ relatedInformation?: DiagnosticRelatedInformation[];
+ }
+ interface DiagnosticRelatedInformation {
+ file: SourceFile | undefined;
+ start: number | undefined;
+ length: number | undefined;
+ messageText: string | DiagnosticMessageChain;
}
interface DiagnosticWithLocation extends Diagnostic {
file: SourceFile;
@@ -3970,6 +3988,14 @@ declare namespace ts {
tab = 9,
verticalTab = 11
}
+ interface UpToDateHost {
+ fileExists(fileName: string): boolean;
+ getModifiedTime(fileName: string): Date;
+ getUnchangedTime?(fileName: string): Date | undefined;
+ getLastStatus?(fileName: string): UpToDateStatus | undefined;
+ setLastStatus?(fileName: string, status: UpToDateStatus): void;
+ parseConfigFile?(configFilePath: ResolvedConfigFileName): ParsedCommandLine | undefined;
+ }
interface ModuleResolutionHost {
fileExists(fileName: string): boolean;
readFile(fileName: string): string | undefined;
@@ -4468,6 +4494,7 @@ declare namespace ts {
useCaseSensitiveFileNames?(): boolean;
fileExists?(path: string): boolean;
readFile?(path: string): string | undefined;
+ getSourceFiles?(): ReadonlyArray;
}
/** @deprecated See comment on SymbolWriter */
interface SymbolTracker {
@@ -5754,7 +5781,7 @@ declare namespace ts {
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;
- A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime: 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;
You_cannot_rename_this_element: DiagnosticMessage;
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: DiagnosticMessage;
@@ -6117,7 +6144,7 @@ declare namespace ts {
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): 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;
@@ -6222,6 +6249,8 @@ declare namespace ts {
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.
@@ -6358,7 +6387,7 @@ declare namespace ts {
function getExpressionAssociativity(expression: Expression): Associativity;
function getOperatorAssociativity(kind: SyntaxKind, operator: SyntaxKind, hasArguments?: boolean): Associativity;
function getExpressionPrecedence(expression: Expression): number;
- function getOperator(expression: Expression): SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.NumericLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.Identifier | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.LetKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.StaticKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AbstractKeyword | SyntaxKind.AsKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.GetKeyword | SyntaxKind.InferKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.SetKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.TypeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.FromKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.OfKeyword | SyntaxKind.QualifiedName | SyntaxKind.ComputedPropertyName | SyntaxKind.TypeParameter | SyntaxKind.Parameter | SyntaxKind.Decorator | SyntaxKind.PropertySignature | SyntaxKind.PropertyDeclaration | SyntaxKind.MethodSignature | SyntaxKind.MethodDeclaration | SyntaxKind.Constructor | SyntaxKind.GetAccessor | SyntaxKind.SetAccessor | SyntaxKind.CallSignature | SyntaxKind.ConstructSignature | SyntaxKind.IndexSignature | SyntaxKind.TypePredicate | SyntaxKind.TypeReference | SyntaxKind.FunctionType | SyntaxKind.ConstructorType | SyntaxKind.TypeQuery | SyntaxKind.TypeLiteral | SyntaxKind.ArrayType | SyntaxKind.TupleType | SyntaxKind.UnionType | SyntaxKind.IntersectionType | SyntaxKind.ConditionalType | SyntaxKind.InferType | SyntaxKind.ParenthesizedType | SyntaxKind.ThisType | SyntaxKind.TypeOperator | SyntaxKind.IndexedAccessType | SyntaxKind.MappedType | SyntaxKind.LiteralType | SyntaxKind.ImportType | SyntaxKind.ObjectBindingPattern | SyntaxKind.ArrayBindingPattern | SyntaxKind.BindingElement | SyntaxKind.ArrayLiteralExpression | SyntaxKind.ObjectLiteralExpression | SyntaxKind.PropertyAccessExpression | SyntaxKind.ElementAccessExpression | SyntaxKind.CallExpression | SyntaxKind.NewExpression | SyntaxKind.TaggedTemplateExpression | SyntaxKind.TypeAssertionExpression | SyntaxKind.ParenthesizedExpression | SyntaxKind.FunctionExpression | SyntaxKind.ArrowFunction | SyntaxKind.DeleteExpression | SyntaxKind.TypeOfExpression | SyntaxKind.VoidExpression | SyntaxKind.AwaitExpression | SyntaxKind.ConditionalExpression | SyntaxKind.TemplateExpression | SyntaxKind.YieldExpression | SyntaxKind.SpreadElement | SyntaxKind.ClassExpression | SyntaxKind.OmittedExpression | SyntaxKind.ExpressionWithTypeArguments | SyntaxKind.AsExpression | SyntaxKind.NonNullExpression | SyntaxKind.MetaProperty | SyntaxKind.TemplateSpan | SyntaxKind.SemicolonClassElement | SyntaxKind.Block | SyntaxKind.VariableStatement | SyntaxKind.EmptyStatement | SyntaxKind.ExpressionStatement | SyntaxKind.IfStatement | SyntaxKind.DoStatement | SyntaxKind.WhileStatement | SyntaxKind.ForStatement | SyntaxKind.ForInStatement | SyntaxKind.ForOfStatement | SyntaxKind.ContinueStatement | SyntaxKind.BreakStatement | SyntaxKind.ReturnStatement | SyntaxKind.WithStatement | SyntaxKind.SwitchStatement | SyntaxKind.LabeledStatement | SyntaxKind.ThrowStatement | SyntaxKind.TryStatement | SyntaxKind.DebuggerStatement | SyntaxKind.VariableDeclaration | SyntaxKind.VariableDeclarationList | SyntaxKind.FunctionDeclaration | SyntaxKind.ClassDeclaration | SyntaxKind.InterfaceDeclaration | SyntaxKind.TypeAliasDeclaration | SyntaxKind.EnumDeclaration | SyntaxKind.ModuleDeclaration | SyntaxKind.ModuleBlock | SyntaxKind.CaseBlock | SyntaxKind.NamespaceExportDeclaration | SyntaxKind.ImportEqualsDeclaration | SyntaxKind.ImportDeclaration | SyntaxKind.ImportClause | SyntaxKind.NamespaceImport | SyntaxKind.NamedImports | SyntaxKind.ImportSpecifier | SyntaxKind.ExportAssignment | SyntaxKind.ExportDeclaration | SyntaxKind.NamedExports | SyntaxKind.ExportSpecifier | SyntaxKind.MissingDeclaration | SyntaxKind.ExternalModuleReference | SyntaxKind.JsxElement | SyntaxKind.JsxSelfClosingElement | SyntaxKind.JsxOpeningElement | SyntaxKind.JsxClosingElement | SyntaxKind.JsxFragment | SyntaxKind.JsxOpeningFragment | SyntaxKind.JsxClosingFragment | SyntaxKind.JsxAttribute | SyntaxKind.JsxAttributes | SyntaxKind.JsxSpreadAttribute | SyntaxKind.JsxExpression | SyntaxKind.CaseClause | SyntaxKind.DefaultClause | SyntaxKind.HeritageClause | SyntaxKind.CatchClause | SyntaxKind.PropertyAssignment | SyntaxKind.ShorthandPropertyAssignment | SyntaxKind.SpreadAssignment | SyntaxKind.EnumMember | SyntaxKind.SourceFile | SyntaxKind.Bundle | SyntaxKind.UnparsedSource | SyntaxKind.InputFiles | SyntaxKind.JSDocTypeExpression | SyntaxKind.JSDocAllType | SyntaxKind.JSDocUnknownType | SyntaxKind.JSDocNullableType | SyntaxKind.JSDocNonNullableType | SyntaxKind.JSDocOptionalType | SyntaxKind.JSDocFunctionType | SyntaxKind.JSDocVariadicType | SyntaxKind.JSDocComment | SyntaxKind.JSDocTypeLiteral | SyntaxKind.JSDocSignature | SyntaxKind.JSDocTag | SyntaxKind.JSDocAugmentsTag | SyntaxKind.JSDocClassTag | SyntaxKind.JSDocCallbackTag | SyntaxKind.JSDocParameterTag | SyntaxKind.JSDocReturnTag | SyntaxKind.JSDocTypeTag | SyntaxKind.JSDocTemplateTag | SyntaxKind.JSDocTypedefTag | SyntaxKind.JSDocPropertyTag | SyntaxKind.SyntaxList | SyntaxKind.NotEmittedStatement | SyntaxKind.PartiallyEmittedExpression | SyntaxKind.CommaListExpression | SyntaxKind.MergeDeclarationMarker | SyntaxKind.EndOfDeclarationMarker | SyntaxKind.Count;
+ function getOperator(expression: Expression): SyntaxKind;
function getOperatorPrecedence(nodeKind: SyntaxKind, operatorKind: SyntaxKind, hasArguments?: boolean): number;
function getBinaryOperatorPrecedence(kind: SyntaxKind): number;
function createDiagnosticCollection(): DiagnosticCollection;
@@ -6712,6 +6741,8 @@ declare namespace ts {
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 */
@@ -6898,6 +6929,7 @@ declare namespace ts {
function isJSDoc(node: Node): node is JSDoc;
function isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag;
function isJSDocClassTag(node: Node): node is JSDocClassTag;
+ function isJSDocThisTag(node: Node): node is JSDocThisTag;
function isJSDocParameterTag(node: Node): node is JSDocParameterTag;
function isJSDocReturnTag(node: Node): node is JSDocReturnTag;
function isJSDocTypeTag(node: Node): node is JSDocTypeTag;
@@ -8007,8 +8039,10 @@ declare namespace ts {
function createCommaList(elements: ReadonlyArray): CommaListExpression;
function updateCommaList(node: CommaListExpression, elements: ReadonlyArray): CommaListExpression;
function createBundle(sourceFiles: ReadonlyArray, prepends?: ReadonlyArray): Bundle;
- function createUnparsedSourceFile(text: string, map?: string): UnparsedSource;
- function createInputFiles(javascript: string, declaration: string, javascriptMapText?: string, declarationMapText?: string): InputFiles;
+ function createUnparsedSourceFile(text: string): UnparsedSource;
+ function createUnparsedSourceFile(text: string, mapPath: string | undefined, map: string | undefined): UnparsedSource;
+ function createInputFiles(javascript: string, declaration: string): InputFiles;
+ function createInputFiles(javascript: string, declaration: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles;
function updateBundle(node: Bundle, sourceFiles: ReadonlyArray, prepends?: ReadonlyArray): Bundle;
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray): CallExpression;
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression;
@@ -8497,6 +8531,62 @@ declare namespace ts {
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 {
@@ -8864,7 +8954,7 @@ declare namespace ts {
/**
* Returns the target config filename of a project reference
*/
- function resolveProjectReferencePath(host: CompilerHost, ref: ProjectReference): string | undefined;
+ 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.
@@ -9177,7 +9267,7 @@ declare namespace ts.moduleSpecifiers {
importModuleSpecifierPreference?: "relative" | "non-relative";
}
function getModuleSpecifier(compilerOptions: CompilerOptions, fromSourceFile: SourceFile, fromSourceFileName: string, toFileName: string, host: ModuleSpecifierResolutionHost, preferences?: ModuleSpecifierPreferences): string;
- function getModuleSpecifiers(moduleSymbol: Symbol, program: Program, importingSourceFile: SourceFile, host: ModuleSpecifierResolutionHost, preferences: ModuleSpecifierPreferences): ReadonlyArray>;
+ function getModuleSpecifiers(moduleSymbol: Symbol, compilerOptions: CompilerOptions, importingSourceFile: SourceFile, host: ModuleSpecifierResolutionHost, files: ReadonlyArray, preferences: ModuleSpecifierPreferences): ReadonlyArray>;
}
declare namespace ts {
/**
@@ -9346,14 +9436,6 @@ declare namespace ts {
function createWatchProgram(host: WatchCompilerHostOfConfigFile): WatchOfConfigFile;
}
declare namespace ts {
- /**
- * 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;
- };
interface BuildHost {
verbose(diag: DiagnosticMessage, ...args: string[]): void;
error(diag: DiagnosticMessage, ...args: string[]): void;
@@ -9508,7 +9590,7 @@ declare namespace ts {
* 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: () => number;
+ buildAllProjects: () => ExitStatus;
getUpToDateStatus: (project: ParsedCommandLine | undefined) => UpToDateStatus;
getUpToDateStatusOfFile: (configFileName: ResolvedConfigFileName) => UpToDateStatus;
cleanAllProjects: () => ExitStatus.Success | ExitStatus.DiagnosticsPresent_OutputsSkipped;
@@ -9520,6 +9602,12 @@ 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;
}
//# sourceMappingURL=compiler.d.ts.map
declare namespace ts.server {
@@ -10729,6 +10817,7 @@ declare namespace ts {
some(pred: (node: Node) => boolean): boolean;
}
function getParentNodeInSpan(node: Node | undefined, file: SourceFile, span: TextSpan): Node | undefined;
+ function insertImport(changes: textChanges.ChangeTracker, sourceFile: SourceFile, importDecl: Statement): void;
}
declare namespace ts {
function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean;
@@ -11661,36 +11750,6 @@ declare namespace ts.refactor {
}
declare namespace ts.refactor.addOrRemoveBracesToArrowFunction {
}
-declare namespace ts.sourcemaps {
- interface SourceMapData {
- version?: number;
- file?: string;
- sourceRoot?: string;
- sources: string[];
- sourcesContent?: string[];
- 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;
-}
declare namespace ts {
/** The version of the language service API */
const servicesVersion = "0.8";
@@ -11714,13 +11773,6 @@ declare namespace ts {
isCancellationRequested(): boolean;
throwIfCancellationRequested(): void;
}
- interface SourceFileLikeCache {
- get(path: Path): SourceFileLike | undefined;
- }
- function createSourceFileLikeCache(host: {
- readFile?: (path: string) => string | undefined;
- fileExists?: (path: string) => boolean;
- }): SourceFileLikeCache;
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;
@@ -12351,6 +12403,7 @@ declare namespace ts.server.protocol {
category: string;
code: number;
reportsUnnecessary?: {};
+ relatedInformation?: DiagnosticRelatedInformation[];
}
interface ProjectInfoResponse extends Response {
body?: ProjectInfo;
@@ -12941,12 +12994,17 @@ declare namespace ts.server.protocol {
text: string;
category: string;
reportsUnnecessary?: {};
+ relatedInformation?: DiagnosticRelatedInformation[];
code?: number;
source?: string;
}
interface DiagnosticWithFileName extends Diagnostic {
fileName: string;
}
+ interface DiagnosticRelatedInformation {
+ message: string;
+ span?: FileSpan;
+ }
interface DiagnosticEventBody {
file: string;
diagnostics: Diagnostic[];
diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts
index c195146831..d86ab14765 100644
--- a/lib/typescript.d.ts
+++ b/lib/typescript.d.ts
@@ -16,22 +16,15 @@ 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;
@@ -41,13 +34,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;
@@ -57,7 +48,6 @@ declare namespace ts {
done: true;
};
}
- /** Array that is only intended to be pushed to, never read. */
interface Push {
push(...values: T[]): void;
}
@@ -368,17 +358,18 @@ declare namespace ts {
JSDocCallbackTag = 292,
JSDocParameterTag = 293,
JSDocReturnTag = 294,
- JSDocTypeTag = 295,
- JSDocTemplateTag = 296,
- JSDocTypedefTag = 297,
- JSDocPropertyTag = 298,
- SyntaxList = 299,
- NotEmittedStatement = 300,
- PartiallyEmittedExpression = 301,
- CommaListExpression = 302,
- MergeDeclarationMarker = 303,
- EndOfDeclarationMarker = 304,
- Count = 305,
+ JSDocThisTag = 295,
+ JSDocTypeTag = 296,
+ JSDocTemplateTag = 297,
+ JSDocTypedefTag = 298,
+ JSDocPropertyTag = 299,
+ SyntaxList = 300,
+ NotEmittedStatement = 301,
+ PartiallyEmittedExpression = 302,
+ CommaListExpression = 303,
+ MergeDeclarationMarker = 304,
+ EndOfDeclarationMarker = 305,
+ Count = 306,
FirstAssignment = 58,
LastAssignment = 70,
FirstCompoundAssignment = 59,
@@ -405,9 +396,9 @@ declare namespace ts {
LastBinaryOperator = 70,
FirstNode = 146,
FirstJSDocNode = 278,
- LastJSDocNode = 298,
+ LastJSDocNode = 299,
FirstJSDocTagNode = 289,
- LastJSDocTagNode = 298
+ LastJSDocTagNode = 299
}
enum NodeFlags {
None = 0,
@@ -461,9 +452,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
}
@@ -503,10 +492,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;
@@ -650,14 +635,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;
@@ -665,7 +642,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;
@@ -688,7 +664,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;
@@ -828,7 +803,6 @@ declare namespace ts {
interface UnaryExpression extends Expression {
_unaryExpressionBrand: any;
}
- /** Deprecated, please use UpdateExpression */
type IncrementExpression = UpdateExpression;
interface UpdateExpression extends UnaryExpression {
_updateExpressionBrand: any;
@@ -1010,12 +984,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;
}
@@ -1032,7 +1000,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;
@@ -1169,9 +1136,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;
@@ -1308,7 +1272,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 {
@@ -1378,11 +1341,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;
@@ -1398,7 +1356,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;
@@ -1420,9 +1377,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 {
@@ -1449,10 +1404,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;
@@ -1523,10 +1474,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 & {
@@ -1536,6 +1483,10 @@ declare namespace ts {
interface JSDocClassTag extends JSDocTag {
kind: SyntaxKind.JSDocClassTag;
}
+ interface JSDocThisTag extends JSDocTag {
+ kind: SyntaxKind.JSDocThisTag;
+ typeExpression?: JSDocTypeExpression;
+ }
interface JSDocTemplateTag extends JSDocTag {
kind: SyntaxKind.JSDocTemplateTag;
typeParameters: NodeArray;
@@ -1572,7 +1523,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;
}
@@ -1585,7 +1535,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 {
@@ -1666,14 +1615,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;
}
@@ -1685,13 +1626,16 @@ declare namespace ts {
interface InputFiles extends Node {
kind: SyntaxKind.InputFiles;
javascriptText: string;
+ javascriptMapPath?: string;
javascriptMapText?: string;
declarationText: string;
+ declarationMapPath?: string;
declarationMapText?: string;
}
interface UnparsedSource extends Node {
kind: SyntaxKind.UnparsedSource;
text: string;
+ sourceMapPath?: string;
sourceMapText?: string;
}
interface JsonSourceFile extends SourceFile {
@@ -1717,51 +1661,29 @@ 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;
}
+ type ResolvedConfigFileName = string & {
+ _isResolvedConfigFileName: never;
+ };
type WriteFileCallback = (fileName: string, data: string, writeByteOrderMark: boolean, onError: ((message: string) => void) | undefined, sourceFiles?: ReadonlyArray) => void;
class OperationCanceledException {
}
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;
@@ -1771,25 +1693,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 {
@@ -1798,13 +1711,12 @@ declare namespace ts {
sourceMapFile: string;
sourceMapSourceRoot: string;
sourceMapSources: string[];
- sourceMapSourcesContent?: string[];
+ sourceMapSourcesContent?: (string | null)[];
inputSourceFileNames: string[];
sourceMapNames?: string[];
sourceMapMappings: string;
sourceMapDecodedMappings: SourceMapSpan[];
}
- /** Return code used by getEmitOutput function to indicate status of the function */
enum ExitStatus {
Success = 0,
DiagnosticsPresent_OutputsSkipped = 1,
@@ -1812,7 +1724,6 @@ declare namespace ts {
}
interface EmitResult {
emitSkipped: boolean;
- /** Contains declaration emit diagnostics */
diagnostics: ReadonlyArray;
emittedFiles?: string[];
}
@@ -1830,41 +1741,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;
@@ -1873,20 +1764,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;
@@ -1895,7 +1777,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;
@@ -1909,11 +1790,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 {
@@ -1966,7 +1842,7 @@ declare namespace ts {
InElementType = 2097152,
InFirstTypeArgument = 4194304,
InTypeAlias = 8388608,
- /** @deprecated */ WriteOwnNameForAnyLike = 0,
+ WriteOwnNameForAnyLike = 0,
NodeBuilderFlagsMask = 9469291
}
enum SymbolFormatFlags {
@@ -1976,25 +1852,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;
+ 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;
}
- /**
- * @deprecated Migrate to other methods of generating symbol names, ex symbolToEntityName + a printer or symbolToString
- */
interface SymbolWriter extends SymbolTracker {
writeKeyword(text: string): void;
writeOperator(text: string): void;
@@ -2115,20 +1985,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;
@@ -2138,13 +1999,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,
@@ -2236,7 +2095,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;
@@ -2251,16 +2109,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?: Type[];
@@ -2345,7 +2193,6 @@ declare namespace ts {
AlwaysStrict = 64,
PriorityImpliesCombination = 28
}
- /** @deprecated Use FileExtensionInfo instead. */
type JsFileExtensionInfo = FileExtensionInfo;
interface FileExtensionInfo {
extension: string;
@@ -2359,28 +2206,24 @@ 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;
code: number;
next?: DiagnosticMessageChain;
}
- interface Diagnostic {
+ interface Diagnostic extends DiagnosticRelatedInformation {
+ category: DiagnosticCategory;
+ reportsUnnecessary?: {};
+ code: number;
+ source?: string;
+ relatedInformation?: DiagnosticRelatedInformation[];
+ }
+ interface DiagnosticRelatedInformation {
file: SourceFile | undefined;
start: number | undefined;
length: number | undefined;
messageText: string | DiagnosticMessageChain;
- 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;
}
interface DiagnosticWithLocation extends Diagnostic {
file: SourceFile;
@@ -2401,13 +2244,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;
@@ -2484,7 +2323,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;
@@ -2516,7 +2354,6 @@ declare namespace ts {
LineFeed = 1
}
interface LineAndCharacter {
- /** 0-based. */
line: number;
character: number;
}
@@ -2528,10 +2365,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 {
@@ -2549,7 +2382,6 @@ declare namespace ts {
Standard = 0,
JSX = 1
}
- /** Either a parsed command line or a parsed tsconfig.json */
interface ParsedCommandLine {
options: CompilerOptions;
typeAcquisition?: TypeAcquisition;
@@ -2577,62 +2409,34 @@ declare namespace ts {
oldProgram?: Program;
configFileParsingDiagnostics?: ReadonlyArray;
}
+ interface UpToDateHost {
+ fileExists(fileName: string): boolean;
+ getModifiedTime(fileName: string): Date;
+ getUnchangedTime?(fileName: string): Date | undefined;
+ getLastStatus?(fileName: string): UpToDateStatus | undefined;
+ setLastStatus?(fileName: string, status: UpToDateStatus): void;
+ parseConfigFile?(configFilePath: ResolvedConfigFileName): ParsedCommandLine | undefined;
+ }
interface ModuleResolutionHost {
fileExists(fileName: string): boolean;
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 {
@@ -2669,9 +2473,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;
@@ -2733,163 +2534,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 {
@@ -2902,7 +2582,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;
@@ -3005,10 +2684,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;
@@ -3022,11 +2697,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;
@@ -3080,7 +2751,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;
@@ -3092,13 +2762,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[];
@@ -3122,14 +2790,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 & {
@@ -3141,10 +2801,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;
@@ -3155,98 +2811,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;
- /**
- * 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 return tag for the node if present */
+ function getJSDocThisTag(node: Node): JSDocThisTag | undefined;
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 {
@@ -3404,6 +2988,7 @@ declare namespace ts {
function isJSDoc(node: Node): node is JSDoc;
function isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag;
function isJSDocClassTag(node: Node): node is JSDocClassTag;
+ function isJSDocThisTag(node: Node): node is JSDocThisTag;
function isJSDocParameterTag(node: Node): node is JSDocParameterTag;
function isJSDocReturnTag(node: Node): node is JSDocReturnTag;
function isJSDocTypeTag(node: Node): node is JSDocTypeTag;
@@ -3416,11 +3001,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;
@@ -3438,11 +3018,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;
@@ -3454,7 +3029,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;
@@ -3463,27 +3037,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;
@@ -3491,66 +3047,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;
@@ -3563,32 +3077,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;
}
@@ -3604,7 +3097,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;
@@ -3614,17 +3106,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): Identifier;
function createToken(token: TKind): Token;
function createSuper(): SuperExpression;
@@ -3893,32 +3379,17 @@ 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;
function updateCommaList(node: CommaListExpression, elements: ReadonlyArray): CommaListExpression;
function createBundle(sourceFiles: ReadonlyArray, prepends?: ReadonlyArray): Bundle;
- function createUnparsedSourceFile(text: string, map?: string): UnparsedSource;
- function createInputFiles(javascript: string, declaration: string, javascriptMapText?: string, declarationMapText?: string): InputFiles;
+ function createUnparsedSourceFile(text: string): UnparsedSource;
+ function createUnparsedSourceFile(text: string, mapPath: string | undefined, map: string | undefined): UnparsedSource;
+ function createInputFiles(javascript: string, declaration: string): InputFiles;
+ function createInputFiles(javascript: string, declaration: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles;
function updateBundle(node: Bundle, sourceFiles: ReadonlyArray, prepends?: ReadonlyArray): Bundle;
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray): CallExpression;
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression;
@@ -3939,43 +3410,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;
@@ -3984,115 +3427,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 {
@@ -4113,36 +3467,9 @@ 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, ref: ProjectReference): string | undefined;
+ function resolveProjectReferencePath(host: CompilerHost | UpToDateHost, ref: ProjectReference): ResolvedConfigFileName;
}
declare namespace ts {
interface EmitOutput {
@@ -4161,137 +3488,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;
@@ -4299,131 +3532,53 @@ 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 {
- /**
- * 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;
- };
interface BuildHost {
verbose(diag: DiagnosticMessage, ...args: string[]): void;
error(diag: DiagnosticMessage, ...args: string[]): void;
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;
@@ -4442,42 +3597,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;
@@ -4487,42 +3623,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;
@@ -4545,12 +3662,8 @@ 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: () => number;
+ buildAllProjects: () => ExitStatus;
getUpToDateStatus: (project: ParsedCommandLine | undefined) => UpToDateStatus;
getUpToDateStatusOfFile: (configFileName: ResolvedConfigFileName) => UpToDateStatus;
cleanAllProjects: () => ExitStatus.Success | ExitStatus.DiagnosticsPresent_OutputsSkipped;
@@ -4562,6 +3675,9 @@ declare namespace ts {
resolveProjectName: (name: string) => ResolvedConfigFileName | undefined;
startWatching: () => void;
};
+ 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 {
interface Node {
@@ -4638,25 +3754,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 {
@@ -4703,9 +3804,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;
@@ -4721,17 +3819,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;
@@ -4751,7 +3842,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[];
@@ -4765,10 +3855,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;
@@ -4777,11 +3863,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;
@@ -4801,11 +3884,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 {
@@ -4819,12 +3899,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;
@@ -4835,23 +3909,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 {
@@ -4873,23 +3936,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;
}
@@ -4900,49 +3952,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;
@@ -4951,16 +3970,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;
}
@@ -5132,13 +4146,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[];
@@ -5148,9 +4155,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;
@@ -5159,12 +4163,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[];
}
@@ -5174,11 +4174,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;
@@ -5195,30 +4190,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 {
@@ -5255,82 +4236,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",
@@ -5340,11 +4272,7 @@ declare namespace ts {
letElement = "let",
directory = "directory",
externalModuleName = "external module name",
- /**
- *
- */
jsxAttribute = "JSX attribute",
- /** String literal */
string = "string"
}
enum ScriptElementKindModifier {
@@ -5414,62 +4342,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;
@@ -5500,7 +4378,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;
@@ -5510,21 +4387,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
+//# sourceMappingURL=typescriptServices.d.ts.map
+export = ts;
\ No newline at end of file
diff --git a/lib/typescript.js b/lib/typescript.js
index 2e2171e857..6794e291e7 100644
--- a/lib/typescript.js
+++ b/lib/typescript.js
@@ -13,109 +13,35 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
-"use strict";"use strict";
-/*@internal*/
+
+"use strict";
+var __assign = (this && this.__assign) || Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+};
+var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
+ return cooked;
+};
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
var ts;
(function (ts) {
- /** Gets a timestamp with (at least) ms resolution */
- ts.timestamp = typeof performance !== "undefined" && performance.now ? function () { return performance.now(); } : Date.now ? Date.now : function () { return +(new Date()); };
-})(ts || (ts = {}));
-/*@internal*/
-/** Performance measurements for the compiler. */
-(function (ts) {
- var performance;
- (function (performance) {
- // NOTE: cannot use ts.noop as core.ts loads after this
- var profilerEvent = typeof onProfilerEvent === "function" && onProfilerEvent.profiler === true ? onProfilerEvent : function () { };
- var enabled = false;
- var profilerStart = 0;
- var counts;
- var marks;
- var measures;
- /**
- * Marks a performance event.
- *
- * @param markName The name of the mark.
- */
- function mark(markName) {
- if (enabled) {
- marks.set(markName, ts.timestamp());
- counts.set(markName, (counts.get(markName) || 0) + 1);
- profilerEvent(markName);
- }
- }
- performance.mark = mark;
- /**
- * 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, startMarkName, endMarkName) {
- if (enabled) {
- var end = endMarkName && marks.get(endMarkName) || ts.timestamp();
- var start = startMarkName && marks.get(startMarkName) || profilerStart;
- measures.set(measureName, (measures.get(measureName) || 0) + (end - start));
- }
- }
- performance.measure = measure;
- /**
- * Gets the number of times a marker was encountered.
- *
- * @param markName The name of the mark.
- */
- function getCount(markName) {
- return counts && counts.get(markName) || 0;
- }
- performance.getCount = getCount;
- /**
- * 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) {
- return measures && measures.get(measureName) || 0;
- }
- performance.getDuration = getDuration;
- /**
- * Iterate over each measure, performing some action
- *
- * @param cb The action to perform for each measure
- */
- function forEachMeasure(cb) {
- measures.forEach(function (measure, key) {
- cb(key, measure);
- });
- }
- performance.forEachMeasure = forEachMeasure;
- /** Enables (and resets) performance measurements for the compiler. */
- function enable() {
- counts = ts.createMap();
- marks = ts.createMap();
- measures = ts.createMap();
- enabled = true;
- profilerStart = ts.timestamp();
- }
- performance.enable = enable;
- /** Disables performance measurements for the compiler. */
- function disable() {
- enabled = false;
- }
- performance.disable = disable;
- })(performance = ts.performance || (ts.performance = {}));
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- // WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
- // If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.0";
- /** The version of the TypeScript compiler release */
ts.version = ts.versionMajorMinor + ".0-dev";
})(ts || (ts = {}));
-/* @internal */
(function (ts) {
var Comparison;
(function (Comparison) {
@@ -123,17 +49,14 @@ var ts;
Comparison[Comparison["EqualTo"] = 0] = "EqualTo";
Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan";
})(Comparison = ts.Comparison || (ts.Comparison = {}));
- /** Create a MapLike with good performance. */
+})(ts || (ts = {}));
+(function (ts) {
function createDictionaryObject() {
- var map = Object.create(/*prototype*/ null); // tslint:disable-line:no-null-keyword
- // Using 'delete' on an object causes V8 to put the object in dictionary mode.
- // This disables creation of hidden classes, which are expensive when an object is
- // constantly changing shape.
+ var map = Object.create(null);
map.__ = undefined;
delete map.__;
return map;
}
- /** Create a new map. If a template object is provided, the map will copy entries from it. */
function createMap() {
return new ts.MapCtr();
}
@@ -149,8 +72,6 @@ var ts;
ts.createMapFromEntries = createMapFromEntries;
function createMapFromTemplate(template) {
var map = new ts.MapCtr();
- // Copies keys/values from template. Note that for..in will not throw if
- // template is undefined, and instead will just exit the loop.
for (var key in template) {
if (hasOwnProperty.call(template, key)) {
map.set(key, template[key]);
@@ -159,12 +80,9 @@ var ts;
return map;
}
ts.createMapFromTemplate = createMapFromTemplate;
- // Internet Explorer's Map doesn't support iteration, so don't use it.
- // tslint:disable-next-line no-in-operator variable-name
ts.MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap();
- // Keep the class inside a function so it doesn't get compiled if it's not used.
function shimMap() {
- var MapIterator = /** @class */ (function () {
+ var MapIterator = (function () {
function MapIterator(data, selector) {
this.index = 0;
this.data = data;
@@ -181,7 +99,7 @@ var ts;
};
return MapIterator;
}());
- return /** @class */ (function () {
+ return (function () {
function class_1() {
this.data = createDictionaryObject();
this.size = 0;
@@ -197,7 +115,6 @@ var ts;
return this;
};
class_1.prototype.has = function (key) {
- // tslint:disable-next-line:no-in-operator
return key in this.data;
};
class_1.prototype.delete = function (key) {
@@ -233,11 +150,6 @@ var ts;
return array ? array.length : 0;
}
ts.length = length;
- /**
- * 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, callback) {
if (array) {
for (var i = 0; i < array.length; i++) {
@@ -250,7 +162,6 @@ var ts;
return undefined;
}
ts.forEach = forEach;
- /** Like `forEach`, but suitable for use with numbers and strings (which may be falsy). */
function firstDefined(array, callback) {
if (array === undefined) {
return undefined;
@@ -309,11 +220,6 @@ var ts;
return map;
}
ts.zipToMap = zipToMap;
- /**
- * 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, callback) {
if (array) {
for (var i = 0; i < array.length; i++) {
@@ -345,7 +251,6 @@ var ts;
return undefined;
}
ts.findLast = findLast;
- /** Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found. */
function findIndex(array, predicate, startIndex) {
for (var i = startIndex || 0; i < array.length; i++) {
if (predicate(array[i], i)) {
@@ -364,10 +269,6 @@ var ts;
return -1;
}
ts.findLastIndex = findLastIndex;
- /**
- * Returns the first truthy result of `callback`, or else fails.
- * This is like `forEach`, but never returns undefined.
- */
function findMap(array, callback) {
for (var i = 0; i < array.length; i++) {
var result = callback(array[i], i);
@@ -698,7 +599,6 @@ var ts;
return false;
}
ts.some = some;
- /** Calls the callback with (start, afterEnd) index pairs for each range where 'pred' is true. */
function getRangesWhere(arr, pred, cb) {
var start;
for (var i = 0; i < arr.length; i++) {
@@ -725,8 +625,6 @@ var ts;
}
ts.concatenate = concatenate;
function deduplicateRelational(array, equalityComparer, comparer) {
- // Perform a stable sort of the array. This ensures the first entry in a list of
- // duplicates remains the first entry in the result.
var indices = array.map(function (_, i) { return i; });
stableSortIndices(array, indices, comparer);
var last = array[indices[0]];
@@ -739,7 +637,6 @@ var ts;
last = item;
}
}
- // restore original order
deduplicated.sort();
return deduplicated.map(function (i) { return array[i]; });
}
@@ -769,13 +666,10 @@ var ts;
for (var i = 1; i < array.length; i++) {
var next = array[i];
switch (comparer(next, last)) {
- // equality comparison
case true:
- // relational comparison
- case 0 /* EqualTo */:
+ case 0:
continue;
- case -1 /* LessThan */:
- // If `array` is sorted, `next` should **never** be less than `last`.
+ case -1:
return Debug.fail("Array is unsorted.");
}
deduplicated.push(last = next);
@@ -831,41 +725,25 @@ var ts;
return result || array;
}
ts.compact = compact;
- /**
- * 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, arrayB, comparer) {
if (!arrayB || !arrayA || arrayB.length === 0 || arrayA.length === 0)
return arrayB;
var result = [];
loopB: for (var offsetA = 0, offsetB = 0; offsetB < arrayB.length; offsetB++) {
if (offsetB > 0) {
- // Ensure `arrayB` is properly sorted.
- Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */);
+ Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0);
}
loopA: for (var startA = offsetA; offsetA < arrayA.length; offsetA++) {
if (offsetA > startA) {
- // Ensure `arrayA` is properly sorted. We only need to perform this check if
- // `offsetA` has changed since we entered the loop.
- Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */);
+ Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0);
}
switch (comparer(arrayB[offsetB], arrayA[offsetA])) {
- case -1 /* LessThan */:
- // If B is less than A, B does not exist in arrayA. Add B to the result and
- // move to the next element in arrayB without changing the current position
- // in arrayA.
+ case -1:
result.push(arrayB[offsetB]);
continue loopB;
- case 0 /* EqualTo */:
- // If B is equal to A, B exists in arrayA. Move to the next element in
- // arrayB without adding B to the result or changing the current position
- // in arrayA.
+ case 0:
continue loopB;
- case 1 /* GreaterThan */:
- // If B is greater than A, we need to keep looking for B in arrayA. Move to
- // the next element in arrayA and recheck.
+ case 1:
continue loopA;
}
}
@@ -891,10 +769,6 @@ var ts;
return to;
}
ts.append = append;
- /**
- * Gets the actual offset into an array for a relative offset. Negative offsets indicate a
- * position offset from the end of the array.
- */
function toOffset(array, offset) {
return offset < 0 ? array.length + offset : offset;
}
@@ -913,9 +787,6 @@ var ts;
return to;
}
ts.addRange = addRange;
- /**
- * @return Whether the value was added.
- */
function pushIfUnique(array, toAdd, equalityComparer) {
if (contains(array, toAdd, equalityComparer)) {
return false;
@@ -926,9 +797,6 @@ var ts;
}
}
ts.pushIfUnique = pushIfUnique;
- /**
- * Unlike `pushIfUnique`, this can take `undefined` as an input, and returns a new array.
- */
function appendIfUnique(array, toAdd, equalityComparer) {
if (array) {
pushIfUnique(array, toAdd, equalityComparer);
@@ -940,12 +808,8 @@ var ts;
}
ts.appendIfUnique = appendIfUnique;
function stableSortIndices(array, indices, comparer) {
- // sort indices by value then position
indices.sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); });
}
- /**
- * Returns a new sorted array.
- */
function sort(array, comparer) {
return array.slice().sort(comparer);
}
@@ -980,9 +844,6 @@ var ts;
} };
}
ts.arrayIterator = arrayIterator;
- /**
- * Stable sort of an array. Elements equal to each other maintain their relative position in the array.
- */
function stableSort(array, comparer) {
var indices = array.map(function (_, i) { return i; });
stableSortIndices(array, indices, comparer);
@@ -999,10 +860,6 @@ var ts;
return true;
}
ts.rangeEquals = rangeEquals;
- /**
- * 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, offset) {
if (array) {
offset = toOffset(array, offset);
@@ -1013,9 +870,6 @@ var ts;
return undefined;
}
ts.elementAt = elementAt;
- /**
- * Returns the first element of an array if non-empty, `undefined` otherwise.
- */
function firstOrUndefined(array) {
return array.length === 0 ? undefined : array[0];
}
@@ -1025,9 +879,6 @@ var ts;
return array[0];
}
ts.first = first;
- /**
- * Returns the last element of an array if non-empty, `undefined` otherwise.
- */
function lastOrUndefined(array) {
return array.length === 0 ? undefined : array[array.length - 1];
}
@@ -1037,9 +888,6 @@ var ts;
return array[array.length - 1];
}
ts.last = last;
- /**
- * Returns the only element of an array if it contains only one element, `undefined` otherwise.
- */
function singleOrUndefined(array) {
return array && array.length === 1
? array[0]
@@ -1058,17 +906,6 @@ var ts;
return result;
}
ts.replaceElement = replaceElement;
- /**
- * 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, value, keySelector, keyComparer, offset) {
if (!array || array.length === 0) {
return -1;
@@ -1080,12 +917,12 @@ var ts;
var middle = low + ((high - low) >> 1);
var midKey = keySelector(array[middle]);
switch (keyComparer(midKey, key)) {
- case -1 /* LessThan */:
+ case -1:
low = middle + 1;
break;
- case 0 /* EqualTo */:
+ case 0:
return middle;
- case 1 /* GreaterThan */:
+ case 1:
high = middle - 1;
break;
}
@@ -1118,29 +955,14 @@ var ts;
}
ts.reduceLeft = reduceLeft;
var hasOwnProperty = Object.prototype.hasOwnProperty;
- /**
- * 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, key) {
return hasOwnProperty.call(map, key);
}
ts.hasProperty = hasProperty;
- /**
- * Gets the value of an owned property in a map-like.
- *
- * @param map A map-like.
- * @param key A property key.
- */
function getProperty(map, key) {
return hasOwnProperty.call(map, key) ? map[key] : undefined;
}
ts.getProperty = getProperty;
- /**
- * Gets the owned, enumerable property keys of a map-like.
- */
function getOwnKeys(map) {
var keys = [];
for (var key in map) {
@@ -1179,19 +1001,13 @@ var ts;
var arg = args_1[_a];
for (var p in arg) {
if (hasProperty(arg, p)) {
- t[p] = arg[p]; // TODO: GH#23368
+ t[p] = arg[p];
}
}
}
return t;
}
ts.assign = assign;
- /**
- * 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, right, equalityComparer) {
if (equalityComparer === void 0) { equalityComparer = equateValues; }
if (left === right)
@@ -1302,9 +1118,6 @@ var ts;
}
}
}
- /**
- * Tests whether a value is an array.
- */
function isArray(value) {
return Array.isArray ? Array.isArray(value) : value instanceof Array;
}
@@ -1313,9 +1126,6 @@ var ts;
return isArray(value) ? value : [value];
}
ts.toArray = toArray;
- /**
- * Tests whether a value is string
- */
function isString(text) {
return typeof text === "string";
}
@@ -1330,22 +1140,16 @@ var ts;
return Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + Debug.getFunctionName(test) + "'.");
}
ts.cast = cast;
- /** Does nothing. */
- function noop(_) { } // tslint:disable-line no-empty
+ function noop(_) { }
ts.noop = noop;
- /** Do nothing and return false */
function returnFalse() { return false; }
ts.returnFalse = returnFalse;
- /** Do nothing and return true */
function returnTrue() { return true; }
ts.returnTrue = returnTrue;
- /** Returns its argument. */
function identity(x) { return x; }
ts.identity = identity;
- /** Returns lower case string */
function toLowerCase(x) { return x.toLowerCase(); }
ts.toLowerCase = toLowerCase;
- /** Throws an error because a function is not implemented. */
function notImplemented() {
throw new Error("Not implemented");
}
@@ -1420,7 +1224,7 @@ var ts;
})(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {}));
var Debug;
(function (Debug) {
- Debug.currentAssertionLevel = 0 /* None */;
+ Debug.currentAssertionLevel = 0;
Debug.isDebugging = false;
function shouldAssert(level) {
return Debug.currentAssertionLevel >= level;
@@ -1506,14 +1310,6 @@ var ts;
return a === b;
}
ts.equateValues = equateValues;
- /**
- * 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, b) {
return a === b
|| a !== undefined
@@ -1521,69 +1317,37 @@ var ts;
&& a.toUpperCase() === b.toUpperCase();
}
ts.equateStringsCaseInsensitive = equateStringsCaseInsensitive;
- /**
- * 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, b) {
return equateValues(a, b);
}
ts.equateStringsCaseSensitive = equateStringsCaseSensitive;
function compareComparableValues(a, b) {
- return a === b ? 0 /* EqualTo */ :
- a === undefined ? -1 /* LessThan */ :
- b === undefined ? 1 /* GreaterThan */ :
- a < b ? -1 /* LessThan */ :
- 1 /* GreaterThan */;
+ return a === b ? 0 :
+ a === undefined ? -1 :
+ b === undefined ? 1 :
+ a < b ? -1 :
+ 1;
}
- /**
- * Compare two numeric values for their order relative to each other.
- * To compare strings, use any of the `compareStrings` functions.
- */
function compareValues(a, b) {
return compareComparableValues(a, b);
}
ts.compareValues = compareValues;
function min(a, b, compare) {
- return compare(a, b) === -1 /* LessThan */ ? a : b;
+ return compare(a, b) === -1 ? a : b;
}
ts.min = min;
- /**
- * 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, b) {
if (a === b)
- return 0 /* EqualTo */;
+ return 0;
if (a === undefined)
- return -1 /* LessThan */;
+ return -1;
if (b === undefined)
- return 1 /* GreaterThan */;
+ return 1;
a = a.toUpperCase();
b = b.toUpperCase();
- return a < b ? -1 /* LessThan */ : a > b ? 1 /* GreaterThan */ : 0 /* EqualTo */;
+ return a < b ? -1 : a > b ? 1 : 0;
}
ts.compareStringsCaseInsensitive = compareStringsCaseInsensitive;
- /**
- * 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, b) {
return compareComparableValues(a, b);
}
@@ -1592,9 +1356,6 @@ var ts;
return ignoreCase ? compareStringsCaseInsensitive : compareStringsCaseSensitive;
}
ts.getStringComparer = getStringComparer;
- /**
- * Creates a string comparer for use with string collation in the UI.
- */
var createUIStringComparer = (function () {
var defaultComparer;
var enUSComparer;
@@ -1602,22 +1363,19 @@ var ts;
return createStringComparer;
function compareWithCallback(a, b, comparer) {
if (a === b)
- return 0 /* EqualTo */;
+ return 0;
if (a === undefined)
- return -1 /* LessThan */;
+ return -1;
if (b === undefined)
- return 1 /* GreaterThan */;
+ return 1;
var value = comparer(a, b);
- return value < 0 ? -1 /* LessThan */ : value > 0 ? 1 /* GreaterThan */ : 0 /* EqualTo */;
+ return value < 0 ? -1 : value > 0 ? 1 : 0;
}
function createIntlCollatorStringComparer(locale) {
- // Intl.Collator.prototype.compare is bound to the collator. See NOTE in
- // http://www.ecma-international.org/ecma-402/2.0/#sec-Intl.Collator.prototype.compare
var comparer = new Intl.Collator(locale, { usage: "sort", sensitivity: "variant" }).compare;
return function (a, b) { return compareWithCallback(a, b, comparer); };
}
function createLocaleCompareStringComparer(locale) {
- // if the locale is not the default locale (`undefined`), use the fallback comparer.
if (locale !== undefined)
return createFallbackStringComparer();
return function (a, b) { return compareWithCallback(a, b, compareStrings); };
@@ -1626,39 +1384,26 @@ var ts;
}
}
function createFallbackStringComparer() {
- // An ordinal comparison puts "A" after "b", but for the UI we want "A" before "b".
- // We first sort case insensitively. So "Aaa" will come before "baa".
- // Then we sort case sensitively, so "aaa" will come before "Aaa".
- //
- // For case insensitive comparisons 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)).
return function (a, b) { return compareWithCallback(a, b, compareDictionaryOrder); };
function compareDictionaryOrder(a, b) {
return compareStrings(a.toUpperCase(), b.toUpperCase()) || compareStrings(a, b);
}
function compareStrings(a, b) {
- return a < b ? -1 /* LessThan */ : a > b ? 1 /* GreaterThan */ : 0 /* EqualTo */;
+ return a < b ? -1 : a > b ? 1 : 0;
}
}
function getStringComparerFactory() {
- // If the host supports Intl, we use it for comparisons using the default locale.
if (typeof Intl === "object" && typeof Intl.Collator === "function") {
return createIntlCollatorStringComparer;
}
- // If the host does not support Intl, we fall back to localeCompare.
- // localeCompare in Node v0.10 is just an ordinal comparison, so don't use it.
if (typeof String.prototype.localeCompare === "function" &&
typeof String.prototype.toLocaleUpperCase === "function" &&
"a".localeCompare("B") < 0) {
return createLocaleCompareStringComparer;
}
- // Otherwise, fall back to ordinal comparison:
return createFallbackStringComparer;
}
function createStringComparer(locale) {
- // Hold onto common string comparers. This avoids constantly reallocating comparers during
- // tests.
if (locale === undefined) {
return defaultComparer || (defaultComparer = stringComparerFactory(locale));
}
@@ -1683,50 +1428,25 @@ var ts;
}
}
ts.setUILocale = setUILocale;
- /**
- * 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, b) {
var comparer = uiComparerCaseSensitive || (uiComparerCaseSensitive = createUIStringComparer(uiLocale));
return comparer(a, b);
}
ts.compareStringsCaseSensitiveUI = compareStringsCaseSensitiveUI;
function compareProperties(a, b, key, comparer) {
- return a === b ? 0 /* EqualTo */ :
- a === undefined ? -1 /* LessThan */ :
- b === undefined ? 1 /* GreaterThan */ :
+ return a === b ? 0 :
+ a === undefined ? -1 :
+ b === undefined ? 1 :
comparer(a[key], b[key]);
}
ts.compareProperties = compareProperties;
- /** True is greater than false. */
function compareBooleans(a, b) {
return compareValues(a ? 1 : 0, b ? 1 : 0);
}
ts.compareBooleans = compareBooleans;
- /**
- * 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, candidates, getName) {
var maximumLengthDifference = Math.min(2, Math.floor(name.length * 0.34));
- var bestDistance = Math.floor(name.length * 0.4) + 1; // If the best result isn't better than this, don't bother.
+ var bestDistance = Math.floor(name.length * 0.4) + 1;
var bestCandidate;
var justCheckExactMatches = false;
var nameLowerCase = name.toLowerCase();
@@ -1742,10 +1462,8 @@ var ts;
continue;
}
if (candidateName.length < 3) {
- // Don't bother, user would have noticed a 2-character name having an extra character
continue;
}
- // Only care about a result better than the best so far.
var distance = levenshteinWithMax(nameLowerCase, candidateNameLowerCase, bestDistance - 1);
if (distance === undefined) {
continue;
@@ -1755,7 +1473,7 @@ var ts;
bestCandidate = candidate;
}
else {
- Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
+ Debug.assert(distance < bestDistance);
bestDistance = distance;
bestCandidate = candidate;
}
@@ -1767,7 +1485,6 @@ var ts;
function levenshteinWithMax(s1, s2, max) {
var previous = new Array(s2.length + 1);
var current = new Array(s2.length + 1);
- /** Represents any value > max. We don't care about the particular value. */
var big = max + 1;
for (var i = 0; i <= s2.length; i++) {
previous[i] = i;
@@ -1777,7 +1494,6 @@ var ts;
var minJ = i > max ? i - max : 1;
var maxJ = s2.length > max + i ? max + i : s2.length;
current[0] = i;
- /** Smallest value of the matrix in the ith column. */
var colMin = i;
for (var j = 1; j < minJ; j++) {
current[j] = big;
@@ -1785,7 +1501,7 @@ var ts;
for (var j = minJ; j <= maxJ; j++) {
var dist = c1 === s2.charCodeAt(j - 1)
? previous[j - 1]
- : Math.min(/*delete*/ previous[j] + 1, /*insert*/ current[j - 1] + 1, /*substitute*/ previous[j - 1] + 2);
+ : Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + 2);
current[j] = dist;
colMin = Math.min(colMin, dist);
}
@@ -1793,7 +1509,6 @@ var ts;
current[j] = big;
}
if (colMin > max) {
- // Give up -- everything in this column is > max and it can't get better in future columns.
return undefined;
}
var temp = previous;
@@ -1834,17 +1549,11 @@ var ts;
return false;
}
ts.fileExtensionIsOneOf = fileExtensionIsOneOf;
- /**
- * Takes a string like "jquery-min.4.2.3" and returns "jquery"
- */
function removeMinAndVersionNumbers(fileName) {
- // Match a "." or "-" followed by a version number or 'min' at the end of the name
var trailingMinOrVersion = /[.-]((min)|(\d+(\.\d+)*))$/;
- // The "min" or version may both be present, in either order, so try applying the above twice.
return fileName.replace(trailingMinOrVersion, "").replace(trailingMinOrVersion, "");
}
ts.removeMinAndVersionNumbers = removeMinAndVersionNumbers;
- /** Remove an item from an array, moving everything to its right one space left. */
function orderedRemoveItem(array, item) {
for (var i = 0; i < array.length; i++) {
if (array[i] === item) {
@@ -1855,9 +1564,7 @@ var ts;
return false;
}
ts.orderedRemoveItem = orderedRemoveItem;
- /** Remove an item by index from an array, moving everything to its right one space left. */
function orderedRemoveItemAt(array, index) {
- // This seems to be faster than either `array.splice(i, 1)` or `array.copyWithin(i, i+ 1)`.
for (var i = index; i < array.length - 1; i++) {
array[i] = array[i + 1];
}
@@ -1865,17 +1572,14 @@ var ts;
}
ts.orderedRemoveItemAt = orderedRemoveItemAt;
function unorderedRemoveItemAt(array, index) {
- // Fill in the "hole" left at `index`.
array[index] = array[array.length - 1];
array.pop();
}
ts.unorderedRemoveItemAt = unorderedRemoveItemAt;
- /** Remove the *first* occurrence of `item` from the array. */
function unorderedRemoveItem(array, item) {
return unorderedRemoveFirstItemWhere(array, function (element) { return element === item; });
}
ts.unorderedRemoveItem = unorderedRemoveItem;
- /** Remove the *first* element satisfying `predicate`. */
function unorderedRemoveFirstItemWhere(array, predicate) {
for (var i = 0; i < array.length; i++) {
if (predicate(array[i])) {
@@ -1894,19 +1598,13 @@ var ts;
return prefix + "*" + suffix;
}
ts.patternText = patternText;
- /**
- * Given that candidate matches pattern, returns the text matching the '*'.
- * E.g.: matchedText(tryParsePattern("foo*baz"), "foobarbaz") === "bar"
- */
function matchedText(pattern, candidate) {
Debug.assert(isPatternMatch(pattern, candidate));
return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
}
ts.matchedText = matchedText;
- /** Return the object corresponding to the best pattern to match `candidate`. */
function findBestPatternMatch(values, getPattern, candidate) {
var matchedValue;
- // use length of prefix as betterness criteria
var longestMatchPrefixLength = -1;
for (var _i = 0, values_2 = values; _i < values_2.length; _i++) {
var v = values_2[_i];
@@ -1945,7 +1643,7 @@ var ts;
return function (arg) { return f(arg) || g(arg); };
}
ts.or = or;
- function assertTypeIsNever(_) { } // tslint:disable-line no-empty
+ function assertTypeIsNever(_) { }
ts.assertTypeIsNever = assertTypeIsNever;
function singleElementArray(t) {
return t === undefined ? undefined : [t];
@@ -1961,11 +1659,11 @@ var ts;
var newItem = newItems[newIndex];
var oldItem = oldItems[oldIndex];
var compareResult = comparer(newItem, oldItem);
- if (compareResult === -1 /* LessThan */) {
+ if (compareResult === -1) {
inserted(newItem);
newIndex++;
}
- else if (compareResult === 1 /* GreaterThan */) {
+ else if (compareResult === 1) {
deleted(oldItem);
oldIndex++;
}
@@ -1984,20 +1682,65 @@ var ts;
}
ts.enumerateInsertsAndDeletes = enumerateInsertsAndDeletes;
})(ts || (ts = {}));
-//# sourceMappingURL=core.js.map
-"use strict";
-var __assign = (this && this.__assign) || Object.assign || function(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
- t[p] = s[p];
- }
- return t;
-};
var ts;
(function (ts) {
- // token > SyntaxKind.Identifier => token is a keyword
- // Also, If you add a new SyntaxKind be sure to keep the `Markers` section at the bottom in sync
+ ts.timestamp = typeof performance !== "undefined" && performance.now ? function () { return performance.now(); } : Date.now ? Date.now : function () { return +(new Date()); };
+})(ts || (ts = {}));
+(function (ts) {
+ var performance;
+ (function (performance) {
+ var profilerEvent = typeof onProfilerEvent === "function" && onProfilerEvent.profiler === true ? onProfilerEvent : function () { };
+ var enabled = false;
+ var profilerStart = 0;
+ var counts;
+ var marks;
+ var measures;
+ function mark(markName) {
+ if (enabled) {
+ marks.set(markName, ts.timestamp());
+ counts.set(markName, (counts.get(markName) || 0) + 1);
+ profilerEvent(markName);
+ }
+ }
+ performance.mark = mark;
+ function measure(measureName, startMarkName, endMarkName) {
+ if (enabled) {
+ var end = endMarkName && marks.get(endMarkName) || ts.timestamp();
+ var start = startMarkName && marks.get(startMarkName) || profilerStart;
+ measures.set(measureName, (measures.get(measureName) || 0) + (end - start));
+ }
+ }
+ performance.measure = measure;
+ function getCount(markName) {
+ return counts && counts.get(markName) || 0;
+ }
+ performance.getCount = getCount;
+ function getDuration(measureName) {
+ return measures && measures.get(measureName) || 0;
+ }
+ performance.getDuration = getDuration;
+ function forEachMeasure(cb) {
+ measures.forEach(function (measure, key) {
+ cb(key, measure);
+ });
+ }
+ performance.forEachMeasure = forEachMeasure;
+ function enable() {
+ counts = ts.createMap();
+ marks = ts.createMap();
+ measures = ts.createMap();
+ enabled = true;
+ profilerStart = ts.timestamp();
+ }
+ performance.enable = enable;
+ function disable() {
+ enabled = false;
+ }
+ performance.disable = disable;
+ })(performance = ts.performance || (ts.performance = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
var SyntaxKind;
(function (SyntaxKind) {
SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown";
@@ -2006,23 +1749,17 @@ var ts;
SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia";
SyntaxKind[SyntaxKind["NewLineTrivia"] = 4] = "NewLineTrivia";
SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 5] = "WhitespaceTrivia";
- // We detect and preserve #! on the first line
SyntaxKind[SyntaxKind["ShebangTrivia"] = 6] = "ShebangTrivia";
- // We detect and provide better error recovery when we encounter a git merge marker. This
- // allows us to edit files with git-conflict markers in them in a much more pleasant manner.
SyntaxKind[SyntaxKind["ConflictMarkerTrivia"] = 7] = "ConflictMarkerTrivia";
- // Literals
SyntaxKind[SyntaxKind["NumericLiteral"] = 8] = "NumericLiteral";
SyntaxKind[SyntaxKind["StringLiteral"] = 9] = "StringLiteral";
SyntaxKind[SyntaxKind["JsxText"] = 10] = "JsxText";
SyntaxKind[SyntaxKind["JsxTextAllWhiteSpaces"] = 11] = "JsxTextAllWhiteSpaces";
SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 12] = "RegularExpressionLiteral";
SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 13] = "NoSubstitutionTemplateLiteral";
- // Pseudo-literals
SyntaxKind[SyntaxKind["TemplateHead"] = 14] = "TemplateHead";
SyntaxKind[SyntaxKind["TemplateMiddle"] = 15] = "TemplateMiddle";
SyntaxKind[SyntaxKind["TemplateTail"] = 16] = "TemplateTail";
- // Punctuation
SyntaxKind[SyntaxKind["OpenBraceToken"] = 17] = "OpenBraceToken";
SyntaxKind[SyntaxKind["CloseBraceToken"] = 18] = "CloseBraceToken";
SyntaxKind[SyntaxKind["OpenParenToken"] = 19] = "OpenParenToken";
@@ -2064,7 +1801,6 @@ var ts;
SyntaxKind[SyntaxKind["QuestionToken"] = 55] = "QuestionToken";
SyntaxKind[SyntaxKind["ColonToken"] = 56] = "ColonToken";
SyntaxKind[SyntaxKind["AtToken"] = 57] = "AtToken";
- // Assignments
SyntaxKind[SyntaxKind["EqualsToken"] = 58] = "EqualsToken";
SyntaxKind[SyntaxKind["PlusEqualsToken"] = 59] = "PlusEqualsToken";
SyntaxKind[SyntaxKind["MinusEqualsToken"] = 60] = "MinusEqualsToken";
@@ -2078,9 +1814,7 @@ var ts;
SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 68] = "AmpersandEqualsToken";
SyntaxKind[SyntaxKind["BarEqualsToken"] = 69] = "BarEqualsToken";
SyntaxKind[SyntaxKind["CaretEqualsToken"] = 70] = "CaretEqualsToken";
- // Identifiers
SyntaxKind[SyntaxKind["Identifier"] = 71] = "Identifier";
- // Reserved words
SyntaxKind[SyntaxKind["BreakKeyword"] = 72] = "BreakKeyword";
SyntaxKind[SyntaxKind["CaseKeyword"] = 73] = "CaseKeyword";
SyntaxKind[SyntaxKind["CatchKeyword"] = 74] = "CatchKeyword";
@@ -2117,7 +1851,6 @@ var ts;
SyntaxKind[SyntaxKind["VoidKeyword"] = 105] = "VoidKeyword";
SyntaxKind[SyntaxKind["WhileKeyword"] = 106] = "WhileKeyword";
SyntaxKind[SyntaxKind["WithKeyword"] = 107] = "WithKeyword";
- // Strict mode reserved words
SyntaxKind[SyntaxKind["ImplementsKeyword"] = 108] = "ImplementsKeyword";
SyntaxKind[SyntaxKind["InterfaceKeyword"] = 109] = "InterfaceKeyword";
SyntaxKind[SyntaxKind["LetKeyword"] = 110] = "LetKeyword";
@@ -2127,7 +1860,6 @@ var ts;
SyntaxKind[SyntaxKind["PublicKeyword"] = 114] = "PublicKeyword";
SyntaxKind[SyntaxKind["StaticKeyword"] = 115] = "StaticKeyword";
SyntaxKind[SyntaxKind["YieldKeyword"] = 116] = "YieldKeyword";
- // Contextual keywords
SyntaxKind[SyntaxKind["AbstractKeyword"] = 117] = "AbstractKeyword";
SyntaxKind[SyntaxKind["AsKeyword"] = 118] = "AsKeyword";
SyntaxKind[SyntaxKind["AnyKeyword"] = 119] = "AnyKeyword";
@@ -2157,15 +1889,11 @@ var ts;
SyntaxKind[SyntaxKind["FromKeyword"] = 143] = "FromKeyword";
SyntaxKind[SyntaxKind["GlobalKeyword"] = 144] = "GlobalKeyword";
SyntaxKind[SyntaxKind["OfKeyword"] = 145] = "OfKeyword";
- // Parse tree nodes
- // Names
SyntaxKind[SyntaxKind["QualifiedName"] = 146] = "QualifiedName";
SyntaxKind[SyntaxKind["ComputedPropertyName"] = 147] = "ComputedPropertyName";
- // Signature elements
SyntaxKind[SyntaxKind["TypeParameter"] = 148] = "TypeParameter";
SyntaxKind[SyntaxKind["Parameter"] = 149] = "Parameter";
SyntaxKind[SyntaxKind["Decorator"] = 150] = "Decorator";
- // TypeMember
SyntaxKind[SyntaxKind["PropertySignature"] = 151] = "PropertySignature";
SyntaxKind[SyntaxKind["PropertyDeclaration"] = 152] = "PropertyDeclaration";
SyntaxKind[SyntaxKind["MethodSignature"] = 153] = "MethodSignature";
@@ -2176,7 +1904,6 @@ var ts;
SyntaxKind[SyntaxKind["CallSignature"] = 158] = "CallSignature";
SyntaxKind[SyntaxKind["ConstructSignature"] = 159] = "ConstructSignature";
SyntaxKind[SyntaxKind["IndexSignature"] = 160] = "IndexSignature";
- // Type
SyntaxKind[SyntaxKind["TypePredicate"] = 161] = "TypePredicate";
SyntaxKind[SyntaxKind["TypeReference"] = 162] = "TypeReference";
SyntaxKind[SyntaxKind["FunctionType"] = 163] = "FunctionType";
@@ -2196,11 +1923,9 @@ var ts;
SyntaxKind[SyntaxKind["MappedType"] = 177] = "MappedType";
SyntaxKind[SyntaxKind["LiteralType"] = 178] = "LiteralType";
SyntaxKind[SyntaxKind["ImportType"] = 179] = "ImportType";
- // Binding patterns
SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 180] = "ObjectBindingPattern";
SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 181] = "ArrayBindingPattern";
SyntaxKind[SyntaxKind["BindingElement"] = 182] = "BindingElement";
- // Expression
SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 183] = "ArrayLiteralExpression";
SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 184] = "ObjectLiteralExpression";
SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 185] = "PropertyAccessExpression";
@@ -2229,10 +1954,8 @@ var ts;
SyntaxKind[SyntaxKind["AsExpression"] = 208] = "AsExpression";
SyntaxKind[SyntaxKind["NonNullExpression"] = 209] = "NonNullExpression";
SyntaxKind[SyntaxKind["MetaProperty"] = 210] = "MetaProperty";
- // Misc
SyntaxKind[SyntaxKind["TemplateSpan"] = 211] = "TemplateSpan";
SyntaxKind[SyntaxKind["SemicolonClassElement"] = 212] = "SemicolonClassElement";
- // Element
SyntaxKind[SyntaxKind["Block"] = 213] = "Block";
SyntaxKind[SyntaxKind["VariableStatement"] = 214] = "VariableStatement";
SyntaxKind[SyntaxKind["EmptyStatement"] = 215] = "EmptyStatement";
@@ -2274,9 +1997,7 @@ var ts;
SyntaxKind[SyntaxKind["NamedExports"] = 251] = "NamedExports";
SyntaxKind[SyntaxKind["ExportSpecifier"] = 252] = "ExportSpecifier";
SyntaxKind[SyntaxKind["MissingDeclaration"] = 253] = "MissingDeclaration";
- // Module references
SyntaxKind[SyntaxKind["ExternalModuleReference"] = 254] = "ExternalModuleReference";
- // JSX
SyntaxKind[SyntaxKind["JsxElement"] = 255] = "JsxElement";
SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 256] = "JsxSelfClosingElement";
SyntaxKind[SyntaxKind["JsxOpeningElement"] = 257] = "JsxOpeningElement";
@@ -2288,27 +2009,20 @@ var ts;
SyntaxKind[SyntaxKind["JsxAttributes"] = 263] = "JsxAttributes";
SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 264] = "JsxSpreadAttribute";
SyntaxKind[SyntaxKind["JsxExpression"] = 265] = "JsxExpression";
- // Clauses
SyntaxKind[SyntaxKind["CaseClause"] = 266] = "CaseClause";
SyntaxKind[SyntaxKind["DefaultClause"] = 267] = "DefaultClause";
SyntaxKind[SyntaxKind["HeritageClause"] = 268] = "HeritageClause";
SyntaxKind[SyntaxKind["CatchClause"] = 269] = "CatchClause";
- // Property assignments
SyntaxKind[SyntaxKind["PropertyAssignment"] = 270] = "PropertyAssignment";
SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 271] = "ShorthandPropertyAssignment";
SyntaxKind[SyntaxKind["SpreadAssignment"] = 272] = "SpreadAssignment";
- // Enum
SyntaxKind[SyntaxKind["EnumMember"] = 273] = "EnumMember";
- // Top-level nodes
SyntaxKind[SyntaxKind["SourceFile"] = 274] = "SourceFile";
SyntaxKind[SyntaxKind["Bundle"] = 275] = "Bundle";
SyntaxKind[SyntaxKind["UnparsedSource"] = 276] = "UnparsedSource";
SyntaxKind[SyntaxKind["InputFiles"] = 277] = "InputFiles";
- // JSDoc nodes
SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 278] = "JSDocTypeExpression";
- // The * type
SyntaxKind[SyntaxKind["JSDocAllType"] = 279] = "JSDocAllType";
- // The ? type
SyntaxKind[SyntaxKind["JSDocUnknownType"] = 280] = "JSDocUnknownType";
SyntaxKind[SyntaxKind["JSDocNullableType"] = 281] = "JSDocNullableType";
SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 282] = "JSDocNonNullableType";
@@ -2324,21 +2038,18 @@ var ts;
SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 292] = "JSDocCallbackTag";
SyntaxKind[SyntaxKind["JSDocParameterTag"] = 293] = "JSDocParameterTag";
SyntaxKind[SyntaxKind["JSDocReturnTag"] = 294] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 295] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 296] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 297] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 298] = "JSDocPropertyTag";
- // Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 299] = "SyntaxList";
- // Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 300] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 301] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["CommaListExpression"] = 302] = "CommaListExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 303] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 304] = "EndOfDeclarationMarker";
- // Enum value count
- SyntaxKind[SyntaxKind["Count"] = 305] = "Count";
- // Markers
+ SyntaxKind[SyntaxKind["JSDocThisTag"] = 295] = "JSDocThisTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 296] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 297] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 298] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 299] = "JSDocPropertyTag";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 300] = "SyntaxList";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 301] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 302] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["CommaListExpression"] = 303] = "CommaListExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 304] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 305] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["Count"] = 306] = "Count";
SyntaxKind[SyntaxKind["FirstAssignment"] = 58] = "FirstAssignment";
SyntaxKind[SyntaxKind["LastAssignment"] = 70] = "LastAssignment";
SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 59] = "FirstCompoundAssignment";
@@ -2365,11 +2076,11 @@ var ts;
SyntaxKind[SyntaxKind["LastBinaryOperator"] = 70] = "LastBinaryOperator";
SyntaxKind[SyntaxKind["FirstNode"] = 146] = "FirstNode";
SyntaxKind[SyntaxKind["FirstJSDocNode"] = 278] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 298] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 299] = "LastJSDocNode";
SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 289] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 298] = "LastJSDocTagNode";
- /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 117] = "FirstContextualKeyword";
- /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 145] = "LastContextualKeyword";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 299] = "LastJSDocTagNode";
+ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 117] = "FirstContextualKeyword";
+ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 145] = "LastContextualKeyword";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
var NodeFlags;
(function (NodeFlags) {
@@ -2393,32 +2104,18 @@ var ts;
NodeFlags[NodeFlags["JavaScriptFile"] = 65536] = "JavaScriptFile";
NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 131072] = "ThisNodeOrAnySubNodesHasError";
NodeFlags[NodeFlags["HasAggregatedChildData"] = 262144] = "HasAggregatedChildData";
- // These flags will be set when the parser encounters a dynamic import expression or 'import.meta' to avoid
- // walking the tree if the flags are not set. However, these flags are just a approximation
- // (hence why it's named "PossiblyContainsDynamicImport") because once set, the flags never get cleared.
- // During editing, if a dynamic import is removed, incremental parsing will *NOT* clear this flag.
- // This means that the tree will always be traversed during module resolution, or when looking for external module indicators.
- // However, the removal operation should not occur often and in the case of the
- // removal, it is likely that users will add the import anyway.
- // The advantage of this approach is its simplicity. For the case of batch compilation,
- // we guarantee that users won't have to pay the price of walking the tree if a dynamic import isn't used.
- /* @internal */ NodeFlags[NodeFlags["PossiblyContainsDynamicImport"] = 524288] = "PossiblyContainsDynamicImport";
- /* @internal */ NodeFlags[NodeFlags["PossiblyContainsImportMeta"] = 1048576] = "PossiblyContainsImportMeta";
+ NodeFlags[NodeFlags["PossiblyContainsDynamicImport"] = 524288] = "PossiblyContainsDynamicImport";
+ NodeFlags[NodeFlags["PossiblyContainsImportMeta"] = 1048576] = "PossiblyContainsImportMeta";
NodeFlags[NodeFlags["JSDoc"] = 2097152] = "JSDoc";
- /* @internal */ NodeFlags[NodeFlags["Ambient"] = 4194304] = "Ambient";
- /* @internal */ NodeFlags[NodeFlags["InWithStatement"] = 8388608] = "InWithStatement";
+ NodeFlags[NodeFlags["Ambient"] = 4194304] = "Ambient";
+ NodeFlags[NodeFlags["InWithStatement"] = 8388608] = "InWithStatement";
NodeFlags[NodeFlags["JsonFile"] = 16777216] = "JsonFile";
NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped";
NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 384] = "ReachabilityCheckFlags";
NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 1408] = "ReachabilityAndEmitFlags";
- // Parsing context flags
NodeFlags[NodeFlags["ContextFlags"] = 12679168] = "ContextFlags";
- // Exclude these flags when parsing a Type
NodeFlags[NodeFlags["TypeExcludesFlags"] = 20480] = "TypeExcludesFlags";
- // Represents all flags that are potentially set once and
- // never cleared on SourceFiles which get re-used in between incremental parses.
- // See the comment above on `PossiblyContainsDynamicImport` and `PossiblyContainsImportMeta`.
- /* @internal */ NodeFlags[NodeFlags["PermanentlySetIncrementalFlags"] = 1572864] = "PermanentlySetIncrementalFlags";
+ NodeFlags[NodeFlags["PermanentlySetIncrementalFlags"] = 1572864] = "PermanentlySetIncrementalFlags";
})(NodeFlags = ts.NodeFlags || (ts.NodeFlags = {}));
var ModifierFlags;
(function (ModifierFlags) {
@@ -2436,7 +2133,6 @@ var ts;
ModifierFlags[ModifierFlags["Const"] = 2048] = "Const";
ModifierFlags[ModifierFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
ModifierFlags[ModifierFlags["AccessibilityModifier"] = 28] = "AccessibilityModifier";
- // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property.
ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 92] = "ParameterPropertyModifier";
ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier";
ModifierFlags[ModifierFlags["TypeScriptModifier"] = 2270] = "TypeScriptModifier";
@@ -2446,35 +2142,28 @@ var ts;
var JsxFlags;
(function (JsxFlags) {
JsxFlags[JsxFlags["None"] = 0] = "None";
- /** An element from a named property of the JSX.IntrinsicElements interface */
JsxFlags[JsxFlags["IntrinsicNamedElement"] = 1] = "IntrinsicNamedElement";
- /** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
JsxFlags[JsxFlags["IntrinsicIndexedElement"] = 2] = "IntrinsicIndexedElement";
JsxFlags[JsxFlags["IntrinsicElement"] = 3] = "IntrinsicElement";
})(JsxFlags = ts.JsxFlags || (ts.JsxFlags = {}));
- /* @internal */
var RelationComparisonResult;
(function (RelationComparisonResult) {
RelationComparisonResult[RelationComparisonResult["Succeeded"] = 1] = "Succeeded";
RelationComparisonResult[RelationComparisonResult["Failed"] = 2] = "Failed";
RelationComparisonResult[RelationComparisonResult["FailedAndReported"] = 3] = "FailedAndReported";
})(RelationComparisonResult = ts.RelationComparisonResult || (ts.RelationComparisonResult = {}));
- /*@internal*/
var GeneratedIdentifierFlags;
(function (GeneratedIdentifierFlags) {
- // Kinds
GeneratedIdentifierFlags[GeneratedIdentifierFlags["None"] = 0] = "None";
GeneratedIdentifierFlags[GeneratedIdentifierFlags["Auto"] = 1] = "Auto";
GeneratedIdentifierFlags[GeneratedIdentifierFlags["Loop"] = 2] = "Loop";
GeneratedIdentifierFlags[GeneratedIdentifierFlags["Unique"] = 3] = "Unique";
GeneratedIdentifierFlags[GeneratedIdentifierFlags["Node"] = 4] = "Node";
GeneratedIdentifierFlags[GeneratedIdentifierFlags["KindMask"] = 7] = "KindMask";
- // Flags
GeneratedIdentifierFlags[GeneratedIdentifierFlags["ReservedInNestedScopes"] = 8] = "ReservedInNestedScopes";
GeneratedIdentifierFlags[GeneratedIdentifierFlags["Optimistic"] = 16] = "Optimistic";
GeneratedIdentifierFlags[GeneratedIdentifierFlags["FileLevel"] = 32] = "FileLevel";
})(GeneratedIdentifierFlags = ts.GeneratedIdentifierFlags || (ts.GeneratedIdentifierFlags = {}));
- /* @internal */
var TokenFlags;
(function (TokenFlags) {
TokenFlags[TokenFlags["None"] = 0] = "None";
@@ -2509,32 +2198,24 @@ var ts;
FlowFlags[FlowFlags["Label"] = 12] = "Label";
FlowFlags[FlowFlags["Condition"] = 96] = "Condition";
})(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {}));
- var OperationCanceledException = /** @class */ (function () {
+ var OperationCanceledException = (function () {
function OperationCanceledException() {
}
return OperationCanceledException;
}());
ts.OperationCanceledException = OperationCanceledException;
- /* @internal */
var StructureIsReused;
(function (StructureIsReused) {
StructureIsReused[StructureIsReused["Not"] = 0] = "Not";
StructureIsReused[StructureIsReused["SafeModules"] = 1] = "SafeModules";
StructureIsReused[StructureIsReused["Completely"] = 2] = "Completely";
})(StructureIsReused = ts.StructureIsReused || (ts.StructureIsReused = {}));
- /** Return code used by getEmitOutput function to indicate status of the function */
var ExitStatus;
(function (ExitStatus) {
- // Compiler ran successfully. Either this was a simple do-nothing compilation (for example,
- // when -version or -help was provided, or this was a normal compilation, no diagnostics
- // were produced, and all outputs were generated successfully.
ExitStatus[ExitStatus["Success"] = 0] = "Success";
- // Diagnostics were produced and because of them no code was generated.
ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped";
- // Diagnostics were produced and outputs were generated in spite of them.
ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated";
})(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {}));
- /* @internal */
var UnionReduction;
(function (UnionReduction) {
UnionReduction[UnionReduction["None"] = 0] = "None";
@@ -2544,7 +2225,6 @@ var ts;
var NodeBuilderFlags;
(function (NodeBuilderFlags) {
NodeBuilderFlags[NodeBuilderFlags["None"] = 0] = "None";
- // Options
NodeBuilderFlags[NodeBuilderFlags["NoTruncation"] = 1] = "NoTruncation";
NodeBuilderFlags[NodeBuilderFlags["WriteArrayAsGenericType"] = 2] = "WriteArrayAsGenericType";
NodeBuilderFlags[NodeBuilderFlags["GenerateNamesForShadowedTypeParams"] = 4] = "GenerateNamesForShadowedTypeParams";
@@ -2560,7 +2240,6 @@ var ts;
NodeBuilderFlags[NodeBuilderFlags["UseTypeOfFunction"] = 4096] = "UseTypeOfFunction";
NodeBuilderFlags[NodeBuilderFlags["OmitParameterModifiers"] = 8192] = "OmitParameterModifiers";
NodeBuilderFlags[NodeBuilderFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
- // Error handling
NodeBuilderFlags[NodeBuilderFlags["AllowThisInObjectLiteral"] = 32768] = "AllowThisInObjectLiteral";
NodeBuilderFlags[NodeBuilderFlags["AllowQualifedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifedNameInPlaceOfIdentifier";
NodeBuilderFlags[NodeBuilderFlags["AllowAnonymousIdentifier"] = 131072] = "AllowAnonymousIdentifier";
@@ -2569,70 +2248,49 @@ var ts;
NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType";
NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType";
NodeBuilderFlags[NodeBuilderFlags["IgnoreErrors"] = 3112960] = "IgnoreErrors";
- // State
NodeBuilderFlags[NodeBuilderFlags["InObjectTypeLiteral"] = 4194304] = "InObjectTypeLiteral";
NodeBuilderFlags[NodeBuilderFlags["InTypeAlias"] = 8388608] = "InTypeAlias";
NodeBuilderFlags[NodeBuilderFlags["InInitialEntityName"] = 16777216] = "InInitialEntityName";
NodeBuilderFlags[NodeBuilderFlags["InReverseMappedType"] = 33554432] = "InReverseMappedType";
})(NodeBuilderFlags = ts.NodeBuilderFlags || (ts.NodeBuilderFlags = {}));
- // Ensure the shared flags between this and `NodeBuilderFlags` stay in alignment
var TypeFormatFlags;
(function (TypeFormatFlags) {
TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None";
TypeFormatFlags[TypeFormatFlags["NoTruncation"] = 1] = "NoTruncation";
TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 2] = "WriteArrayAsGenericType";
- // hole because there's a hole in node builder flags
TypeFormatFlags[TypeFormatFlags["UseStructuralFallback"] = 8] = "UseStructuralFallback";
- // hole because there's a hole in node builder flags
TypeFormatFlags[TypeFormatFlags["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature";
TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 64] = "UseFullyQualifiedType";
- // hole because `UseOnlyExternalAliasing` is here in node builder flags, but functions which take old flags use `SymbolFormatFlags` instead
TypeFormatFlags[TypeFormatFlags["SuppressAnyReturnType"] = 256] = "SuppressAnyReturnType";
- // hole because `WriteTypeParametersInQualifiedName` is here in node builder flags, but functions which take old flags use `SymbolFormatFlags` for this instead
TypeFormatFlags[TypeFormatFlags["MultilineObjectLiterals"] = 1024] = "MultilineObjectLiterals";
TypeFormatFlags[TypeFormatFlags["WriteClassExpressionAsTypeLiteral"] = 2048] = "WriteClassExpressionAsTypeLiteral";
TypeFormatFlags[TypeFormatFlags["UseTypeOfFunction"] = 4096] = "UseTypeOfFunction";
TypeFormatFlags[TypeFormatFlags["OmitParameterModifiers"] = 8192] = "OmitParameterModifiers";
TypeFormatFlags[TypeFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
- // even though `T` can't be accessed in the current scope.
- // Error Handling
TypeFormatFlags[TypeFormatFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType";
- // TypeFormatFlags exclusive
TypeFormatFlags[TypeFormatFlags["AddUndefined"] = 131072] = "AddUndefined";
TypeFormatFlags[TypeFormatFlags["WriteArrowStyleSignature"] = 262144] = "WriteArrowStyleSignature";
- // State
TypeFormatFlags[TypeFormatFlags["InArrayType"] = 524288] = "InArrayType";
TypeFormatFlags[TypeFormatFlags["InElementType"] = 2097152] = "InElementType";
TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 4194304] = "InFirstTypeArgument";
TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 8388608] = "InTypeAlias";
- /** @deprecated */ TypeFormatFlags[TypeFormatFlags["WriteOwnNameForAnyLike"] = 0] = "WriteOwnNameForAnyLike";
+ TypeFormatFlags[TypeFormatFlags["WriteOwnNameForAnyLike"] = 0] = "WriteOwnNameForAnyLike";
TypeFormatFlags[TypeFormatFlags["NodeBuilderFlagsMask"] = 9469291] = "NodeBuilderFlagsMask";
})(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {}));
var SymbolFormatFlags;
(function (SymbolFormatFlags) {
SymbolFormatFlags[SymbolFormatFlags["None"] = 0] = "None";
- // Write symbols's type argument if it is instantiated symbol
- // eg. class C { p: T } <-- Show p as C.p here
- // var a: C;
- // var p = a.p; <--- Here p is property of C so show it as C.p instead of just C.p
SymbolFormatFlags[SymbolFormatFlags["WriteTypeParametersOrArguments"] = 1] = "WriteTypeParametersOrArguments";
- // Use only external alias information to get the symbol name in the given context
- // eg. module m { export class c { } } import x = m.c;
- // When this flag is specified m.c will be used to refer to the class instead of alias symbol x
SymbolFormatFlags[SymbolFormatFlags["UseOnlyExternalAliasing"] = 2] = "UseOnlyExternalAliasing";
- // Build symbol name using any nodes needed, instead of just components of an entity name
SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind";
- // Prefer aliases which are not directly visible
SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope";
})(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {}));
- /* @internal */
var SymbolAccessibility;
(function (SymbolAccessibility) {
SymbolAccessibility[SymbolAccessibility["Accessible"] = 0] = "Accessible";
SymbolAccessibility[SymbolAccessibility["NotAccessible"] = 1] = "NotAccessible";
SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed";
})(SymbolAccessibility = ts.SymbolAccessibility || (ts.SymbolAccessibility = {}));
- /* @internal */
var SyntheticSymbolKind;
(function (SyntheticSymbolKind) {
SyntheticSymbolKind[SyntheticSymbolKind["UnionOrIntersection"] = 0] = "UnionOrIntersection";
@@ -2643,16 +2301,10 @@ var ts;
TypePredicateKind[TypePredicateKind["This"] = 0] = "This";
TypePredicateKind[TypePredicateKind["Identifier"] = 1] = "Identifier";
})(TypePredicateKind = ts.TypePredicateKind || (ts.TypePredicateKind = {}));
- /** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator metadata */
- /* @internal */
var TypeReferenceSerializationKind;
(function (TypeReferenceSerializationKind) {
TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown";
- // should be emitted using a safe fallback.
TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithConstructSignatureAndValue"] = 1] = "TypeWithConstructSignatureAndValue";
- // function that can be reached at runtime (e.g. a `class`
- // declaration or a `var` declaration for the static side
- // of a type, such as the global `Promise` type in lib.d.ts).
TypeReferenceSerializationKind[TypeReferenceSerializationKind["VoidNullableOrNeverType"] = 2] = "VoidNullableOrNeverType";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["NumberLikeType"] = 3] = "NumberLikeType";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["StringLikeType"] = 4] = "StringLikeType";
@@ -2661,7 +2313,6 @@ var ts;
TypeReferenceSerializationKind[TypeReferenceSerializationKind["ESSymbolType"] = 7] = "ESSymbolType";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["Promise"] = 8] = "Promise";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithCallSignature"] = 9] = "TypeWithCallSignature";
- // with call signatures.
TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 10] = "ObjectType";
})(TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {}));
var SymbolFlags;
@@ -2694,7 +2345,6 @@ var ts;
SymbolFlags[SymbolFlags["Optional"] = 16777216] = "Optional";
SymbolFlags[SymbolFlags["Transient"] = 33554432] = "Transient";
SymbolFlags[SymbolFlags["JSContainer"] = 67108864] = "JSContainer";
- /* @internal */
SymbolFlags[SymbolFlags["All"] = 67108863] = "All";
SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum";
SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable";
@@ -2703,11 +2353,7 @@ var ts;
SymbolFlags[SymbolFlags["Namespace"] = 1920] = "Namespace";
SymbolFlags[SymbolFlags["Module"] = 1536] = "Module";
SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor";
- // Variables can be redeclared, but can not redeclare a block-scoped declaration with the
- // same name, or any other value that is not a variable, e.g. ValueModule or Class
SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 67216318] = "FunctionScopedVariableExcludes";
- // Block-scoped declarations are not allowed to be re-declared
- // they can not merge with anything in the value space
SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 67216319] = "BlockScopedVariableExcludes";
SymbolFlags[SymbolFlags["ParameterExcludes"] = 67216319] = "ParameterExcludes";
SymbolFlags[SymbolFlags["PropertyExcludes"] = 0] = "PropertyExcludes";
@@ -2732,20 +2378,14 @@ var ts;
SymbolFlags[SymbolFlags["BlockScoped"] = 418] = "BlockScoped";
SymbolFlags[SymbolFlags["PropertyOrAccessor"] = 98308] = "PropertyOrAccessor";
SymbolFlags[SymbolFlags["ClassMember"] = 106500] = "ClassMember";
- /* @internal */
- // The set of things we consider semantically classifiable. Used to speed up the LS during
- // classification.
SymbolFlags[SymbolFlags["Classifiable"] = 2885600] = "Classifiable";
- /* @internal */
SymbolFlags[SymbolFlags["LateBindingContainer"] = 6240] = "LateBindingContainer";
})(SymbolFlags = ts.SymbolFlags || (ts.SymbolFlags = {}));
- /* @internal */
var EnumKind;
(function (EnumKind) {
EnumKind[EnumKind["Numeric"] = 0] = "Numeric";
- EnumKind[EnumKind["Literal"] = 1] = "Literal"; // Literal enum (each member has a TypeFlags.EnumLiteral type)
+ EnumKind[EnumKind["Literal"] = 1] = "Literal";
})(EnumKind = ts.EnumKind || (ts.EnumKind = {}));
- /* @internal */
var CheckFlags;
(function (CheckFlags) {
CheckFlags[CheckFlags["Instantiated"] = 1] = "Instantiated";
@@ -2781,7 +2421,6 @@ var ts;
InternalSymbolName["ExportEquals"] = "export=";
InternalSymbolName["Default"] = "default";
})(InternalSymbolName = ts.InternalSymbolName || (ts.InternalSymbolName = {}));
- /* @internal */
var NodeCheckFlags;
(function (NodeCheckFlags) {
NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked";
@@ -2833,31 +2472,20 @@ var ts;
TypeFlags[TypeFlags["Conditional"] = 4194304] = "Conditional";
TypeFlags[TypeFlags["Substitution"] = 8388608] = "Substitution";
TypeFlags[TypeFlags["NonPrimitive"] = 16777216] = "NonPrimitive";
- /* @internal */
TypeFlags[TypeFlags["FreshLiteral"] = 33554432] = "FreshLiteral";
- /* @internal */
TypeFlags[TypeFlags["UnionOfUnitTypes"] = 67108864] = "UnionOfUnitTypes";
- /* @internal */
TypeFlags[TypeFlags["ContainsWideningType"] = 134217728] = "ContainsWideningType";
- /* @internal */
TypeFlags[TypeFlags["ContainsObjectLiteral"] = 268435456] = "ContainsObjectLiteral";
- /* @internal */
TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 536870912] = "ContainsAnyFunctionType";
- /* @internal */
TypeFlags[TypeFlags["AnyOrUnknown"] = 3] = "AnyOrUnknown";
- /* @internal */
TypeFlags[TypeFlags["Nullable"] = 24576] = "Nullable";
TypeFlags[TypeFlags["Literal"] = 448] = "Literal";
TypeFlags[TypeFlags["Unit"] = 27072] = "Unit";
TypeFlags[TypeFlags["StringOrNumberLiteral"] = 192] = "StringOrNumberLiteral";
- /* @internal */
TypeFlags[TypeFlags["StringOrNumberLiteralOrUnique"] = 2240] = "StringOrNumberLiteralOrUnique";
- /* @internal */
TypeFlags[TypeFlags["DefinitelyFalsy"] = 29120] = "DefinitelyFalsy";
TypeFlags[TypeFlags["PossiblyFalsy"] = 29148] = "PossiblyFalsy";
- /* @internal */
TypeFlags[TypeFlags["Intrinsic"] = 16839967] = "Intrinsic";
- /* @internal */
TypeFlags[TypeFlags["Primitive"] = 32764] = "Primitive";
TypeFlags[TypeFlags["StringLike"] = 68] = "StringLike";
TypeFlags[TypeFlags["NumberLike"] = 168] = "NumberLike";
@@ -2865,7 +2493,6 @@ var ts;
TypeFlags[TypeFlags["EnumLike"] = 544] = "EnumLike";
TypeFlags[TypeFlags["ESSymbolLike"] = 3072] = "ESSymbolLike";
TypeFlags[TypeFlags["VoidLike"] = 12288] = "VoidLike";
- /* @internal */
TypeFlags[TypeFlags["DisjointDomains"] = 16809468] = "DisjointDomains";
TypeFlags[TypeFlags["UnionOrIntersection"] = 786432] = "UnionOrIntersection";
TypeFlags[TypeFlags["StructuredType"] = 917504] = "StructuredType";
@@ -2874,27 +2501,15 @@ var ts;
TypeFlags[TypeFlags["InstantiablePrimitive"] = 1048576] = "InstantiablePrimitive";
TypeFlags[TypeFlags["Instantiable"] = 15794176] = "Instantiable";
TypeFlags[TypeFlags["StructuredOrInstantiable"] = 16711680] = "StructuredOrInstantiable";
- // 'Narrowable' types are types where narrowing actually narrows.
- // This *should* be every type other than null, undefined, void, and never
TypeFlags[TypeFlags["Narrowable"] = 33492479] = "Narrowable";
TypeFlags[TypeFlags["NotUnionOrUnit"] = 16909315] = "NotUnionOrUnit";
- /* @internal */
TypeFlags[TypeFlags["NotUnit"] = 16749629] = "NotUnit";
- /* @internal */
TypeFlags[TypeFlags["RequiresWidening"] = 402653184] = "RequiresWidening";
- /* @internal */
TypeFlags[TypeFlags["PropagatingFlags"] = 939524096] = "PropagatingFlags";
- // The following flags are used for different purposes during union and intersection type construction
- /* @internal */
TypeFlags[TypeFlags["NonWideningType"] = 134217728] = "NonWideningType";
- /* @internal */
TypeFlags[TypeFlags["Wildcard"] = 268435456] = "Wildcard";
- /* @internal */
TypeFlags[TypeFlags["EmptyObject"] = 536870912] = "EmptyObject";
- /* @internal */
TypeFlags[TypeFlags["ConstructionFlags"] = 939524096] = "ConstructionFlags";
- // The following flag is used for different purposes by maybeTypeOfKind
- /* @internal */
TypeFlags[TypeFlags["GenericMappedType"] = 134217728] = "GenericMappedType";
})(TypeFlags = ts.TypeFlags || (ts.TypeFlags = {}));
var ObjectFlags;
@@ -2915,7 +2530,6 @@ var ts;
ObjectFlags[ObjectFlags["MarkerType"] = 8192] = "MarkerType";
ObjectFlags[ObjectFlags["ClassOrInterface"] = 3] = "ClassOrInterface";
})(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {}));
- /* @internal */
var Variance;
(function (Variance) {
Variance[Variance["Invariant"] = 0] = "Invariant";
@@ -2945,7 +2559,6 @@ var ts;
InferencePriority[InferencePriority["AlwaysStrict"] = 64] = "AlwaysStrict";
InferencePriority[InferencePriority["PriorityImpliesCombination"] = 28] = "PriorityImpliesCombination";
})(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {}));
- /* @internal */
var InferenceFlags;
(function (InferenceFlags) {
InferenceFlags[InferenceFlags["None"] = 0] = "None";
@@ -2953,37 +2566,20 @@ var ts;
InferenceFlags[InferenceFlags["NoDefault"] = 2] = "NoDefault";
InferenceFlags[InferenceFlags["AnyDefault"] = 4] = "AnyDefault";
})(InferenceFlags = ts.InferenceFlags || (ts.InferenceFlags = {}));
- /**
- * 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.
- */
- /* @internal */
var Ternary;
(function (Ternary) {
Ternary[Ternary["False"] = 0] = "False";
Ternary[Ternary["Maybe"] = 1] = "Maybe";
Ternary[Ternary["True"] = -1] = "True";
})(Ternary = ts.Ternary || (ts.Ternary = {}));
- /* @internal */
var SpecialPropertyAssignmentKind;
(function (SpecialPropertyAssignmentKind) {
SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["None"] = 0] = "None";
- /// exports.name = expr
SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ExportsProperty"] = 1] = "ExportsProperty";
- /// module.exports = expr
SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ModuleExports"] = 2] = "ModuleExports";
- /// className.prototype.name = expr
SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["PrototypeProperty"] = 3] = "PrototypeProperty";
- /// this.name = expr
SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ThisProperty"] = 4] = "ThisProperty";
- // F.name = expr
SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["Property"] = 5] = "Property";
- // F.prototype = { ... }
SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["Prototype"] = 6] = "Prototype";
})(SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {}));
var DiagnosticCategory;
@@ -2993,7 +2589,6 @@ var ts;
DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion";
DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message";
})(DiagnosticCategory = ts.DiagnosticCategory || (ts.DiagnosticCategory = {}));
- /* @internal */
function diagnosticCategoryName(d, lowerCase) {
if (lowerCase === void 0) { lowerCase = true; }
var name = DiagnosticCategory[d.category];
@@ -3036,10 +2631,6 @@ var ts;
ScriptKind[ScriptKind["TSX"] = 4] = "TSX";
ScriptKind[ScriptKind["External"] = 5] = "External";
ScriptKind[ScriptKind["JSON"] = 6] = "JSON";
- /**
- * 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.
- */
ScriptKind[ScriptKind["Deferred"] = 7] = "Deferred";
})(ScriptKind = ts.ScriptKind || (ts.ScriptKind = {}));
var ScriptTarget;
@@ -3064,7 +2655,6 @@ var ts;
WatchDirectoryFlags[WatchDirectoryFlags["None"] = 0] = "None";
WatchDirectoryFlags[WatchDirectoryFlags["Recursive"] = 1] = "Recursive";
})(WatchDirectoryFlags = ts.WatchDirectoryFlags || (ts.WatchDirectoryFlags = {}));
- /* @internal */
var CharacterCodes;
(function (CharacterCodes) {
CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter";
@@ -3074,7 +2664,6 @@ var ts;
CharacterCodes[CharacterCodes["lineSeparator"] = 8232] = "lineSeparator";
CharacterCodes[CharacterCodes["paragraphSeparator"] = 8233] = "paragraphSeparator";
CharacterCodes[CharacterCodes["nextLine"] = 133] = "nextLine";
- // Unicode 3.0 space characters
CharacterCodes[CharacterCodes["space"] = 32] = "space";
CharacterCodes[CharacterCodes["nonBreakingSpace"] = 160] = "nonBreakingSpace";
CharacterCodes[CharacterCodes["enQuad"] = 8192] = "enQuad";
@@ -3202,12 +2791,9 @@ var ts;
Extension["Jsx"] = ".jsx";
Extension["Json"] = ".json";
})(Extension = ts.Extension || (ts.Extension = {}));
- /* @internal */
var TransformFlags;
(function (TransformFlags) {
TransformFlags[TransformFlags["None"] = 0] = "None";
- // Facts
- // - Flags used to indicate that a node or subtree contains syntax that requires transformation.
TransformFlags[TransformFlags["TypeScript"] = 1] = "TypeScript";
TransformFlags[TransformFlags["ContainsTypeScript"] = 2] = "ContainsTypeScript";
TransformFlags[TransformFlags["ContainsJsx"] = 4] = "ContainsJsx";
@@ -3220,8 +2806,6 @@ var ts;
TransformFlags[TransformFlags["ContainsGenerator"] = 512] = "ContainsGenerator";
TransformFlags[TransformFlags["DestructuringAssignment"] = 1024] = "DestructuringAssignment";
TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 2048] = "ContainsDestructuringAssignment";
- // Markers
- // - Flags used to indicate that a subtree contains a specific transformation.
TransformFlags[TransformFlags["ContainsDecorators"] = 4096] = "ContainsDecorators";
TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 8192] = "ContainsPropertyInitializer";
TransformFlags[TransformFlags["ContainsLexicalThis"] = 16384] = "ContainsLexicalThis";
@@ -3241,12 +2825,7 @@ var ts;
TransformFlags[TransformFlags["ContainsDynamicImport"] = 67108864] = "ContainsDynamicImport";
TransformFlags[TransformFlags["Super"] = 134217728] = "Super";
TransformFlags[TransformFlags["ContainsSuper"] = 268435456] = "ContainsSuper";
- // Please leave this as 1 << 29.
- // It is the maximum bit we can set before we outgrow the size of a v8 small integer (SMI) on an x86 system.
- // It is a good reminder of how much room we have left
TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
- // Assertions
- // - Bitmasks that are used to assert facts about the syntax of a node and its subtree.
TransformFlags[TransformFlags["AssertTypeScript"] = 3] = "AssertTypeScript";
TransformFlags[TransformFlags["AssertJsx"] = 4] = "AssertJsx";
TransformFlags[TransformFlags["AssertESNext"] = 8] = "AssertESNext";
@@ -3255,9 +2834,6 @@ var ts;
TransformFlags[TransformFlags["AssertES2015"] = 192] = "AssertES2015";
TransformFlags[TransformFlags["AssertGenerator"] = 768] = "AssertGenerator";
TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 3072] = "AssertDestructuringAssignment";
- // Scope Exclusions
- // - Bitmasks that exclude flags from propagating out of a specific context
- // into the subtree flags of their container.
TransformFlags[TransformFlags["OuterExpressionExcludes"] = 536872257] = "OuterExpressionExcludes";
TransformFlags[TransformFlags["PropertyAccessExcludes"] = 671089985] = "PropertyAccessExcludes";
TransformFlags[TransformFlags["NodeExcludes"] = 939525441] = "NodeExcludes";
@@ -3274,8 +2850,6 @@ var ts;
TransformFlags[TransformFlags["ParameterExcludes"] = 939525441] = "ParameterExcludes";
TransformFlags[TransformFlags["CatchClauseExcludes"] = 940574017] = "CatchClauseExcludes";
TransformFlags[TransformFlags["BindingPatternExcludes"] = 940049729] = "BindingPatternExcludes";
- // Masks
- // - Additional bitmasks
TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 274432] = "TypeScriptClassSyntaxMask";
TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 163840] = "ES2015FunctionSyntaxMask";
})(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {}));
@@ -3310,14 +2884,9 @@ var ts;
EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 4194304] = "HasEndOfDeclarationMarker";
EmitFlags[EmitFlags["Iterator"] = 8388608] = "Iterator";
EmitFlags[EmitFlags["NoAsciiEscaping"] = 16777216] = "NoAsciiEscaping";
- /*@internal*/ EmitFlags[EmitFlags["TypeScriptClassWrapper"] = 33554432] = "TypeScriptClassWrapper";
- /*@internal*/ EmitFlags[EmitFlags["NeverApplyImportHelper"] = 67108864] = "NeverApplyImportHelper";
+ EmitFlags[EmitFlags["TypeScriptClassWrapper"] = 33554432] = "TypeScriptClassWrapper";
+ EmitFlags[EmitFlags["NeverApplyImportHelper"] = 67108864] = "NeverApplyImportHelper";
})(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {}));
- /**
- * Used by the checker, this enum keeps track of external emit helpers that should be type
- * checked.
- */
- /* @internal */
var ExternalEmitHelpers;
(function (ExternalEmitHelpers) {
ExternalEmitHelpers[ExternalEmitHelpers["Extends"] = 1] = "Extends";
@@ -3339,15 +2908,10 @@ var ts;
ExternalEmitHelpers[ExternalEmitHelpers["MakeTemplateObject"] = 65536] = "MakeTemplateObject";
ExternalEmitHelpers[ExternalEmitHelpers["FirstEmitHelper"] = 1] = "FirstEmitHelper";
ExternalEmitHelpers[ExternalEmitHelpers["LastEmitHelper"] = 65536] = "LastEmitHelper";
- // Helpers included by ES2015 for..of
ExternalEmitHelpers[ExternalEmitHelpers["ForOfIncludes"] = 256] = "ForOfIncludes";
- // Helpers included by ES2017 for..await..of
ExternalEmitHelpers[ExternalEmitHelpers["ForAwaitOfIncludes"] = 16384] = "ForAwaitOfIncludes";
- // Helpers included by ES2017 async generators
ExternalEmitHelpers[ExternalEmitHelpers["AsyncGeneratorIncludes"] = 6144] = "AsyncGeneratorIncludes";
- // Helpers included by yield* in ES2017 async generators
ExternalEmitHelpers[ExternalEmitHelpers["AsyncDelegatorIncludes"] = 26624] = "AsyncDelegatorIncludes";
- // Helpers included by ES2015 spread
ExternalEmitHelpers[ExternalEmitHelpers["SpreadIncludes"] = 1536] = "SpreadIncludes";
})(ExternalEmitHelpers = ts.ExternalEmitHelpers || (ts.ExternalEmitHelpers = {}));
var EmitHint;
@@ -3361,23 +2925,19 @@ var ts;
var ListFormat;
(function (ListFormat) {
ListFormat[ListFormat["None"] = 0] = "None";
- // Line separators
ListFormat[ListFormat["SingleLine"] = 0] = "SingleLine";
ListFormat[ListFormat["MultiLine"] = 1] = "MultiLine";
ListFormat[ListFormat["PreserveLines"] = 2] = "PreserveLines";
ListFormat[ListFormat["LinesMask"] = 3] = "LinesMask";
- // Delimiters
ListFormat[ListFormat["NotDelimited"] = 0] = "NotDelimited";
ListFormat[ListFormat["BarDelimited"] = 4] = "BarDelimited";
ListFormat[ListFormat["AmpersandDelimited"] = 8] = "AmpersandDelimited";
ListFormat[ListFormat["CommaDelimited"] = 16] = "CommaDelimited";
ListFormat[ListFormat["DelimitersMask"] = 28] = "DelimitersMask";
ListFormat[ListFormat["AllowTrailingComma"] = 32] = "AllowTrailingComma";
- // Whitespace
ListFormat[ListFormat["Indented"] = 64] = "Indented";
ListFormat[ListFormat["SpaceBetweenBraces"] = 128] = "SpaceBetweenBraces";
ListFormat[ListFormat["SpaceBetweenSiblings"] = 256] = "SpaceBetweenSiblings";
- // Brackets/Braces
ListFormat[ListFormat["Braces"] = 512] = "Braces";
ListFormat[ListFormat["Parenthesis"] = 1024] = "Parenthesis";
ListFormat[ListFormat["AngleBrackets"] = 2048] = "AngleBrackets";
@@ -3386,13 +2946,11 @@ var ts;
ListFormat[ListFormat["OptionalIfUndefined"] = 8192] = "OptionalIfUndefined";
ListFormat[ListFormat["OptionalIfEmpty"] = 16384] = "OptionalIfEmpty";
ListFormat[ListFormat["Optional"] = 24576] = "Optional";
- // Other
ListFormat[ListFormat["PreferNewLine"] = 32768] = "PreferNewLine";
ListFormat[ListFormat["NoTrailingNewLine"] = 65536] = "NoTrailingNewLine";
ListFormat[ListFormat["NoInterveningComments"] = 131072] = "NoInterveningComments";
ListFormat[ListFormat["NoSpaceIfEmpty"] = 262144] = "NoSpaceIfEmpty";
ListFormat[ListFormat["SingleElement"] = 524288] = "SingleElement";
- // Precomputed Formats
ListFormat[ListFormat["Modifiers"] = 131328] = "Modifiers";
ListFormat[ListFormat["HeritageClauses"] = 256] = "HeritageClauses";
ListFormat[ListFormat["SingleLineTypeLiteralMembers"] = 384] = "SingleLineTypeLiteralMembers";
@@ -3430,40 +2988,18 @@ var ts;
ListFormat[ListFormat["Parameters"] = 1296] = "Parameters";
ListFormat[ListFormat["IndexSignatureParameters"] = 4432] = "IndexSignatureParameters";
})(ListFormat = ts.ListFormat || (ts.ListFormat = {}));
- /* @internal */
var PragmaKindFlags;
(function (PragmaKindFlags) {
PragmaKindFlags[PragmaKindFlags["None"] = 0] = "None";
- /**
- * Triple slash comment of the form
- * ///
- */
PragmaKindFlags[PragmaKindFlags["TripleSlashXML"] = 1] = "TripleSlashXML";
- /**
- * Single line comment of the form
- * // @pragma-name argval1 argval2
- * or
- * /// @pragma-name argval1 argval2
- */
PragmaKindFlags[PragmaKindFlags["SingleLine"] = 2] = "SingleLine";
- /**
- * Multiline non-jsdoc pragma of the form
- * /* @pragma-name argval1 argval2 * /
- */
PragmaKindFlags[PragmaKindFlags["MultiLine"] = 4] = "MultiLine";
PragmaKindFlags[PragmaKindFlags["All"] = 7] = "All";
PragmaKindFlags[PragmaKindFlags["Default"] = 7] = "Default";
})(PragmaKindFlags = ts.PragmaKindFlags || (ts.PragmaKindFlags = {}));
- /**
- * This function only exists to cause exact types to be inferred for all the literals within `commentPragmas`
- */
- /* @internal */
function _contextuallyTypePragmas(args) {
return args;
}
- // While not strictly a type, this is here because `PragmaMap` needs to be here to be used with `SourceFile`, and we don't
- // fancy effectively defining it twice, once in value-space and once in type-space
- /* @internal */
ts.commentPragmas = _contextuallyTypePragmas({
"reference": {
args: [
@@ -3472,38 +3008,32 @@ var ts;
{ name: "path", optional: true, captureSpan: true },
{ name: "no-default-lib", optional: true }
],
- kind: 1 /* TripleSlashXML */
+ kind: 1
},
"amd-dependency": {
args: [{ name: "path" }, { name: "name", optional: true }],
- kind: 1 /* TripleSlashXML */
+ kind: 1
},
"amd-module": {
args: [{ name: "name" }],
- kind: 1 /* TripleSlashXML */
+ kind: 1
},
"ts-check": {
- kind: 2 /* SingleLine */
+ kind: 2
},
"ts-nocheck": {
- kind: 2 /* SingleLine */
+ kind: 2
},
"jsx": {
args: [{ name: "factory" }],
- kind: 4 /* MultiLine */
+ kind: 4
},
});
})(ts || (ts = {}));
var ts;
(function (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.
- */
- /* @internal */
function setStackTraceLimit() {
- if (Error.stackTraceLimit < 100) { // Also tests that we won't set the property if it doesn't exist.
+ if (Error.stackTraceLimit < 100) {
Error.stackTraceLimit = 100;
}
}
@@ -3514,7 +3044,6 @@ var ts;
FileWatcherEventKind[FileWatcherEventKind["Changed"] = 1] = "Changed";
FileWatcherEventKind[FileWatcherEventKind["Deleted"] = 2] = "Deleted";
})(FileWatcherEventKind = ts.FileWatcherEventKind || (ts.FileWatcherEventKind = {}));
- /* @internal */
var PollingInterval;
(function (PollingInterval) {
PollingInterval[PollingInterval["High"] = 2000] = "High";
@@ -3530,13 +3059,11 @@ var ts;
return pollingIntervalsForPriority[watchPriority];
}
var pollingIntervalsForPriority = getPriorityValues(250);
- /* @internal */
function watchFileUsingPriorityPollingInterval(host, fileName, callback, watchPriority) {
return host.watchFile(fileName, callback, pollingInterval(watchPriority));
}
ts.watchFileUsingPriorityPollingInterval = watchFileUsingPriorityPollingInterval;
- /* @internal */
- ts.missingFileModifiedTime = new Date(0); // Any subsequent modification will occur after this time
+ ts.missingFileModifiedTime = new Date(0);
function createPollingIntervalBasedLevels(levels) {
var _a;
return _a = {},
@@ -3547,9 +3074,7 @@ var ts;
}
var defaultChunkLevels = { Low: 32, Medium: 64, High: 256 };
var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels);
- /* @internal */
ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels);
- /* @internal */
function setCustomPollingValues(system) {
if (!system.getEnvironmentVariable) {
return;
@@ -3593,7 +3118,6 @@ var ts;
}
}
ts.setCustomPollingValues = setCustomPollingValues;
- /* @internal */
function createDynamicPriorityPollingWatchFile(host) {
var watchedFiles = [];
var changedFilesInLastPoll = [];
@@ -3613,9 +3137,7 @@ var ts;
return {
close: function () {
file.isClosed = true;
- // Remove from watchedFiles
ts.unorderedRemoveItem(watchedFiles, file);
- // Do not update polling interval queue since that will happen as part of polling
}
};
}
@@ -3628,7 +3150,6 @@ var ts;
}
function pollPollingIntervalQueue(queue) {
queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]);
- // Set the next polling index and timeout
if (queue.length) {
scheduleNextPoll(queue.pollingInterval);
}
@@ -3638,18 +3159,13 @@ var ts;
}
}
function pollLowPollingIntervalQueue(queue) {
- // Always poll complete list of changedFilesInLastPoll
- pollQueue(changedFilesInLastPoll, PollingInterval.Low, /*pollIndex*/ 0, changedFilesInLastPoll.length);
- // Finally do the actual polling of the queue
+ pollQueue(changedFilesInLastPoll, PollingInterval.Low, 0, changedFilesInLastPoll.length);
pollPollingIntervalQueue(queue);
- // Schedule poll if there are files in changedFilesInLastPoll but no files in the actual queue
- // as pollPollingIntervalQueue wont schedule for next poll
if (!queue.pollScheduled && changedFilesInLastPoll.length) {
scheduleNextPoll(PollingInterval.Low);
}
}
function pollQueue(queue, pollingInterval, pollIndex, chunkSize) {
- // Max visit would be all elements of the queue
var needsVisit = queue.length;
var definedValueCopyToIndex = pollIndex;
for (var polled = 0; polled < chunkSize && needsVisit > 0; nextPollIndex(), needsVisit--) {
@@ -3664,12 +3180,10 @@ var ts;
polled++;
var fileChanged = onWatchedFileStat(watchedFile, getModifiedTime(watchedFile.fileName));
if (watchedFile.isClosed) {
- // Closed watcher as part of callback
queue[pollIndex] = undefined;
}
else if (fileChanged) {
watchedFile.unchangedPolls = 0;
- // Changed files go to changedFilesInLastPoll queue
if (queue !== changedFilesInLastPoll) {
queue[pollIndex] = undefined;
addChangedFileToLowPollingIntervalQueue(watchedFile);
@@ -3679,7 +3193,6 @@ var ts;
watchedFile.unchangedPolls++;
}
else if (queue === changedFilesInLastPoll) {
- // Restart unchangedPollCount for unchanged file and move to low polling interval queue
watchedFile.unchangedPolls = 1;
queue[pollIndex] = undefined;
addToPollingIntervalQueue(watchedFile, PollingInterval.Low);
@@ -3690,7 +3203,6 @@ var ts;
addToPollingIntervalQueue(watchedFile, pollingInterval === PollingInterval.Low ? PollingInterval.Medium : PollingInterval.High);
}
if (queue[pollIndex]) {
- // Copy this file to the non hole location
if (definedValueCopyToIndex < pollIndex) {
queue[definedValueCopyToIndex] = watchedFile;
queue[pollIndex] = undefined;
@@ -3698,13 +3210,11 @@ var ts;
definedValueCopyToIndex++;
}
}
- // Return next poll index
return pollIndex;
function nextPollIndex() {
pollIndex++;
if (pollIndex === queue.length) {
if (definedValueCopyToIndex < pollIndex) {
- // There are holes from nextDefinedValueIndex to end of queue, change queue size
queue.length = definedValueCopyToIndex;
}
pollIndex = 0;
@@ -3743,10 +3253,6 @@ var ts;
}
}
ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
- /**
- * Returns true if file status changed
- */
- /*@internal*/
function onWatchedFileStat(watchedFile, modifiedTime) {
var oldTime = watchedFile.mtime.getTime();
var newTime = modifiedTime.getTime();
@@ -3763,22 +3269,11 @@ var ts;
return false;
}
ts.onWatchedFileStat = onWatchedFileStat;
- /**
- * 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)
- */
- /*@internal*/
function createRecursiveDirectoryWatcher(host) {
return createDirectoryWatcher;
- /**
- * Create the directory watcher for the dirPath.
- */
function createDirectoryWatcher(dirName, callback) {
var watcher = host.watchDirectory(dirName, function (fileName) {
- // Call the actual callback
callback(fileName);
- // Iterate through existing children and update the watches if needed
updateChildWatches(result, callback);
});
var result = {
@@ -3794,33 +3289,21 @@ var ts;
return result;
}
function updateChildWatches(watcher, callback) {
- // Iterate through existing children and update the watches if needed
if (watcher) {
watcher.childWatches = watchChildDirectories(watcher.dirName, watcher.childWatches, callback);
}
}
- /**
- * Watch the directories in the parentDir
- */
function watchChildDirectories(parentDir, existingChildWatches, callback) {
var newChildWatches;
ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? ts.mapDefined(host.getAccessibleSortedChildDirectories(parentDir), function (child) {
var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
- // Filter our the symbolic link directories since those arent included in recursive watch
- // which is same behaviour when recursive: true is passed to fs.watch
- return host.filePathComparer(childFullName, host.realpath(childFullName)) === 0 /* EqualTo */ ? childFullName : undefined;
+ return host.filePathComparer(childFullName, host.realpath(childFullName)) === 0 ? childFullName : undefined;
}) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return host.filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher);
return newChildWatches || ts.emptyArray;
- /**
- * Create new childDirectoryWatcher and add it to the new ChildDirectoryWatcher list
- */
function createAndAddChildDirectoryWatcher(childName) {
var result = createDirectoryWatcher(childName, callback);
addChildDirectoryWatcher(result);
}
- /**
- * Add child directory watcher to the new ChildDirectoryWatcher list
- */
function addChildDirectoryWatcher(childWatcher) {
(newChildWatches || (newChildWatches = [])).push(childWatcher);
}
@@ -3842,17 +3325,12 @@ var ts;
return parseInt(version.substring(1, dot));
}
ts.getNodeMajorVersion = getNodeMajorVersion;
- // TODO: this is used as if it's certainly defined in many places.
ts.sys = (function () {
- // NodeJS detects "\uFEFF" at the start of the string and *replaces* it with the actual
- // byte order mark from the specified encoding. Using any other byte order mark does
- // not actually work.
var byteOrderMarkIndicator = "\uFEFF";
function getNodeSystem() {
var _fs = require("fs");
var _path = require("path");
var _os = require("os");
- // crypto can be absent on reduced node installations
var _crypto;
try {
_crypto = require("crypto");
@@ -3925,7 +3403,7 @@ var ts;
return stat.size;
}
}
- catch ( /*ignore*/_a) { /*ignore*/ }
+ catch (_a) { }
return 0;
},
exit: function (exitCode) {
@@ -3938,7 +3416,6 @@ var ts;
require("source-map-support").install();
}
catch (_a) {
- // Could not enable source maps.
}
},
setTimeout: setTimeout,
@@ -3964,14 +3441,11 @@ var ts;
};
return nodeSystem;
function isFileSystemCaseSensitive() {
- // win32\win64 are case insensitive platforms
if (platform === "win32" || platform === "win64") {
return false;
}
- // If this file exists under a different case, we must be case-insensitve.
return !fileExists(swapCase(__filename));
}
- /** Convert all lowercase chars to uppercase, and vice-versa */
function swapCase(s) {
return s.replace(/\w/g, function (ch) {
var up = ch.toUpperCase();
@@ -3981,30 +3455,22 @@ var ts;
function getWatchFile() {
switch (tscWatchFile) {
case "PriorityPollingInterval":
- // Use polling interval based on priority when create watch using host.watchFile
return fsWatchFile;
case "DynamicPriorityPolling":
- // Use polling interval but change the interval depending on file changes and their default polling interval
return createDynamicPriorityPollingWatchFile({ getModifiedTime: getModifiedTime, setTimeout: setTimeout });
case "UseFsEvents":
- // Use notifications from FS to watch with falling back to fs.watchFile
return watchFileUsingFsWatch;
case "UseFsEventsWithFallbackDynamicPolling":
- // Use notifications from FS to watch with falling back to dynamic watch file
dynamicPollingWatchFile = createDynamicPriorityPollingWatchFile({ getModifiedTime: getModifiedTime, setTimeout: setTimeout });
return createWatchFileUsingDynamicWatchFile(dynamicPollingWatchFile);
case "UseFsEventsOnParentDirectory":
- // Use notifications from FS to watch with falling back to fs.watchFile
return createNonPollingWatchFile();
}
return useNonPollingWatchers ?
createNonPollingWatchFile() :
- // Default to do not use polling interval as it is before this experiment branch
function (fileName, callback) { return fsWatchFile(fileName, callback); };
}
function getWatchDirectory() {
- // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
- // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
var fsSupportsRecursive = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
if (fsSupportsRecursive) {
return watchDirectoryUsingFsWatch;
@@ -4026,11 +3492,10 @@ var ts;
return watchDirectoryRecursively(directoryName, callback);
}
watchDirectory(directoryName, callback);
- return undefined; // TODO: GH#18217
+ return undefined;
};
}
function createNonPollingWatchFile() {
- // One file can have multiple watchers
var fileWatcherCallbacks = ts.createMultiMap();
var dirWatchers = ts.createMap();
var toCanonicalName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
@@ -4056,11 +3521,9 @@ var ts;
}
function createDirectoryWatcher(dirName, dirPath) {
var watcher = fsWatchDirectory(dirName, function (_eventName, relativeFileName) {
- // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
var fileName = !ts.isString(relativeFileName)
- ? undefined // TODO: GH#18217
+ ? undefined
: ts.getNormalizedAbsolutePath(relativeFileName, dirName);
- // Some applications save a working file via rename operations
var callbacks = fileWatcherCallbacks.get(toCanonicalName(fileName));
if (callbacks) {
for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
@@ -4081,12 +3544,9 @@ var ts;
close: function () { return _fs.unwatchFile(fileName, fileChanged); }
};
function fileChanged(curr, prev) {
- // previous event kind check is to ensure we recongnize the file as previously also missing when it is restored or renamed twice (that is it disappears and reappears)
- // In such case, prevTime returned is same as prev time of event when file was deleted as per node documentation
var isPreviouslyDeleted = +prev.mtime === 0 || eventKind === FileWatcherEventKind.Deleted;
if (+curr.mtime === 0) {
if (isPreviouslyDeleted) {
- // Already deleted file, no need to callback again
return;
}
eventKind = FileWatcherEventKind.Deleted;
@@ -4094,12 +3554,10 @@ var ts;
else if (isPreviouslyDeleted) {
eventKind = FileWatcherEventKind.Created;
}
- // If there is no change in modified time, ignore the event
else if (+curr.mtime === +prev.mtime) {
return;
}
else {
- // File changed
eventKind = FileWatcherEventKind.Changed;
}
callback(fileName, eventKind);
@@ -4114,55 +3572,36 @@ var ts;
callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
}
else {
- // Change
callback(fileName, FileWatcherEventKind.Changed);
}
};
}
function createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback) {
return function (eventName, relativeFileName) {
- // In watchDirectory we only care about adding and removing files (when event name is
- // "rename"); changes made within files are handled by corresponding fileWatchers (when
- // event name is "change")
if (eventName === "rename") {
- // When deleting a file, the passed baseFileName is null
callback(!relativeFileName ? directoryName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName)));
}
};
}
function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingWatchFile, pollingInterval) {
var options;
- /** Watcher for the file system entry depending on whether it is missing or present */
var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
watchMissingFileSystemEntry() :
watchPresentFileSystemEntry();
return {
close: function () {
- // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
watcher.close();
watcher = undefined;
}
};
- /**
- * Invoke the callback with rename and update the watcher if not closed
- * @param createWatcher
- */
function invokeCallbackAndUpdateWatcher(createWatcher) {
- // Call the callback for current directory
callback("rename", "");
- // If watcher is not closed, update it
if (watcher) {
watcher.close();
watcher = createWatcher();
}
}
- /**
- * Watch the file or directory that is currently present
- * and when the watched file or directory is deleted, switch to missing file system entry watcher
- */
function watchPresentFileSystemEntry() {
- // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
- // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
if (options === undefined) {
if (isNode4OrLater && (process.platform === "win32" || process.platform === "darwin")) {
options = { persistent: true, recursive: !!recursive };
@@ -4173,47 +3612,32 @@ var ts;
}
try {
var presentWatcher = _fs.watch(fileOrDirectory, options, callback);
- // Watch the missing file or directory or error
presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
return presentWatcher;
}
catch (e) {
- // Catch the exception and use polling instead
- // Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
- // so instead of throwing error, use fs.watchFile
return watchPresentFileSystemEntryWithFsWatchFile();
}
}
- /**
- * Watch the file or directory using fs.watchFile since fs.watch threw exception
- * Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
- */
function watchPresentFileSystemEntryWithFsWatchFile() {
return fallbackPollingWatchFile(fileOrDirectory, createFileWatcherCallback(callback), pollingInterval);
}
- /**
- * Watch the file or directory that is missing
- * and switch to existing file or directory when the missing filesystem entry is created
- */
function watchMissingFileSystemEntry() {
return fallbackPollingWatchFile(fileOrDirectory, function (_fileName, eventKind) {
if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
- // Call the callback for current file or directory
- // For now it could be callback for the inner directory creation,
- // but just return current directory, better than current no-op
invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
}
}, pollingInterval);
}
}
function watchFileUsingFsWatch(fileName, callback, pollingInterval) {
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback), /*recursive*/ false, fsWatchFile, pollingInterval);
+ return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback), false, fsWatchFile, pollingInterval);
}
function createWatchFileUsingDynamicWatchFile(watchFile) {
- return function (fileName, callback, pollingInterval) { return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback), /*recursive*/ false, watchFile, pollingInterval); };
+ return function (fileName, callback, pollingInterval) { return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback), false, watchFile, pollingInterval); };
}
function fsWatchDirectory(directoryName, callback, recursive) {
- return fsWatch(directoryName, 1 /* Directory */, callback, !!recursive, fsWatchFile);
+ return fsWatch(directoryName, 1, callback, !!recursive, fsWatchFile);
}
function watchDirectoryUsingFsWatch(directoryName, callback, recursive) {
return fsWatchDirectory(directoryName, createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback), recursive);
@@ -4228,9 +3652,7 @@ var ts;
var buffer = _fs.readFileSync(fileName);
var len = buffer.length;
if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) {
- // Big endian UTF-16 byte order mark detected. Since big endian is not supported by node.js,
- // flip all byte pairs and treat as little endian.
- len &= ~1; // Round down to a multiple of 2
+ len &= ~1;
for (var i = 0; i < len; i += 2) {
var temp = buffer[i];
buffer[i] = buffer[i + 1];
@@ -4239,25 +3661,21 @@ var ts;
return buffer.toString("utf16le", 2);
}
if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) {
- // Little endian UTF-16 byte order mark detected
return buffer.toString("utf16le", 2);
}
if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {
- // UTF-8 byte order mark detected
return buffer.toString("utf8", 3);
}
- // Default is UTF-8 with no byte order mark
return buffer.toString("utf8");
}
function writeFile(fileName, data, writeByteOrderMark) {
- // If a BOM is required, emit one
if (writeByteOrderMark) {
data = byteOrderMarkIndicator + data;
}
var fd;
try {
fd = _fs.openSync(fileName, "w");
- _fs.writeSync(fd, data, /*position*/ undefined, "utf8");
+ _fs.writeSync(fd, data, undefined, "utf8");
}
finally {
if (fd !== undefined) {
@@ -4270,10 +3688,8 @@ var ts;
var entries = _fs.readdirSync(path || ".").sort();
var files = [];
var directories = [];
- for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
- var entry = entries_1[_i];
- // This is necessary because on some file system node fails to exclude
- // "." and "..". See https://github.com/nodejs/node/issues/4002
+ for (var _i = 0, entries_2 = entries; _i < entries_2.length; _i++) {
+ var entry = entries_2[_i];
if (entry === "." || entry === "..") {
continue;
}
@@ -4305,8 +3721,8 @@ var ts;
try {
var stat = _fs.statSync(path);
switch (entryKind) {
- case 0 /* File */: return stat.isFile();
- case 1 /* Directory */: return stat.isDirectory();
+ case 0: return stat.isFile();
+ case 1: return stat.isDirectory();
default: return false;
}
}
@@ -4315,13 +3731,13 @@ var ts;
}
}
function fileExists(path) {
- return fileSystemEntryExists(path, 0 /* File */);
+ return fileSystemEntryExists(path, 0);
}
function directoryExists(path) {
- return fileSystemEntryExists(path, 1 /* Directory */);
+ return fileSystemEntryExists(path, 1);
}
function getDirectories(path) {
- return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1 /* Directory */); });
+ return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1); });
}
function realpath(path) {
try {
@@ -4355,10 +3771,6 @@ var ts;
return;
}
}
- /**
- * djb2 hashing algorithm
- * http://www.cse.yorku.ca/~oz/hash.html
- */
function generateDjb2Hash(data) {
var chars = data.split("").map(function (str) { return str.charCodeAt(0); });
return "" + chars.reduce(function (prev, curr) { return ((prev << 5) + prev) + curr; }, 5381);
@@ -4382,11 +3794,9 @@ var ts;
useCaseSensitiveFileNames: !!ChakraHost.useCaseSensitiveFileNames,
write: ChakraHost.echo,
readFile: function (path, _encoding) {
- // encoding is automatically handled by the implementation in ChakraHost
return ChakraHost.readFile(path);
},
writeFile: function (path, data, writeByteOrderMark) {
- // If a BOM is required, emit one
if (writeByteOrderMark) {
data = byteOrderMarkIndicator + data;
}
@@ -4423,12 +3833,9 @@ var ts;
sys = getChakraSystem();
}
else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") {
- // process and process.nextTick checks if current environment is node-like
- // process.browser check excludes webpack and browserify
sys = getNodeSystem();
}
if (sys) {
- // patch writefile to create folder before writing the file
var originalWriteFile_1 = sys.writeFile;
sys.writeFile = function (path, data, writeBom) {
var directoryPath = ts.getDirectoryPath(ts.normalizeSlashes(path));
@@ -4443,22 +3850,18 @@ var ts;
if (ts.sys && ts.sys.getEnvironmentVariable) {
setCustomPollingValues(ts.sys);
ts.Debug.currentAssertionLevel = /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))
- ? 1 /* Normal */
- : 0 /* None */;
+ ? 1
+ : 0;
}
if (ts.sys && ts.sys.debugMode) {
ts.Debug.isDebugging = true;
}
})(ts || (ts = {}));
-//
-// generated from './diagnosticInformationMap.generated.ts' by 'src\parser'
-/* @internal */
var ts;
(function (ts) {
function diag(code, category, key, message, reportsUnnecessary) {
return { code: code, category: category, key: key, message: message, reportsUnnecessary: reportsUnnecessary };
}
- // tslint:disable-next-line variable-name
ts.Diagnostics = {
Unterminated_string_literal: diag(1002, ts.DiagnosticCategory.Error, "Unterminated_string_literal_1002", "Unterminated string literal."),
Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."),
@@ -5021,7 +4424,7 @@ var ts;
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, ts.DiagnosticCategory.Error, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
Namespace_0_has_no_exported_member_1: diag(2694, ts.DiagnosticCategory.Error, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
- Left_side_of_comma_operator_is_unused_and_has_no_side_effects: diag(2695, ts.DiagnosticCategory.Error, "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", "Left side of comma operator is unused and has no side effects.", /*reportsUnnecessary*/ true),
+ Left_side_of_comma_operator_is_unused_and_has_no_side_effects: diag(2695, ts.DiagnosticCategory.Error, "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", "Left side of comma operator is unused and has no side effects.", true),
The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: diag(2696, ts.DiagnosticCategory.Error, "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?"),
An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: diag(2697, ts.DiagnosticCategory.Error, "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option."),
Spread_types_may_only_be_created_from_object_types: diag(2698, ts.DiagnosticCategory.Error, "Spread_types_may_only_be_created_from_object_types_2698", "Spread types may only be created from object types."),
@@ -5287,12 +4690,12 @@ var ts;
Resolving_real_path_for_0_result_1: diag(6130, ts.DiagnosticCategory.Message, "Resolving_real_path_for_0_result_1_6130", "Resolving real path for '{0}', result '{1}'."),
Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: diag(6131, ts.DiagnosticCategory.Error, "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'."),
File_name_0_has_a_1_extension_stripping_it: diag(6132, ts.DiagnosticCategory.Message, "File_name_0_has_a_1_extension_stripping_it_6132", "File name '{0}' has a '{1}' extension - stripping it."),
- _0_is_declared_but_its_value_is_never_read: diag(6133, ts.DiagnosticCategory.Error, "_0_is_declared_but_its_value_is_never_read_6133", "'{0}' is declared but its value is never read.", /*reportsUnnecessary*/ true),
+ _0_is_declared_but_its_value_is_never_read: diag(6133, ts.DiagnosticCategory.Error, "_0_is_declared_but_its_value_is_never_read_6133", "'{0}' is declared but its value is never read.", true),
Report_errors_on_unused_locals: diag(6134, ts.DiagnosticCategory.Message, "Report_errors_on_unused_locals_6134", "Report errors on unused locals."),
Report_errors_on_unused_parameters: diag(6135, ts.DiagnosticCategory.Message, "Report_errors_on_unused_parameters_6135", "Report errors on unused parameters."),
The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: diag(6136, ts.DiagnosticCategory.Message, "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", "The maximum dependency depth to search under node_modules and load JavaScript files."),
Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1: diag(6137, ts.DiagnosticCategory.Error, "Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1_6137", "Cannot import type declaration files. Consider importing '{0}' instead of '{1}'."),
- Property_0_is_declared_but_its_value_is_never_read: diag(6138, ts.DiagnosticCategory.Error, "Property_0_is_declared_but_its_value_is_never_read_6138", "Property '{0}' is declared but its value is never read.", /*reportsUnnecessary*/ true),
+ Property_0_is_declared_but_its_value_is_never_read: diag(6138, ts.DiagnosticCategory.Error, "Property_0_is_declared_but_its_value_is_never_read_6138", "Property '{0}' is declared but its value is never read.", true),
Import_emit_helpers_from_tslib: diag(6139, ts.DiagnosticCategory.Message, "Import_emit_helpers_from_tslib_6139", "Import emit helpers from 'tslib'."),
Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: diag(6140, ts.DiagnosticCategory.Error, "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'."),
Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: diag(6141, ts.DiagnosticCategory.Message, "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", "Parse in strict mode and emit \"use strict\" for each source file."),
@@ -5345,14 +4748,14 @@ var ts;
Multiple_consecutive_numeric_separators_are_not_permitted: diag(6189, ts.DiagnosticCategory.Error, "Multiple_consecutive_numeric_separators_are_not_permitted_6189", "Multiple consecutive numeric separators are not permitted."),
Found_package_json_at_0_Package_ID_is_1: diag(6190, ts.DiagnosticCategory.Message, "Found_package_json_at_0_Package_ID_is_1_6190", "Found 'package.json' at '{0}'. Package ID is '{1}'."),
Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen: diag(6191, ts.DiagnosticCategory.Message, "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191", "Whether to keep outdated console output in watch mode instead of clearing the screen."),
- All_imports_in_import_declaration_are_unused: diag(6192, ts.DiagnosticCategory.Error, "All_imports_in_import_declaration_are_unused_6192", "All imports in import declaration are unused.", /*reportsUnnecessary*/ true),
+ All_imports_in_import_declaration_are_unused: diag(6192, ts.DiagnosticCategory.Error, "All_imports_in_import_declaration_are_unused_6192", "All imports in import declaration are unused.", true),
Found_1_error_Watching_for_file_changes: diag(6193, ts.DiagnosticCategory.Message, "Found_1_error_Watching_for_file_changes_6193", "Found 1 error. Watching for file changes."),
Found_0_errors_Watching_for_file_changes: diag(6194, ts.DiagnosticCategory.Message, "Found_0_errors_Watching_for_file_changes_6194", "Found {0} errors. Watching for file changes."),
Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols: diag(6195, ts.DiagnosticCategory.Message, "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195", "Resolve 'keyof' to string valued property names only (no numbers or symbols)."),
- _0_is_declared_but_never_used: diag(6196, ts.DiagnosticCategory.Error, "_0_is_declared_but_never_used_6196", "'{0}' is declared but never used.", /*reportsUnnecessary*/ true),
+ _0_is_declared_but_never_used: diag(6196, ts.DiagnosticCategory.Error, "_0_is_declared_but_never_used_6196", "'{0}' is declared but never used.", true),
Include_modules_imported_with_json_extension: diag(6197, ts.DiagnosticCategory.Message, "Include_modules_imported_with_json_extension_6197", "Include modules imported with '.json' extension"),
- All_destructured_elements_are_unused: diag(6198, ts.DiagnosticCategory.Error, "All_destructured_elements_are_unused_6198", "All destructured elements are unused.", /*reportsUnnecessary*/ true),
- All_variables_are_unused: diag(6199, ts.DiagnosticCategory.Error, "All_variables_are_unused_6199", "All variables are unused.", /*reportsUnnecessary*/ true),
+ All_destructured_elements_are_unused: diag(6198, ts.DiagnosticCategory.Error, "All_destructured_elements_are_unused_6198", "All destructured elements are unused.", true),
+ All_variables_are_unused: diag(6199, ts.DiagnosticCategory.Error, "All_variables_are_unused_6199", "All variables are unused.", true),
Projects_to_reference: diag(6300, ts.DiagnosticCategory.Message, "Projects_to_reference_6300", "Projects to reference"),
Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"),
Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0: diag(6202, ts.DiagnosticCategory.Error, "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202", "Project references may not form a circular graph. Cycle detected: {0}"),
@@ -5402,8 +4805,8 @@ var ts;
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: diag(7024, ts.DiagnosticCategory.Error, "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", "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."),
Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: diag(7025, ts.DiagnosticCategory.Error, "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type."),
JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: diag(7026, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists."),
- Unreachable_code_detected: diag(7027, ts.DiagnosticCategory.Error, "Unreachable_code_detected_7027", "Unreachable code detected.", /*reportsUnnecessary*/ true),
- Unused_label: diag(7028, ts.DiagnosticCategory.Error, "Unused_label_7028", "Unused label.", /*reportsUnnecessary*/ true),
+ Unreachable_code_detected: diag(7027, ts.DiagnosticCategory.Error, "Unreachable_code_detected_7027", "Unreachable code detected.", true),
+ Unused_label: diag(7028, ts.DiagnosticCategory.Error, "Unused_label_7028", "Unused label.", true),
Fallthrough_case_in_switch: diag(7029, ts.DiagnosticCategory.Error, "Fallthrough_case_in_switch_7029", "Fallthrough case in switch."),
Not_all_code_paths_return_a_value: diag(7030, ts.DiagnosticCategory.Error, "Not_all_code_paths_return_a_value_7030", "Not all code paths return a value."),
Binding_element_0_implicitly_has_an_1_type: diag(7031, ts.DiagnosticCategory.Error, "Binding_element_0_implicitly_has_an_1_type_7031", "Binding element '{0}' implicitly has an '{1}' type."),
@@ -5413,7 +4816,7 @@ var ts;
Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0: diag(7035, ts.DiagnosticCategory.Error, "Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_mod_7035", "Try `npm install @types/{0}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`"),
Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0: diag(7036, ts.DiagnosticCategory.Error, "Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036", "Dynamic import's specifier must be of type 'string', but here has type '{0}'."),
Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports: diag(7037, ts.DiagnosticCategory.Message, "Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037", "Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'."),
- A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime: diag(7038, ts.DiagnosticCategory.Error, "A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_7038", "A namespace-style import cannot be called or constructed, and will cause a failure at runtime."),
+ 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: diag(7038, ts.DiagnosticCategory.Error, "Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cau_7038", "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."),
Mapped_object_type_implicitly_has_an_any_template_type: diag(7039, ts.DiagnosticCategory.Error, "Mapped_object_type_implicitly_has_an_any_template_type_7039", "Mapped object type implicitly has an 'any' template type."),
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
@@ -5563,204 +4966,157 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- /* @internal */
function tokenIsIdentifierOrKeyword(token) {
- return token >= 71 /* Identifier */;
+ return token >= 71;
}
ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;
- /* @internal */
function tokenIsIdentifierOrKeywordOrGreaterThan(token) {
- return token === 29 /* GreaterThanToken */ || tokenIsIdentifierOrKeyword(token);
+ return token === 29 || tokenIsIdentifierOrKeyword(token);
}
ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan;
var textToToken = ts.createMapFromTemplate({
- "abstract": 117 /* AbstractKeyword */,
- "any": 119 /* AnyKeyword */,
- "as": 118 /* AsKeyword */,
- "boolean": 122 /* BooleanKeyword */,
- "break": 72 /* BreakKeyword */,
- "case": 73 /* CaseKeyword */,
- "catch": 74 /* CatchKeyword */,
- "class": 75 /* ClassKeyword */,
- "continue": 77 /* ContinueKeyword */,
- "const": 76 /* ConstKeyword */,
- "constructor": 123 /* ConstructorKeyword */,
- "debugger": 78 /* DebuggerKeyword */,
- "declare": 124 /* DeclareKeyword */,
- "default": 79 /* DefaultKeyword */,
- "delete": 80 /* DeleteKeyword */,
- "do": 81 /* DoKeyword */,
- "else": 82 /* ElseKeyword */,
- "enum": 83 /* EnumKeyword */,
- "export": 84 /* ExportKeyword */,
- "extends": 85 /* ExtendsKeyword */,
- "false": 86 /* FalseKeyword */,
- "finally": 87 /* FinallyKeyword */,
- "for": 88 /* ForKeyword */,
- "from": 143 /* FromKeyword */,
- "function": 89 /* FunctionKeyword */,
- "get": 125 /* GetKeyword */,
- "if": 90 /* IfKeyword */,
- "implements": 108 /* ImplementsKeyword */,
- "import": 91 /* ImportKeyword */,
- "in": 92 /* InKeyword */,
- "infer": 126 /* InferKeyword */,
- "instanceof": 93 /* InstanceOfKeyword */,
- "interface": 109 /* InterfaceKeyword */,
- "is": 127 /* IsKeyword */,
- "keyof": 128 /* KeyOfKeyword */,
- "let": 110 /* LetKeyword */,
- "module": 129 /* ModuleKeyword */,
- "namespace": 130 /* NamespaceKeyword */,
- "never": 131 /* NeverKeyword */,
- "new": 94 /* NewKeyword */,
- "null": 95 /* NullKeyword */,
- "number": 134 /* NumberKeyword */,
- "object": 135 /* ObjectKeyword */,
- "package": 111 /* PackageKeyword */,
- "private": 112 /* PrivateKeyword */,
- "protected": 113 /* ProtectedKeyword */,
- "public": 114 /* PublicKeyword */,
- "readonly": 132 /* ReadonlyKeyword */,
- "require": 133 /* RequireKeyword */,
- "global": 144 /* GlobalKeyword */,
- "return": 96 /* ReturnKeyword */,
- "set": 136 /* SetKeyword */,
- "static": 115 /* StaticKeyword */,
- "string": 137 /* StringKeyword */,
- "super": 97 /* SuperKeyword */,
- "switch": 98 /* SwitchKeyword */,
- "symbol": 138 /* SymbolKeyword */,
- "this": 99 /* ThisKeyword */,
- "throw": 100 /* ThrowKeyword */,
- "true": 101 /* TrueKeyword */,
- "try": 102 /* TryKeyword */,
- "type": 139 /* TypeKeyword */,
- "typeof": 103 /* TypeOfKeyword */,
- "undefined": 140 /* UndefinedKeyword */,
- "unique": 141 /* UniqueKeyword */,
- "unknown": 142 /* UnknownKeyword */,
- "var": 104 /* VarKeyword */,
- "void": 105 /* VoidKeyword */,
- "while": 106 /* WhileKeyword */,
- "with": 107 /* WithKeyword */,
- "yield": 116 /* YieldKeyword */,
- "async": 120 /* AsyncKeyword */,
- "await": 121 /* AwaitKeyword */,
- "of": 145 /* OfKeyword */,
- "{": 17 /* OpenBraceToken */,
- "}": 18 /* CloseBraceToken */,
- "(": 19 /* OpenParenToken */,
- ")": 20 /* CloseParenToken */,
- "[": 21 /* OpenBracketToken */,
- "]": 22 /* CloseBracketToken */,
- ".": 23 /* DotToken */,
- "...": 24 /* DotDotDotToken */,
- ";": 25 /* SemicolonToken */,
- ",": 26 /* CommaToken */,
- "<": 27 /* LessThanToken */,
- ">": 29 /* GreaterThanToken */,
- "<=": 30 /* LessThanEqualsToken */,
- ">=": 31 /* GreaterThanEqualsToken */,
- "==": 32 /* EqualsEqualsToken */,
- "!=": 33 /* ExclamationEqualsToken */,
- "===": 34 /* EqualsEqualsEqualsToken */,
- "!==": 35 /* ExclamationEqualsEqualsToken */,
- "=>": 36 /* EqualsGreaterThanToken */,
- "+": 37 /* PlusToken */,
- "-": 38 /* MinusToken */,
- "**": 40 /* AsteriskAsteriskToken */,
- "*": 39 /* AsteriskToken */,
- "/": 41 /* SlashToken */,
- "%": 42 /* PercentToken */,
- "++": 43 /* PlusPlusToken */,
- "--": 44 /* MinusMinusToken */,
- "<<": 45 /* LessThanLessThanToken */,
- "": 28 /* LessThanSlashToken */,
- ">>": 46 /* GreaterThanGreaterThanToken */,
- ">>>": 47 /* GreaterThanGreaterThanGreaterThanToken */,
- "&": 48 /* AmpersandToken */,
- "|": 49 /* BarToken */,
- "^": 50 /* CaretToken */,
- "!": 51 /* ExclamationToken */,
- "~": 52 /* TildeToken */,
- "&&": 53 /* AmpersandAmpersandToken */,
- "||": 54 /* BarBarToken */,
- "?": 55 /* QuestionToken */,
- ":": 56 /* ColonToken */,
- "=": 58 /* EqualsToken */,
- "+=": 59 /* PlusEqualsToken */,
- "-=": 60 /* MinusEqualsToken */,
- "*=": 61 /* AsteriskEqualsToken */,
- "**=": 62 /* AsteriskAsteriskEqualsToken */,
- "/=": 63 /* SlashEqualsToken */,
- "%=": 64 /* PercentEqualsToken */,
- "<<=": 65 /* LessThanLessThanEqualsToken */,
- ">>=": 66 /* GreaterThanGreaterThanEqualsToken */,
- ">>>=": 67 /* GreaterThanGreaterThanGreaterThanEqualsToken */,
- "&=": 68 /* AmpersandEqualsToken */,
- "|=": 69 /* BarEqualsToken */,
- "^=": 70 /* CaretEqualsToken */,
- "@": 57 /* AtToken */,
+ "abstract": 117,
+ "any": 119,
+ "as": 118,
+ "boolean": 122,
+ "break": 72,
+ "case": 73,
+ "catch": 74,
+ "class": 75,
+ "continue": 77,
+ "const": 76,
+ "constructor": 123,
+ "debugger": 78,
+ "declare": 124,
+ "default": 79,
+ "delete": 80,
+ "do": 81,
+ "else": 82,
+ "enum": 83,
+ "export": 84,
+ "extends": 85,
+ "false": 86,
+ "finally": 87,
+ "for": 88,
+ "from": 143,
+ "function": 89,
+ "get": 125,
+ "if": 90,
+ "implements": 108,
+ "import": 91,
+ "in": 92,
+ "infer": 126,
+ "instanceof": 93,
+ "interface": 109,
+ "is": 127,
+ "keyof": 128,
+ "let": 110,
+ "module": 129,
+ "namespace": 130,
+ "never": 131,
+ "new": 94,
+ "null": 95,
+ "number": 134,
+ "object": 135,
+ "package": 111,
+ "private": 112,
+ "protected": 113,
+ "public": 114,
+ "readonly": 132,
+ "require": 133,
+ "global": 144,
+ "return": 96,
+ "set": 136,
+ "static": 115,
+ "string": 137,
+ "super": 97,
+ "switch": 98,
+ "symbol": 138,
+ "this": 99,
+ "throw": 100,
+ "true": 101,
+ "try": 102,
+ "type": 139,
+ "typeof": 103,
+ "undefined": 140,
+ "unique": 141,
+ "unknown": 142,
+ "var": 104,
+ "void": 105,
+ "while": 106,
+ "with": 107,
+ "yield": 116,
+ "async": 120,
+ "await": 121,
+ "of": 145,
+ "{": 17,
+ "}": 18,
+ "(": 19,
+ ")": 20,
+ "[": 21,
+ "]": 22,
+ ".": 23,
+ "...": 24,
+ ";": 25,
+ ",": 26,
+ "<": 27,
+ ">": 29,
+ "<=": 30,
+ ">=": 31,
+ "==": 32,
+ "!=": 33,
+ "===": 34,
+ "!==": 35,
+ "=>": 36,
+ "+": 37,
+ "-": 38,
+ "**": 40,
+ "*": 39,
+ "/": 41,
+ "%": 42,
+ "++": 43,
+ "--": 44,
+ "<<": 45,
+ "": 28,
+ ">>": 46,
+ ">>>": 47,
+ "&": 48,
+ "|": 49,
+ "^": 50,
+ "!": 51,
+ "~": 52,
+ "&&": 53,
+ "||": 54,
+ "?": 55,
+ ":": 56,
+ "=": 58,
+ "+=": 59,
+ "-=": 60,
+ "*=": 61,
+ "**=": 62,
+ "/=": 63,
+ "%=": 64,
+ "<<=": 65,
+ ">>=": 66,
+ ">>>=": 67,
+ "&=": 68,
+ "|=": 69,
+ "^=": 70,
+ "@": 57,
});
- /*
- As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers
- IdentifierStart ::
- Can contain Unicode 3.0.0 categories:
- Uppercase letter (Lu),
- Lowercase letter (Ll),
- Titlecase letter (Lt),
- Modifier letter (Lm),
- Other letter (Lo), or
- Letter number (Nl).
- IdentifierPart :: =
- Can contain IdentifierStart + Unicode 3.0.0 categories:
- Non-spacing mark (Mn),
- Combining spacing mark (Mc),
- Decimal number (Nd), or
- Connector punctuation (Pc).
-
- Codepoint ranges for ES3 Identifiers are extracted from the Unicode 3.0.0 specification at:
- http://www.unicode.org/Public/3.0-Update/UnicodeData-3.0.0.txt
- */
var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
- /*
- As per ECMAScript Language Specification 5th Edition, Section 7.6: ISyntaxToken Names and Identifiers
- IdentifierStart ::
- Can contain Unicode 6.2 categories:
- Uppercase letter (Lu),
- Lowercase letter (Ll),
- Titlecase letter (Lt),
- Modifier letter (Lm),
- Other letter (Lo), or
- Letter number (Nl).
- IdentifierPart ::
- Can contain IdentifierStart + Unicode 6.2 categories:
- Non-spacing mark (Mn),
- Combining spacing mark (Mc),
- Decimal number (Nd),
- Connector punctuation (Pc),
- , or
- .
-
- Codepoint ranges for ES5 Identifiers are extracted from the Unicode 6.2 specification at:
- http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt
- */
var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
function lookupInUnicodeMap(code, map) {
- // Bail out quickly if it couldn't possibly be in the map.
if (code < map[0]) {
return false;
}
- // Perform binary search in one of the Unicode range maps
var lo = 0;
var hi = map.length;
var mid;
while (lo + 1 < hi) {
mid = lo + (hi - lo) / 2;
- // mid has to be even to catch a range's beginning
mid -= mid % 2;
if (map[mid] <= code && code <= map[mid + 1]) {
return true;
@@ -5774,14 +5130,14 @@ var ts;
}
return false;
}
- /* @internal */ function isUnicodeIdentifierStart(code, languageVersion) {
- return languageVersion >= 1 /* ES5 */ ?
+ function isUnicodeIdentifierStart(code, languageVersion) {
+ return languageVersion >= 1 ?
lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
lookupInUnicodeMap(code, unicodeES3IdentifierStart);
}
ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;
function isUnicodeIdentifierPart(code, languageVersion) {
- return languageVersion >= 1 /* ES5 */ ?
+ return languageVersion >= 1 ?
lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
lookupInUnicodeMap(code, unicodeES3IdentifierPart);
}
@@ -5797,12 +5153,10 @@ var ts;
return tokenStrings[t];
}
ts.tokenToString = tokenToString;
- /* @internal */
function stringToToken(s) {
return textToToken.get(s);
}
ts.stringToToken = stringToToken;
- /* @internal */
function computeLineStarts(text) {
var result = new Array();
var pos = 0;
@@ -5811,17 +5165,16 @@ var ts;
var ch = text.charCodeAt(pos);
pos++;
switch (ch) {
- case 13 /* carriageReturn */:
- if (text.charCodeAt(pos) === 10 /* lineFeed */) {
+ case 13:
+ if (text.charCodeAt(pos) === 10) {
pos++;
}
- // falls through
- case 10 /* lineFeed */:
+ case 10:
result.push(lineStart);
lineStart = pos;
break;
default:
- if (ch > 127 /* maxAsciiCharacter */ && isLineBreak(ch)) {
+ if (ch > 127 && isLineBreak(ch)) {
result.push(lineStart);
lineStart = pos;
}
@@ -5836,7 +5189,6 @@ var ts;
return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character, sourceFile.text);
}
ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter;
- /* @internal */
function computePositionOfLineAndCharacter(lineStarts, line, character, debugText) {
if (line < 0 || line >= lineStarts.length) {
ts.Debug.fail("Bad line number. Line: " + line + ", lineStarts.length: " + lineStarts.length + " , line map is correct? " + (debugText !== undefined ? ts.arraysEqual(lineStarts, computeLineStarts(debugText)) : "unknown"));
@@ -5846,30 +5198,18 @@ var ts;
ts.Debug.assert(res < lineStarts[line + 1]);
}
else if (debugText !== undefined) {
- ts.Debug.assert(res <= debugText.length); // Allow single character overflow for trailing newline
+ ts.Debug.assert(res <= debugText.length);
}
return res;
}
ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter;
- /* @internal */
function getLineStarts(sourceFile) {
return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text));
}
ts.getLineStarts = getLineStarts;
- /* @internal */
- /**
- * We assume the first line starts at position 0 and 'position' is non-negative.
- */
function computeLineAndCharacterOfPosition(lineStarts, position) {
var lineNumber = ts.binarySearch(lineStarts, position, ts.identity, ts.compareValues);
if (lineNumber < 0) {
- // If the actual position was not found,
- // the binary search returns the 2's-complement of the next line start
- // e.g. if the line starts at [5, 10, 23, 80] and the position requested was 20
- // then the search will return -2.
- //
- // We want the index of the previous line start, so we subtract 1.
- // Review 2's-complement if this is confusing.
lineNumber = ~lineNumber - 1;
ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file");
}
@@ -5887,107 +5227,86 @@ var ts;
return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);
}
ts.isWhiteSpaceLike = isWhiteSpaceLike;
- /** Does not include line breaks. For that, see isWhiteSpaceLike. */
function isWhiteSpaceSingleLine(ch) {
- // Note: nextLine is in the Zs space, and should be considered to be a whitespace.
- // It is explicitly not a line-break as it isn't in the exact set specified by EcmaScript.
- return ch === 32 /* space */ ||
- ch === 9 /* tab */ ||
- ch === 11 /* verticalTab */ ||
- ch === 12 /* formFeed */ ||
- ch === 160 /* nonBreakingSpace */ ||
- ch === 133 /* nextLine */ ||
- ch === 5760 /* ogham */ ||
- ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ ||
- ch === 8239 /* narrowNoBreakSpace */ ||
- ch === 8287 /* mathematicalSpace */ ||
- ch === 12288 /* ideographicSpace */ ||
- ch === 65279 /* byteOrderMark */;
+ return ch === 32 ||
+ ch === 9 ||
+ ch === 11 ||
+ ch === 12 ||
+ ch === 160 ||
+ ch === 133 ||
+ ch === 5760 ||
+ ch >= 8192 && ch <= 8203 ||
+ ch === 8239 ||
+ ch === 8287 ||
+ ch === 12288 ||
+ ch === 65279;
}
ts.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine;
function isLineBreak(ch) {
- // ES5 7.3:
- // The ECMAScript line terminator characters are listed in Table 3.
- // Table 3: Line Terminator Characters
- // Code Unit Value Name Formal Name
- // \u000A Line Feed
- // \u000D Carriage Return
- // \u2028 Line separator
- // \u2029 Paragraph separator
- // Only the characters in Table 3 are treated as line terminators. Other new line or line
- // breaking characters are treated as white space but not as line terminators.
- return ch === 10 /* lineFeed */ ||
- ch === 13 /* carriageReturn */ ||
- ch === 8232 /* lineSeparator */ ||
- ch === 8233 /* paragraphSeparator */;
+ return ch === 10 ||
+ ch === 13 ||
+ ch === 8232 ||
+ ch === 8233;
}
ts.isLineBreak = isLineBreak;
function isDigit(ch) {
- return ch >= 48 /* _0 */ && ch <= 57 /* _9 */;
+ return ch >= 48 && ch <= 57;
}
- /* @internal */
function isOctalDigit(ch) {
- return ch >= 48 /* _0 */ && ch <= 55 /* _7 */;
+ return ch >= 48 && ch <= 55;
}
ts.isOctalDigit = isOctalDigit;
function couldStartTrivia(text, pos) {
- // Keep in sync with skipTrivia
var ch = text.charCodeAt(pos);
switch (ch) {
- case 13 /* carriageReturn */:
- case 10 /* lineFeed */:
- case 9 /* tab */:
- case 11 /* verticalTab */:
- case 12 /* formFeed */:
- case 32 /* space */:
- case 47 /* slash */:
- // starts of normal trivia
- case 60 /* lessThan */:
- case 124 /* bar */:
- case 61 /* equals */:
- case 62 /* greaterThan */:
- // Starts of conflict marker trivia
+ case 13:
+ case 10:
+ case 9:
+ case 11:
+ case 12:
+ case 32:
+ case 47:
+ case 60:
+ case 124:
+ case 61:
+ case 62:
return true;
- case 35 /* hash */:
- // Only if its the beginning can we have #! trivia
+ case 35:
return pos === 0;
default:
- return ch > 127 /* maxAsciiCharacter */;
+ return ch > 127;
}
}
ts.couldStartTrivia = couldStartTrivia;
- /* @internal */
function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments) {
if (stopAtComments === void 0) { stopAtComments = false; }
if (ts.positionIsSynthesized(pos)) {
return pos;
}
- // Keep in sync with couldStartTrivia
while (true) {
var ch = text.charCodeAt(pos);
switch (ch) {
- case 13 /* carriageReturn */:
- if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
+ case 13:
+ if (text.charCodeAt(pos + 1) === 10) {
pos++;
}
- // falls through
- case 10 /* lineFeed */:
+ case 10:
pos++;
if (stopAfterLineBreak) {
return pos;
}
continue;
- case 9 /* tab */:
- case 11 /* verticalTab */:
- case 12 /* formFeed */:
- case 32 /* space */:
+ case 9:
+ case 11:
+ case 12:
+ case 32:
pos++;
continue;
- case 47 /* slash */:
+ case 47:
if (stopAtComments) {
break;
}
- if (text.charCodeAt(pos + 1) === 47 /* slash */) {
+ if (text.charCodeAt(pos + 1) === 47) {
pos += 2;
while (pos < text.length) {
if (isLineBreak(text.charCodeAt(pos))) {
@@ -5997,10 +5316,10 @@ var ts;
}
continue;
}
- if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
+ if (text.charCodeAt(pos + 1) === 42) {
pos += 2;
while (pos < text.length) {
- if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {
+ if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) {
pos += 2;
break;
}
@@ -6009,23 +5328,23 @@ var ts;
continue;
}
break;
- case 60 /* lessThan */:
- case 124 /* bar */:
- case 61 /* equals */:
- case 62 /* greaterThan */:
+ case 60:
+ case 124:
+ case 61:
+ case 62:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos);
continue;
}
break;
- case 35 /* hash */:
+ case 35:
if (pos === 0 && isShebangTrivia(text, pos)) {
pos = scanShebangTrivia(text, pos);
continue;
}
break;
default:
- if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpaceLike(ch))) {
+ if (ch > 127 && (isWhiteSpaceLike(ch))) {
pos++;
continue;
}
@@ -6035,12 +5354,9 @@ var ts;
}
}
ts.skipTrivia = skipTrivia;
- // All conflict markers consist of the same character repeated seven times. If it is
- // a <<<<<<< or >>>>>>> marker then it is also followed by a space.
var mergeConflictMarkerLength = "<<<<<<<".length;
function isConflictMarkerTrivia(text, pos) {
ts.Debug.assert(pos >= 0);
- // Conflict markers must be at the start of a line.
if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) {
var ch = text.charCodeAt(pos);
if ((pos + mergeConflictMarkerLength) < text.length) {
@@ -6049,8 +5365,8 @@ var ts;
return false;
}
}
- return ch === 61 /* equals */ ||
- text.charCodeAt(pos + mergeConflictMarkerLength) === 32 /* space */;
+ return ch === 61 ||
+ text.charCodeAt(pos + mergeConflictMarkerLength) === 32;
}
}
return false;
@@ -6061,18 +5377,16 @@ var ts;
}
var ch = text.charCodeAt(pos);
var len = text.length;
- if (ch === 60 /* lessThan */ || ch === 62 /* greaterThan */) {
+ if (ch === 60 || ch === 62) {
while (pos < len && !isLineBreak(text.charCodeAt(pos))) {
pos++;
}
}
else {
- ts.Debug.assert(ch === 124 /* bar */ || ch === 61 /* equals */);
- // Consume everything from the start of a ||||||| or ======= marker to the start
- // of the next ======= or >>>>>>> marker.
+ ts.Debug.assert(ch === 124 || ch === 61);
while (pos < len) {
var currentChar = text.charCodeAt(pos);
- if ((currentChar === 61 /* equals */ || currentChar === 62 /* greaterThan */) && currentChar !== ch && isConflictMarkerTrivia(text, pos)) {
+ if ((currentChar === 61 || currentChar === 62) && currentChar !== ch && isConflictMarkerTrivia(text, pos)) {
break;
}
pos++;
@@ -6082,7 +5396,6 @@ var ts;
}
var shebangTriviaRegex = /^#!.*/;
function isShebangTrivia(text, pos) {
- // Shebangs check must only be done at the start of the file
ts.Debug.assert(pos === 0);
return shebangTriviaRegex.test(text);
}
@@ -6091,26 +5404,6 @@ var ts;
pos = pos + shebang.length;
return pos;
}
- /**
- * Invokes a callback for each comment range following the provided position.
- *
- * Single-line comment ranges include the leading double-slash characters but not the ending
- * line break. Multi-line comment ranges include the leading slash-asterisk and trailing
- * asterisk-slash characters.
- *
- * @param reduce If true, accumulates the result of calling the callback in a fashion similar
- * to reduceLeft. If false, iteration stops when the callback returns a truthy value.
- * @param text The source text to scan.
- * @param pos The position at which to start scanning.
- * @param trailing If false, whitespace is skipped until the first line break and comments
- * between that location and the next token are returned. If true, comments occurring
- * between the given position and the next line break are returned.
- * @param cb The callback to execute as each comment range is encountered.
- * @param state A state value to pass to each iteration of the callback.
- * @param initial An initial value to pass when accumulating results (when "reduce" is true).
- * @returns If "reduce" is true, the accumulated value. If "reduce" is false, the first truthy
- * return value of the callback.
- */
function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
var pendingPos;
var pendingEnd;
@@ -6122,12 +5415,11 @@ var ts;
scan: while (pos >= 0 && pos < text.length) {
var ch = text.charCodeAt(pos);
switch (ch) {
- case 13 /* carriageReturn */:
- if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
+ case 13:
+ if (text.charCodeAt(pos + 1) === 10) {
pos++;
}
- // falls through
- case 10 /* lineFeed */:
+ case 10:
pos++;
if (trailing) {
break scan;
@@ -6137,20 +5429,20 @@ var ts;
pendingHasTrailingNewLine = true;
}
continue;
- case 9 /* tab */:
- case 11 /* verticalTab */:
- case 12 /* formFeed */:
- case 32 /* space */:
+ case 9:
+ case 11:
+ case 12:
+ case 32:
pos++;
continue;
- case 47 /* slash */:
+ case 47:
var nextChar = text.charCodeAt(pos + 1);
var hasTrailingNewLine = false;
- if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) {
- var kind = nextChar === 47 /* slash */ ? 2 /* SingleLineCommentTrivia */ : 3 /* MultiLineCommentTrivia */;
+ if (nextChar === 47 || nextChar === 42) {
+ var kind = nextChar === 47 ? 2 : 3;
var startPos = pos;
pos += 2;
- if (nextChar === 47 /* slash */) {
+ if (nextChar === 47) {
while (pos < text.length) {
if (isLineBreak(text.charCodeAt(pos))) {
hasTrailingNewLine = true;
@@ -6161,7 +5453,7 @@ var ts;
}
else {
while (pos < text.length) {
- if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {
+ if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) {
pos += 2;
break;
}
@@ -6172,7 +5464,6 @@ var ts;
if (hasPendingCommentRange) {
accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);
if (!reduce && accumulator) {
- // If we are not reducing and we have a truthy result, return it.
return accumulator;
}
}
@@ -6186,7 +5477,7 @@ var ts;
}
break scan;
default:
- if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpaceLike(ch))) {
+ if (ch > 127 && (isWhiteSpaceLike(ch))) {
if (hasPendingCommentRange && isLineBreak(ch)) {
pendingHasTrailingNewLine = true;
}
@@ -6202,19 +5493,19 @@ var ts;
return accumulator;
}
function forEachLeadingCommentRange(text, pos, cb, state) {
- return iterateCommentRanges(/*reduce*/ false, text, pos, /*trailing*/ false, cb, state);
+ return iterateCommentRanges(false, text, pos, false, cb, state);
}
ts.forEachLeadingCommentRange = forEachLeadingCommentRange;
function forEachTrailingCommentRange(text, pos, cb, state) {
- return iterateCommentRanges(/*reduce*/ false, text, pos, /*trailing*/ true, cb, state);
+ return iterateCommentRanges(false, text, pos, true, cb, state);
}
ts.forEachTrailingCommentRange = forEachTrailingCommentRange;
function reduceEachLeadingCommentRange(text, pos, cb, state, initial) {
- return iterateCommentRanges(/*reduce*/ true, text, pos, /*trailing*/ false, cb, state, initial);
+ return iterateCommentRanges(true, text, pos, false, cb, state, initial);
}
ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange;
function reduceEachTrailingCommentRange(text, pos, cb, state, initial) {
- return iterateCommentRanges(/*reduce*/ true, text, pos, /*trailing*/ true, cb, state, initial);
+ return iterateCommentRanges(true, text, pos, true, cb, state, initial);
}
ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange;
function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) {
@@ -6225,14 +5516,13 @@ var ts;
return comments;
}
function getLeadingCommentRanges(text, pos) {
- return reduceEachLeadingCommentRange(text, pos, appendCommentRange, /*state*/ undefined, /*initial*/ undefined);
+ return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined);
}
ts.getLeadingCommentRanges = getLeadingCommentRanges;
function getTrailingCommentRanges(text, pos) {
- return reduceEachTrailingCommentRange(text, pos, appendCommentRange, /*state*/ undefined, /*initial*/ undefined);
+ return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined);
}
ts.getTrailingCommentRanges = getTrailingCommentRanges;
- /** Optionally, get the shebang */
function getShebang(text) {
var match = shebangTriviaRegex.exec(text);
if (match) {
@@ -6241,18 +5531,17 @@ var ts;
}
ts.getShebang = getShebang;
function isIdentifierStart(ch, languageVersion) {
- return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ ||
- ch === 36 /* $ */ || ch === 95 /* _ */ ||
- ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
+ return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 ||
+ ch === 36 || ch === 95 ||
+ ch > 127 && isUnicodeIdentifierStart(ch, languageVersion);
}
ts.isIdentifierStart = isIdentifierStart;
function isIdentifierPart(ch, languageVersion) {
- return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ ||
- ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ ||
- ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
+ return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 ||
+ ch >= 48 && ch <= 57 || ch === 36 || ch === 95 ||
+ ch > 127 && isUnicodeIdentifierPart(ch, languageVersion);
}
ts.isIdentifierPart = isIdentifierPart;
- /* @internal */
function isIdentifierText(name, languageVersion) {
if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) {
return false;
@@ -6265,17 +5554,12 @@ var ts;
return true;
}
ts.isIdentifierText = isIdentifierText;
- // Creates a scanner over a (possibly unspecified) range of a piece of text.
function createScanner(languageVersion, skipTrivia, languageVariant, textInitial, onError, start, length) {
- if (languageVariant === void 0) { languageVariant = 0 /* Standard */; }
+ if (languageVariant === void 0) { languageVariant = 0; }
var text = textInitial;
- // Current position (end position of text of current token)
var pos;
- // end of text
var end;
- // Start position of whitespace before current token
var startPos;
- // Start position of text of current token
var tokenPos;
var token;
var tokenValue;
@@ -6288,11 +5572,11 @@ var ts;
getTokenPos: function () { return tokenPos; },
getTokenText: function () { return text.substring(tokenPos, pos); },
getTokenValue: function () { return tokenValue; },
- hasExtendedUnicodeEscape: function () { return (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0; },
- hasPrecedingLineBreak: function () { return (tokenFlags & 1 /* PrecedingLineBreak */) !== 0; },
- isIdentifier: function () { return token === 71 /* Identifier */ || token > 107 /* LastReservedWord */; },
- isReservedWord: function () { return token >= 72 /* FirstReservedWord */ && token <= 107 /* LastReservedWord */; },
- isUnterminated: function () { return (tokenFlags & 4 /* Unterminated */) !== 0; },
+ hasExtendedUnicodeEscape: function () { return (tokenFlags & 8) !== 0; },
+ hasPrecedingLineBreak: function () { return (tokenFlags & 1) !== 0; },
+ isIdentifier: function () { return token === 71 || token > 107; },
+ isReservedWord: function () { return token >= 72 && token <= 107; },
+ isUnterminated: function () { return (tokenFlags & 4) !== 0; },
getTokenFlags: function () { return tokenFlags; },
reScanGreaterToken: reScanGreaterToken,
reScanSlashToken: reScanSlashToken,
@@ -6329,8 +5613,8 @@ var ts;
var result = "";
while (true) {
var ch = text.charCodeAt(pos);
- if (ch === 95 /* _ */) {
- tokenFlags |= 512 /* ContainsSeparator */;
+ if (ch === 95) {
+ tokenFlags |= 512;
if (allowSeparator) {
allowSeparator = false;
isPreviousTokenSeparator = true;
@@ -6354,7 +5638,7 @@ var ts;
}
break;
}
- if (text.charCodeAt(pos - 1) === 95 /* _ */) {
+ if (text.charCodeAt(pos - 1) === 95) {
error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
}
return result + text.substring(start, pos);
@@ -6364,15 +5648,15 @@ var ts;
var mainFragment = scanNumberFragment();
var decimalFragment;
var scientificFragment;
- if (text.charCodeAt(pos) === 46 /* dot */) {
+ if (text.charCodeAt(pos) === 46) {
pos++;
decimalFragment = scanNumberFragment();
}
var end = pos;
- if (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */) {
+ if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) {
pos++;
- tokenFlags |= 16 /* Scientific */;
- if (text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */)
+ tokenFlags |= 16;
+ if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45)
pos++;
var preNumericPart = pos;
var finalFragment = scanNumberFragment();
@@ -6384,7 +5668,7 @@ var ts;
end = pos;
}
}
- if (tokenFlags & 512 /* ContainsSeparator */) {
+ if (tokenFlags & 512) {
var result = mainFragment;
if (decimalFragment) {
result += "." + decimalFragment;
@@ -6395,7 +5679,7 @@ var ts;
return "" + +result;
}
else {
- return "" + +(text.substring(start, end)); // No need to use all the fragments; no _ removal needed
+ return "" + +(text.substring(start, end));
}
}
function scanOctalDigits() {
@@ -6405,19 +5689,11 @@ var ts;
}
return +(text.substring(start, pos));
}
- /**
- * Scans the given number of hexadecimal digits in the text,
- * returning -1 if the given number is unavailable.
- */
function scanExactNumberOfHexDigits(count, canHaveSeparators) {
- return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ false, canHaveSeparators);
+ return scanHexDigits(count, false, canHaveSeparators);
}
- /**
- * Scans as many hexadecimal digits as are available in the text,
- * returning -1 if the given number of digits was unavailable.
- */
function scanMinimumNumberOfHexDigits(count, canHaveSeparators) {
- return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ true, canHaveSeparators);
+ return scanHexDigits(count, true, canHaveSeparators);
}
function scanHexDigits(minCount, scanAsManyAsPossible, canHaveSeparators) {
var digits = 0;
@@ -6426,8 +5702,8 @@ var ts;
var isPreviousTokenSeparator = false;
while (digits < minCount || scanAsManyAsPossible) {
var ch = text.charCodeAt(pos);
- if (canHaveSeparators && ch === 95 /* _ */) {
- tokenFlags |= 512 /* ContainsSeparator */;
+ if (canHaveSeparators && ch === 95) {
+ tokenFlags |= 512;
if (allowSeparator) {
allowSeparator = false;
isPreviousTokenSeparator = true;
@@ -6442,14 +5718,14 @@ var ts;
continue;
}
allowSeparator = canHaveSeparators;
- if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) {
- value = value * 16 + ch - 48 /* _0 */;
+ if (ch >= 48 && ch <= 57) {
+ value = value * 16 + ch - 48;
}
- else if (ch >= 65 /* A */ && ch <= 70 /* F */) {
- value = value * 16 + ch - 65 /* A */ + 10;
+ else if (ch >= 65 && ch <= 70) {
+ value = value * 16 + ch - 65 + 10;
}
- else if (ch >= 97 /* a */ && ch <= 102 /* f */) {
- value = value * 16 + ch - 97 /* a */ + 10;
+ else if (ch >= 97 && ch <= 102) {
+ value = value * 16 + ch - 97 + 10;
}
else {
break;
@@ -6461,7 +5737,7 @@ var ts;
if (digits < minCount) {
value = -1;
}
- if (text.charCodeAt(pos - 1) === 95 /* _ */) {
+ if (text.charCodeAt(pos - 1) === 95) {
error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
}
return value;
@@ -6475,7 +5751,7 @@ var ts;
while (true) {
if (pos >= end) {
result += text.substring(start, pos);
- tokenFlags |= 4 /* Unterminated */;
+ tokenFlags |= 4;
error(ts.Diagnostics.Unterminated_string_literal);
break;
}
@@ -6485,7 +5761,7 @@ var ts;
pos++;
break;
}
- if (ch === 92 /* backslash */ && !jsxAttributeString) {
+ if (ch === 92 && !jsxAttributeString) {
result += text.substring(start, pos);
result += scanEscapeSequence();
start = pos;
@@ -6493,7 +5769,7 @@ var ts;
}
if (isLineBreak(ch) && !jsxAttributeString) {
result += text.substring(start, pos);
- tokenFlags |= 4 /* Unterminated */;
+ tokenFlags |= 4;
error(ts.Diagnostics.Unterminated_string_literal);
break;
}
@@ -6501,12 +5777,8 @@ var ts;
}
return result;
}
- /**
- * Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or
- * a literal component of a TemplateExpression.
- */
function scanTemplateAndSetTokenValue() {
- var startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */;
+ var startedWithBacktick = text.charCodeAt(pos) === 96;
pos++;
var start = pos;
var contents = "";
@@ -6514,39 +5786,34 @@ var ts;
while (true) {
if (pos >= end) {
contents += text.substring(start, pos);
- tokenFlags |= 4 /* Unterminated */;
+ tokenFlags |= 4;
error(ts.Diagnostics.Unterminated_template_literal);
- resultingToken = startedWithBacktick ? 13 /* NoSubstitutionTemplateLiteral */ : 16 /* TemplateTail */;
+ resultingToken = startedWithBacktick ? 13 : 16;
break;
}
var currChar = text.charCodeAt(pos);
- // '`'
- if (currChar === 96 /* backtick */) {
+ if (currChar === 96) {
contents += text.substring(start, pos);
pos++;
- resultingToken = startedWithBacktick ? 13 /* NoSubstitutionTemplateLiteral */ : 16 /* TemplateTail */;
+ resultingToken = startedWithBacktick ? 13 : 16;
break;
}
- // '${'
- if (currChar === 36 /* $ */ && pos + 1 < end && text.charCodeAt(pos + 1) === 123 /* openBrace */) {
+ if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) {
contents += text.substring(start, pos);
pos += 2;
- resultingToken = startedWithBacktick ? 14 /* TemplateHead */ : 15 /* TemplateMiddle */;
+ resultingToken = startedWithBacktick ? 14 : 15;
break;
}
- // Escape character
- if (currChar === 92 /* backslash */) {
+ if (currChar === 92) {
contents += text.substring(start, pos);
contents += scanEscapeSequence();
start = pos;
continue;
}
- // Speculated ECMAScript 6 Spec 11.8.6.1:
- // and LineTerminatorSequences are normalized to for Template Values
- if (currChar === 13 /* carriageReturn */) {
+ if (currChar === 13) {
contents += text.substring(start, pos);
pos++;
- if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) {
+ if (pos < end && text.charCodeAt(pos) === 10) {
pos++;
}
contents += "\n";
@@ -6568,53 +5835,47 @@ var ts;
var ch = text.charCodeAt(pos);
pos++;
switch (ch) {
- case 48 /* _0 */:
+ case 48:
return "\0";
- case 98 /* b */:
+ case 98:
return "\b";
- case 116 /* t */:
+ case 116:
return "\t";
- case 110 /* n */:
+ case 110:
return "\n";
- case 118 /* v */:
+ case 118:
return "\v";
- case 102 /* f */:
+ case 102:
return "\f";
- case 114 /* r */:
+ case 114:
return "\r";
- case 39 /* singleQuote */:
+ case 39:
return "\'";
- case 34 /* doubleQuote */:
+ case 34:
return "\"";
- case 117 /* u */:
- // '\u{DDDDDDDD}'
- if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
+ case 117:
+ if (pos < end && text.charCodeAt(pos) === 123) {
+ tokenFlags |= 8;
pos++;
return scanExtendedUnicodeEscape();
}
- // '\uDDDD'
- return scanHexadecimalEscape(/*numDigits*/ 4);
- case 120 /* x */:
- // '\xDD'
- return scanHexadecimalEscape(/*numDigits*/ 2);
- // when encountering a LineContinuation (i.e. a backslash and a line terminator sequence),
- // the line terminator is interpreted to be "the empty code unit sequence".
- case 13 /* carriageReturn */:
- if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) {
+ return scanHexadecimalEscape(4);
+ case 120:
+ return scanHexadecimalEscape(2);
+ case 13:
+ if (pos < end && text.charCodeAt(pos) === 10) {
pos++;
}
- // falls through
- case 10 /* lineFeed */:
- case 8232 /* lineSeparator */:
- case 8233 /* paragraphSeparator */:
+ case 10:
+ case 8232:
+ case 8233:
return "";
default:
return String.fromCharCode(ch);
}
}
function scanHexadecimalEscape(numDigits) {
- var escapedValue = scanExactNumberOfHexDigits(numDigits, /*canHaveSeparators*/ false);
+ var escapedValue = scanExactNumberOfHexDigits(numDigits, false);
if (escapedValue >= 0) {
return String.fromCharCode(escapedValue);
}
@@ -6624,9 +5885,8 @@ var ts;
}
}
function scanExtendedUnicodeEscape() {
- var escapedValue = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false);
+ var escapedValue = scanMinimumNumberOfHexDigits(1, false);
var isInvalidExtendedEscape = false;
- // Validate the value of the digit
if (escapedValue < 0) {
error(ts.Diagnostics.Hexadecimal_digit_expected);
isInvalidExtendedEscape = true;
@@ -6639,8 +5899,7 @@ var ts;
error(ts.Diagnostics.Unexpected_end_of_text);
isInvalidExtendedEscape = true;
}
- else if (text.charCodeAt(pos) === 125 /* closeBrace */) {
- // Only swallow the following character up if it's a '}'.
+ else if (text.charCodeAt(pos) === 125) {
pos++;
}
else {
@@ -6652,7 +5911,6 @@ var ts;
}
return utf16EncodeAsString(escapedValue);
}
- // Derived from the 10.1.1 UTF16Encoding of the ES6 Spec.
function utf16EncodeAsString(codePoint) {
ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF);
if (codePoint <= 65535) {
@@ -6662,13 +5920,11 @@ var ts;
var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00;
return String.fromCharCode(codeUnit1, codeUnit2);
}
- // Current character is known to be a backslash. Check for Unicode escape of the form '\uXXXX'
- // and return code point value if valid Unicode escape is found. Otherwise return -1.
function peekUnicodeEscape() {
- if (pos + 5 < end && text.charCodeAt(pos + 1) === 117 /* u */) {
+ if (pos + 5 < end && text.charCodeAt(pos + 1) === 117) {
var start_1 = pos;
pos += 2;
- var value = scanExactNumberOfHexDigits(4, /*canHaveSeparators*/ false);
+ var value = scanExactNumberOfHexDigits(4, false);
pos = start_1;
return value;
}
@@ -6682,14 +5938,13 @@ var ts;
if (isIdentifierPart(ch, languageVersion)) {
pos++;
}
- else if (ch === 92 /* backslash */) {
+ else if (ch === 92) {
ch = peekUnicodeEscape();
if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {
break;
}
result += text.substring(start, pos);
result += String.fromCharCode(ch);
- // Valid Unicode escape is always six characters
pos += 6;
start = pos;
}
@@ -6701,32 +5956,28 @@ var ts;
return result;
}
function getIdentifierToken() {
- // Reserved words are between 2 and 11 characters long and start with a lowercase letter
var len = tokenValue.length;
if (len >= 2 && len <= 11) {
var ch = tokenValue.charCodeAt(0);
- if (ch >= 97 /* a */ && ch <= 122 /* z */) {
+ if (ch >= 97 && ch <= 122) {
token = textToToken.get(tokenValue);
if (token !== undefined) {
return token;
}
}
}
- return token = 71 /* Identifier */;
+ return token = 71;
}
function scanBinaryOrOctalDigits(base) {
ts.Debug.assert(base === 2 || base === 8, "Expected either base 2 or base 8");
var value = 0;
- // For counting number of digits; Valid binaryIntegerLiteral must have at least one binary digit following B or b.
- // Similarly valid octalIntegerLiteral must have at least one octal digit following o or O.
var numberOfDigits = 0;
var separatorAllowed = false;
var isPreviousTokenSeparator = false;
while (true) {
var ch = text.charCodeAt(pos);
- // Numeric separators are allowed anywhere within a numeric literal, except not at the beginning, or following another separator
- if (ch === 95 /* _ */) {
- tokenFlags |= 512 /* ContainsSeparator */;
+ if (ch === 95) {
+ tokenFlags |= 512;
if (separatorAllowed) {
separatorAllowed = false;
isPreviousTokenSeparator = true;
@@ -6741,7 +5992,7 @@ var ts;
continue;
}
separatorAllowed = true;
- var valueOfCh = ch - 48 /* _0 */;
+ var valueOfCh = ch - 48;
if (!isDigit(ch) || valueOfCh >= base) {
break;
}
@@ -6750,12 +6001,10 @@ var ts;
numberOfDigits++;
isPreviousTokenSeparator = false;
}
- // Invalid binaryIntegerLiteral or octalIntegerLiteral
if (numberOfDigits === 0) {
return -1;
}
- if (text.charCodeAt(pos - 1) === 95 /* _ */) {
- // Literal ends with underscore - not allowed
+ if (text.charCodeAt(pos - 1) === 95) {
error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
return value;
}
@@ -6767,41 +6016,39 @@ var ts;
while (true) {
tokenPos = pos;
if (pos >= end) {
- return token = 1 /* EndOfFileToken */;
+ return token = 1;
}
var ch = text.charCodeAt(pos);
- // Special handling for shebang
- if (ch === 35 /* hash */ && pos === 0 && isShebangTrivia(text, pos)) {
+ if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) {
pos = scanShebangTrivia(text, pos);
if (skipTrivia) {
continue;
}
else {
- return token = 6 /* ShebangTrivia */;
+ return token = 6;
}
}
switch (ch) {
- case 10 /* lineFeed */:
- case 13 /* carriageReturn */:
- tokenFlags |= 1 /* PrecedingLineBreak */;
+ case 10:
+ case 13:
+ tokenFlags |= 1;
if (skipTrivia) {
pos++;
continue;
}
else {
- if (ch === 13 /* carriageReturn */ && pos + 1 < end && text.charCodeAt(pos + 1) === 10 /* lineFeed */) {
- // consume both CR and LF
+ if (ch === 13 && pos + 1 < end && text.charCodeAt(pos + 1) === 10) {
pos += 2;
}
else {
pos++;
}
- return token = 4 /* NewLineTrivia */;
+ return token = 4;
}
- case 9 /* tab */:
- case 11 /* verticalTab */:
- case 12 /* formFeed */:
- case 32 /* space */:
+ case 9:
+ case 11:
+ case 12:
+ case 32:
if (skipTrivia) {
pos++;
continue;
@@ -6810,90 +6057,89 @@ var ts;
while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {
pos++;
}
- return token = 5 /* WhitespaceTrivia */;
+ return token = 5;
}
- case 33 /* exclamation */:
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 35 /* ExclamationEqualsEqualsToken */;
+ case 33:
+ if (text.charCodeAt(pos + 1) === 61) {
+ if (text.charCodeAt(pos + 2) === 61) {
+ return pos += 3, token = 35;
}
- return pos += 2, token = 33 /* ExclamationEqualsToken */;
+ return pos += 2, token = 33;
}
pos++;
- return token = 51 /* ExclamationToken */;
- case 34 /* doubleQuote */:
- case 39 /* singleQuote */:
+ return token = 51;
+ case 34:
+ case 39:
tokenValue = scanString();
- return token = 9 /* StringLiteral */;
- case 96 /* backtick */:
+ return token = 9;
+ case 96:
return token = scanTemplateAndSetTokenValue();
- case 37 /* percent */:
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 64 /* PercentEqualsToken */;
+ case 37:
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 64;
}
pos++;
- return token = 42 /* PercentToken */;
- case 38 /* ampersand */:
- if (text.charCodeAt(pos + 1) === 38 /* ampersand */) {
- return pos += 2, token = 53 /* AmpersandAmpersandToken */;
+ return token = 42;
+ case 38:
+ if (text.charCodeAt(pos + 1) === 38) {
+ return pos += 2, token = 53;
}
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 68 /* AmpersandEqualsToken */;
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 68;
}
pos++;
- return token = 48 /* AmpersandToken */;
- case 40 /* openParen */:
+ return token = 48;
+ case 40:
pos++;
- return token = 19 /* OpenParenToken */;
- case 41 /* closeParen */:
+ return token = 19;
+ case 41:
pos++;
- return token = 20 /* CloseParenToken */;
- case 42 /* asterisk */:
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 61 /* AsteriskEqualsToken */;
+ return token = 20;
+ case 42:
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 61;
}
- if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 62 /* AsteriskAsteriskEqualsToken */;
+ if (text.charCodeAt(pos + 1) === 42) {
+ if (text.charCodeAt(pos + 2) === 61) {
+ return pos += 3, token = 62;
}
- return pos += 2, token = 40 /* AsteriskAsteriskToken */;
+ return pos += 2, token = 40;
}
pos++;
- return token = 39 /* AsteriskToken */;
- case 43 /* plus */:
- if (text.charCodeAt(pos + 1) === 43 /* plus */) {
- return pos += 2, token = 43 /* PlusPlusToken */;
+ return token = 39;
+ case 43:
+ if (text.charCodeAt(pos + 1) === 43) {
+ return pos += 2, token = 43;
}
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 59 /* PlusEqualsToken */;
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 59;
}
pos++;
- return token = 37 /* PlusToken */;
- case 44 /* comma */:
+ return token = 37;
+ case 44:
pos++;
- return token = 26 /* CommaToken */;
- case 45 /* minus */:
- if (text.charCodeAt(pos + 1) === 45 /* minus */) {
- return pos += 2, token = 44 /* MinusMinusToken */;
+ return token = 26;
+ case 45:
+ if (text.charCodeAt(pos + 1) === 45) {
+ return pos += 2, token = 44;
}
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 60 /* MinusEqualsToken */;
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 60;
}
pos++;
- return token = 38 /* MinusToken */;
- case 46 /* dot */:
+ return token = 38;
+ case 46:
if (isDigit(text.charCodeAt(pos + 1))) {
tokenValue = scanNumber();
- return token = 8 /* NumericLiteral */;
+ return token = 8;
}
- if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) {
- return pos += 3, token = 24 /* DotDotDotToken */;
+ if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) {
+ return pos += 3, token = 24;
}
pos++;
- return token = 23 /* DotToken */;
- case 47 /* slash */:
- // Single-line comment
- if (text.charCodeAt(pos + 1) === 47 /* slash */) {
+ return token = 23;
+ case 47:
+ if (text.charCodeAt(pos + 1) === 47) {
pos += 2;
while (pos < end) {
if (isLineBreak(text.charCodeAt(pos))) {
@@ -6905,25 +6151,24 @@ var ts;
continue;
}
else {
- return token = 2 /* SingleLineCommentTrivia */;
+ return token = 2;
}
}
- // Multi-line comment
- if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
+ if (text.charCodeAt(pos + 1) === 42) {
pos += 2;
- if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) !== 47 /* slash */) {
- tokenFlags |= 2 /* PrecedingJSDocComment */;
+ if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) !== 47) {
+ tokenFlags |= 2;
}
var commentClosed = false;
while (pos < end) {
var ch_1 = text.charCodeAt(pos);
- if (ch_1 === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {
+ if (ch_1 === 42 && text.charCodeAt(pos + 1) === 47) {
pos += 2;
commentClosed = true;
break;
}
if (isLineBreak(ch_1)) {
- tokenFlags |= 1 /* PrecedingLineBreak */;
+ tokenFlags |= 1;
}
pos++;
}
@@ -6935,182 +6180,177 @@ var ts;
}
else {
if (!commentClosed) {
- tokenFlags |= 4 /* Unterminated */;
+ tokenFlags |= 4;
}
- return token = 3 /* MultiLineCommentTrivia */;
+ return token = 3;
}
}
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 63 /* SlashEqualsToken */;
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 63;
}
pos++;
- return token = 41 /* SlashToken */;
- case 48 /* _0 */:
- if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) {
+ return token = 41;
+ case 48:
+ if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) {
pos += 2;
- var value = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ true);
+ var value = scanMinimumNumberOfHexDigits(1, true);
if (value < 0) {
error(ts.Diagnostics.Hexadecimal_digit_expected);
value = 0;
}
tokenValue = "" + value;
- tokenFlags |= 64 /* HexSpecifier */;
- return token = 8 /* NumericLiteral */;
+ tokenFlags |= 64;
+ return token = 8;
}
- else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 /* B */ || text.charCodeAt(pos + 1) === 98 /* b */)) {
+ else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) {
pos += 2;
- var value = scanBinaryOrOctalDigits(/* base */ 2);
+ var value = scanBinaryOrOctalDigits(2);
if (value < 0) {
error(ts.Diagnostics.Binary_digit_expected);
value = 0;
}
tokenValue = "" + value;
- tokenFlags |= 128 /* BinarySpecifier */;
- return token = 8 /* NumericLiteral */;
+ tokenFlags |= 128;
+ return token = 8;
}
- else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) {
+ else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) {
pos += 2;
- var value = scanBinaryOrOctalDigits(/* base */ 8);
+ var value = scanBinaryOrOctalDigits(8);
if (value < 0) {
error(ts.Diagnostics.Octal_digit_expected);
value = 0;
}
tokenValue = "" + value;
- tokenFlags |= 256 /* OctalSpecifier */;
- return token = 8 /* NumericLiteral */;
+ tokenFlags |= 256;
+ return token = 8;
}
- // Try to parse as an octal
if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) {
tokenValue = "" + scanOctalDigits();
- tokenFlags |= 32 /* Octal */;
- return token = 8 /* NumericLiteral */;
+ tokenFlags |= 32;
+ return token = 8;
}
- // This fall-through is a deviation from the EcmaScript grammar. The grammar says that a leading zero
- // can only be followed by an octal digit, a dot, or the end of the number literal. However, we are being
- // permissive and allowing decimal digits of the form 08* and 09* (which many browsers also do).
- // falls through
- case 49 /* _1 */:
- case 50 /* _2 */:
- case 51 /* _3 */:
- case 52 /* _4 */:
- case 53 /* _5 */:
- case 54 /* _6 */:
- case 55 /* _7 */:
- case 56 /* _8 */:
- case 57 /* _9 */:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
tokenValue = scanNumber();
- return token = 8 /* NumericLiteral */;
- case 58 /* colon */:
+ return token = 8;
+ case 58:
pos++;
- return token = 56 /* ColonToken */;
- case 59 /* semicolon */:
+ return token = 56;
+ case 59:
pos++;
- return token = 25 /* SemicolonToken */;
- case 60 /* lessThan */:
+ return token = 25;
+ case 60:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
if (skipTrivia) {
continue;
}
else {
- return token = 7 /* ConflictMarkerTrivia */;
+ return token = 7;
}
}
- if (text.charCodeAt(pos + 1) === 60 /* lessThan */) {
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 65 /* LessThanLessThanEqualsToken */;
+ if (text.charCodeAt(pos + 1) === 60) {
+ if (text.charCodeAt(pos + 2) === 61) {
+ return pos += 3, token = 65;
}
- return pos += 2, token = 45 /* LessThanLessThanToken */;
+ return pos += 2, token = 45;
}
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 30 /* LessThanEqualsToken */;
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 30;
}
- if (languageVariant === 1 /* JSX */ &&
- text.charCodeAt(pos + 1) === 47 /* slash */ &&
- text.charCodeAt(pos + 2) !== 42 /* asterisk */) {
- return pos += 2, token = 28 /* LessThanSlashToken */;
+ if (languageVariant === 1 &&
+ text.charCodeAt(pos + 1) === 47 &&
+ text.charCodeAt(pos + 2) !== 42) {
+ return pos += 2, token = 28;
}
pos++;
- return token = 27 /* LessThanToken */;
- case 61 /* equals */:
+ return token = 27;
+ case 61:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
if (skipTrivia) {
continue;
}
else {
- return token = 7 /* ConflictMarkerTrivia */;
+ return token = 7;
}
}
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 34 /* EqualsEqualsEqualsToken */;
+ if (text.charCodeAt(pos + 1) === 61) {
+ if (text.charCodeAt(pos + 2) === 61) {
+ return pos += 3, token = 34;
}
- return pos += 2, token = 32 /* EqualsEqualsToken */;
+ return pos += 2, token = 32;
}
- if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) {
- return pos += 2, token = 36 /* EqualsGreaterThanToken */;
+ if (text.charCodeAt(pos + 1) === 62) {
+ return pos += 2, token = 36;
}
pos++;
- return token = 58 /* EqualsToken */;
- case 62 /* greaterThan */:
+ return token = 58;
+ case 62:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
if (skipTrivia) {
continue;
}
else {
- return token = 7 /* ConflictMarkerTrivia */;
+ return token = 7;
}
}
pos++;
- return token = 29 /* GreaterThanToken */;
- case 63 /* question */:
+ return token = 29;
+ case 63:
pos++;
- return token = 55 /* QuestionToken */;
- case 91 /* openBracket */:
+ return token = 55;
+ case 91:
pos++;
- return token = 21 /* OpenBracketToken */;
- case 93 /* closeBracket */:
+ return token = 21;
+ case 93:
pos++;
- return token = 22 /* CloseBracketToken */;
- case 94 /* caret */:
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 70 /* CaretEqualsToken */;
+ return token = 22;
+ case 94:
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 70;
}
pos++;
- return token = 50 /* CaretToken */;
- case 123 /* openBrace */:
+ return token = 50;
+ case 123:
pos++;
- return token = 17 /* OpenBraceToken */;
- case 124 /* bar */:
+ return token = 17;
+ case 124:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
if (skipTrivia) {
continue;
}
else {
- return token = 7 /* ConflictMarkerTrivia */;
+ return token = 7;
}
}
- if (text.charCodeAt(pos + 1) === 124 /* bar */) {
- return pos += 2, token = 54 /* BarBarToken */;
+ if (text.charCodeAt(pos + 1) === 124) {
+ return pos += 2, token = 54;
}
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 69 /* BarEqualsToken */;
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 69;
}
pos++;
- return token = 49 /* BarToken */;
- case 125 /* closeBrace */:
+ return token = 49;
+ case 125:
pos++;
- return token = 18 /* CloseBraceToken */;
- case 126 /* tilde */:
+ return token = 18;
+ case 126:
pos++;
- return token = 52 /* TildeToken */;
- case 64 /* at */:
+ return token = 52;
+ case 64:
pos++;
- return token = 57 /* AtToken */;
- case 92 /* backslash */:
+ return token = 57;
+ case 92:
var cookedChar = peekUnicodeEscape();
if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
pos += 6;
@@ -7119,14 +6359,14 @@ var ts;
}
error(ts.Diagnostics.Invalid_character);
pos++;
- return token = 0 /* Unknown */;
+ return token = 0;
default:
if (isIdentifierStart(ch, languageVersion)) {
pos++;
while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion))
pos++;
tokenValue = text.substring(tokenPos, pos);
- if (ch === 92 /* backslash */) {
+ if (ch === 92) {
tokenValue += scanIdentifierParts();
}
return token = getIdentifierToken();
@@ -7136,75 +6376,69 @@ var ts;
continue;
}
else if (isLineBreak(ch)) {
- tokenFlags |= 1 /* PrecedingLineBreak */;
+ tokenFlags |= 1;
pos++;
continue;
}
error(ts.Diagnostics.Invalid_character);
pos++;
- return token = 0 /* Unknown */;
+ return token = 0;
}
}
}
function reScanGreaterToken() {
- if (token === 29 /* GreaterThanToken */) {
- if (text.charCodeAt(pos) === 62 /* greaterThan */) {
- if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) {
- if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 67 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
+ if (token === 29) {
+ if (text.charCodeAt(pos) === 62) {
+ if (text.charCodeAt(pos + 1) === 62) {
+ if (text.charCodeAt(pos + 2) === 61) {
+ return pos += 3, token = 67;
}
- return pos += 2, token = 47 /* GreaterThanGreaterThanGreaterThanToken */;
+ return pos += 2, token = 47;
}
- if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 66 /* GreaterThanGreaterThanEqualsToken */;
+ if (text.charCodeAt(pos + 1) === 61) {
+ return pos += 2, token = 66;
}
pos++;
- return token = 46 /* GreaterThanGreaterThanToken */;
+ return token = 46;
}
- if (text.charCodeAt(pos) === 61 /* equals */) {
+ if (text.charCodeAt(pos) === 61) {
pos++;
- return token = 31 /* GreaterThanEqualsToken */;
+ return token = 31;
}
}
return token;
}
function reScanSlashToken() {
- if (token === 41 /* SlashToken */ || token === 63 /* SlashEqualsToken */) {
+ if (token === 41 || token === 63) {
var p = tokenPos + 1;
var inEscape = false;
var inCharacterClass = false;
while (true) {
- // If we reach the end of a file, or hit a newline, then this is an unterminated
- // regex. Report error and return what we have so far.
if (p >= end) {
- tokenFlags |= 4 /* Unterminated */;
+ tokenFlags |= 4;
error(ts.Diagnostics.Unterminated_regular_expression_literal);
break;
}
var ch = text.charCodeAt(p);
if (isLineBreak(ch)) {
- tokenFlags |= 4 /* Unterminated */;
+ tokenFlags |= 4;
error(ts.Diagnostics.Unterminated_regular_expression_literal);
break;
}
if (inEscape) {
- // Parsing an escape character;
- // reset the flag and just advance to the next char.
inEscape = false;
}
- else if (ch === 47 /* slash */ && !inCharacterClass) {
- // A slash within a character class is permissible,
- // but in general it signals the end of the regexp literal.
+ else if (ch === 47 && !inCharacterClass) {
p++;
break;
}
- else if (ch === 91 /* openBracket */) {
+ else if (ch === 91) {
inCharacterClass = true;
}
- else if (ch === 92 /* backslash */) {
+ else if (ch === 92) {
inEscape = true;
}
- else if (ch === 93 /* closeBracket */) {
+ else if (ch === 93) {
inCharacterClass = false;
}
p++;
@@ -7214,15 +6448,12 @@ var ts;
}
pos = p;
tokenValue = text.substring(tokenPos, pos);
- token = 12 /* RegularExpressionLiteral */;
+ token = 12;
}
return token;
}
- /**
- * Unconditionally back up and scan a template expression portion.
- */
function reScanTemplateToken() {
- ts.Debug.assert(token === 18 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'");
+ ts.Debug.assert(token === 18, "'reScanTemplateToken' should only be called on a '}'");
pos = tokenPos;
return token = scanTemplateAndSetTokenValue();
}
@@ -7233,43 +6464,34 @@ var ts;
function scanJsxToken() {
startPos = tokenPos = pos;
if (pos >= end) {
- return token = 1 /* EndOfFileToken */;
+ return token = 1;
}
var char = text.charCodeAt(pos);
- if (char === 60 /* lessThan */) {
- if (text.charCodeAt(pos + 1) === 47 /* slash */) {
+ if (char === 60) {
+ if (text.charCodeAt(pos + 1) === 47) {
pos += 2;
- return token = 28 /* LessThanSlashToken */;
+ return token = 28;
}
pos++;
- return token = 27 /* LessThanToken */;
+ return token = 27;
}
- if (char === 123 /* openBrace */) {
+ if (char === 123) {
pos++;
- return token = 17 /* OpenBraceToken */;
+ return token = 17;
}
- // First non-whitespace character on this line.
var firstNonWhitespace = 0;
- // These initial values are special because the first line is:
- // firstNonWhitespace = 0 to indicate that we want leading whitspace,
while (pos < end) {
char = text.charCodeAt(pos);
- if (char === 123 /* openBrace */) {
+ if (char === 123) {
break;
}
- if (char === 60 /* lessThan */) {
+ if (char === 60) {
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
- return token = 7 /* ConflictMarkerTrivia */;
+ return token = 7;
}
break;
}
- // FirstNonWhitespace is 0, then we only see whitespaces so far. If we see a linebreak, we want to ignore that whitespaces.
- // i.e (- : whitespace)
- //
----
- //
becomes
- //
- // ----
becomes ----
if (isLineBreak(char) && firstNonWhitespace === 0) {
firstNonWhitespace = -1;
}
@@ -7278,16 +6500,14 @@ var ts;
}
pos++;
}
- return firstNonWhitespace === -1 ? 11 /* JsxTextAllWhiteSpaces */ : 10 /* JsxText */;
+ return firstNonWhitespace === -1 ? 11 : 10;
}
- // Scans a JSX identifier; these differ from normal identifiers in that
- // they allow dashes
function scanJsxIdentifier() {
if (tokenIsIdentifierOrKeyword(token)) {
var firstCharPosition = pos;
while (pos < end) {
var ch = text.charCodeAt(pos);
- if (ch === 45 /* minus */ || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
+ if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
pos++;
}
else {
@@ -7301,71 +6521,70 @@ var ts;
function scanJsxAttributeValue() {
startPos = pos;
switch (text.charCodeAt(pos)) {
- case 34 /* doubleQuote */:
- case 39 /* singleQuote */:
- tokenValue = scanString(/*jsxAttributeString*/ true);
- return token = 9 /* StringLiteral */;
+ case 34:
+ case 39:
+ tokenValue = scanString(true);
+ return token = 9;
default:
- // If this scans anything other than `{`, it's a parse error.
return scan();
}
}
function scanJSDocToken() {
startPos = tokenPos = pos;
if (pos >= end) {
- return token = 1 /* EndOfFileToken */;
+ return token = 1;
}
var ch = text.charCodeAt(pos);
pos++;
switch (ch) {
- case 9 /* tab */:
- case 11 /* verticalTab */:
- case 12 /* formFeed */:
- case 32 /* space */:
+ case 9:
+ case 11:
+ case 12:
+ case 32:
while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {
pos++;
}
- return token = 5 /* WhitespaceTrivia */;
- case 64 /* at */:
- return token = 57 /* AtToken */;
- case 10 /* lineFeed */:
- case 13 /* carriageReturn */:
- return token = 4 /* NewLineTrivia */;
- case 42 /* asterisk */:
- return token = 39 /* AsteriskToken */;
- case 123 /* openBrace */:
- return token = 17 /* OpenBraceToken */;
- case 125 /* closeBrace */:
- return token = 18 /* CloseBraceToken */;
- case 91 /* openBracket */:
- return token = 21 /* OpenBracketToken */;
- case 93 /* closeBracket */:
- return token = 22 /* CloseBracketToken */;
- case 60 /* lessThan */:
- return token = 27 /* LessThanToken */;
- case 61 /* equals */:
- return token = 58 /* EqualsToken */;
- case 44 /* comma */:
- return token = 26 /* CommaToken */;
- case 46 /* dot */:
- return token = 23 /* DotToken */;
- case 96 /* backtick */:
- while (pos < end && text.charCodeAt(pos) !== 96 /* backtick */) {
+ return token = 5;
+ case 64:
+ return token = 57;
+ case 10:
+ case 13:
+ return token = 4;
+ case 42:
+ return token = 39;
+ case 123:
+ return token = 17;
+ case 125:
+ return token = 18;
+ case 91:
+ return token = 21;
+ case 93:
+ return token = 22;
+ case 60:
+ return token = 27;
+ case 61:
+ return token = 58;
+ case 44:
+ return token = 26;
+ case 46:
+ return token = 23;
+ case 96:
+ while (pos < end && text.charCodeAt(pos) !== 96) {
pos++;
}
tokenValue = text.substring(tokenPos + 1, pos);
pos++;
- return token = 13 /* NoSubstitutionTemplateLiteral */;
+ return token = 13;
}
- if (isIdentifierStart(ch, 6 /* Latest */)) {
- while (isIdentifierPart(text.charCodeAt(pos), 6 /* Latest */) && pos < end) {
+ if (isIdentifierStart(ch, 6)) {
+ while (isIdentifierPart(text.charCodeAt(pos), 6) && pos < end) {
pos++;
}
tokenValue = text.substring(tokenPos, pos);
- return token = 71 /* Identifier */;
+ return token = 71;
}
else {
- return token = 0 /* Unknown */;
+ return token = 0;
}
}
function speculationHelper(callback, isLookahead) {
@@ -7376,8 +6595,6 @@ var ts;
var saveTokenValue = tokenValue;
var saveTokenFlags = tokenFlags;
var result = callback();
- // If our callback returned something 'falsy' or we're just looking ahead,
- // then unconditionally restore us to where we were.
if (!result || isLookahead) {
pos = savePos;
startPos = saveStartPos;
@@ -7408,10 +6625,10 @@ var ts;
return result;
}
function lookAhead(callback) {
- return speculationHelper(callback, /*isLookahead*/ true);
+ return speculationHelper(callback, true);
}
function tryScan(callback) {
- return speculationHelper(callback, /*isLookahead*/ false);
+ return speculationHelper(callback, false);
}
function getText() {
return text;
@@ -7435,25 +6652,16 @@ var ts;
pos = textPos;
startPos = textPos;
tokenPos = textPos;
- token = 0 /* Unknown */;
+ token = 0;
tokenValue = undefined;
tokenFlags = 0;
}
}
ts.createScanner = createScanner;
})(ts || (ts = {}));
-/** Non-internal stuff goes here */
var ts;
(function (ts) {
- ts.emptyArray = [];
- function closeFileWatcher(watcher) {
- watcher.close();
- }
- ts.closeFileWatcher = closeFileWatcher;
function isExternalModuleNameRelative(moduleName) {
- // TypeScript 1.0 spec (April 2014): 11.2.1
- // An external module name is "relative" if the first term is "." or "..".
- // Update: We also consider a path like `C:\foo.ts` "relative" because we do not search for it in `node_modules` or treat it as an ambient module.
return ts.pathIsRelative(moduleName) || ts.isRootedDiskPath(moduleName);
}
ts.isExternalModuleNameRelative = isExternalModuleNameRelative;
@@ -7461,20 +6669,9 @@ var ts;
return ts.sortAndDeduplicate(diagnostics, ts.compareDiagnostics);
}
ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics;
- function toPath(fileName, basePath, getCanonicalFileName) {
- var nonCanonicalizedPath = ts.isRootedDiskPath(fileName)
- ? ts.normalizePath(fileName)
- : ts.getNormalizedAbsolutePath(fileName, basePath);
- return getCanonicalFileName(nonCanonicalizedPath);
- }
- ts.toPath = toPath;
- function hasEntries(map) {
- return !!map && !!map.size;
- }
- ts.hasEntries = hasEntries;
})(ts || (ts = {}));
-/* @internal */
(function (ts) {
+ ts.emptyArray = [];
ts.resolvingEmptyArray = [];
ts.emptyMap = ts.createMap();
ts.emptyUnderscoreEscapedMap = ts.emptyMap;
@@ -7492,11 +6689,14 @@ var ts;
return undefined;
}
ts.getDeclarationOfKind = getDeclarationOfKind;
- /** Create a new escaped identifier map. */
function createUnderscoreEscapedMap() {
return new ts.MapCtr();
}
ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap;
+ function hasEntries(map) {
+ return !!map && !!map.size;
+ }
+ ts.hasEntries = hasEntries;
function createSymbolTable(symbols) {
var result = ts.createMap();
if (symbols) {
@@ -7531,8 +6731,6 @@ var ts;
getColumn: function () { return 0; },
getIndent: function () { return 0; },
isAtStartOfLine: function () { return false; },
- // Completely ignore indentation for string writers. And map newlines to
- // a single space.
writeLine: function () { return str += " "; },
increaseIndent: ts.noop,
decreaseIndent: ts.noop,
@@ -7543,6 +6741,13 @@ var ts;
reportPrivateInBaseOfClassExpression: ts.noop,
};
}
+ function toPath(fileName, basePath, getCanonicalFileName) {
+ var nonCanonicalizedPath = ts.isRootedDiskPath(fileName)
+ ? ts.normalizePath(fileName)
+ : ts.getNormalizedAbsolutePath(fileName, basePath);
+ return getCanonicalFileName(nonCanonicalizedPath);
+ }
+ ts.toPath = toPath;
function changesAffectModuleResolution(oldOptions, newOptions) {
return !oldOptions ||
(oldOptions.module !== newOptions.module) ||
@@ -7687,31 +6892,23 @@ var ts;
return false;
}
ts.hasChangesInResolutions = hasChangesInResolutions;
- // Returns true if this node contains a parse error anywhere underneath it.
function containsParseError(node) {
aggregateChildData(node);
- return (node.flags & 131072 /* ThisNodeOrAnySubNodesHasError */) !== 0;
+ return (node.flags & 131072) !== 0;
}
ts.containsParseError = containsParseError;
function aggregateChildData(node) {
- if (!(node.flags & 262144 /* HasAggregatedChildData */)) {
- // A node is considered to contain a parse error if:
- // a) the parser explicitly marked that it had an error
- // b) any of it's children reported that it had an error.
- var thisNodeOrAnySubNodesHasError = ((node.flags & 32768 /* ThisNodeHasError */) !== 0) ||
+ if (!(node.flags & 262144)) {
+ var thisNodeOrAnySubNodesHasError = ((node.flags & 32768) !== 0) ||
ts.forEachChild(node, containsParseError);
- // If so, mark ourselves accordingly.
if (thisNodeOrAnySubNodesHasError) {
- node.flags |= 131072 /* ThisNodeOrAnySubNodesHasError */;
+ node.flags |= 131072;
}
- // Also mark that we've propagated the child information to this node. This way we can
- // always consult the bit directly on this node without needing to check its children
- // again.
- node.flags |= 262144 /* HasAggregatedChildData */;
+ node.flags |= 262144;
}
}
function getSourceFileOfNode(node) {
- while (node && node.kind !== 274 /* SourceFile */) {
+ while (node && node.kind !== 274) {
node = node.parent;
}
return node;
@@ -7719,11 +6916,11 @@ var ts;
ts.getSourceFileOfNode = getSourceFileOfNode;
function isStatementWithLocals(node) {
switch (node.kind) {
- case 213 /* Block */:
- case 241 /* CaseBlock */:
- case 220 /* ForStatement */:
- case 221 /* ForInStatement */:
- case 222 /* ForOfStatement */:
+ case 213:
+ case 241:
+ case 220:
+ case 221:
+ case 222:
return true;
}
return false;
@@ -7734,7 +6931,6 @@ var ts;
return ts.getLineStarts(sourceFile)[line];
}
ts.getStartPositionOfLine = getStartPositionOfLine;
- // This is a useful function for debugging purposes.
function nodePosToString(node) {
var file = getSourceFileOfNode(node);
var loc = ts.getLineAndCharacterOfPosition(file, node.pos);
@@ -7747,19 +6943,12 @@ var ts;
var lineIndex = line;
var sourceText = sourceFile.text;
if (lineIndex + 1 === lineStarts.length) {
- // last line - return EOF
return sourceText.length - 1;
}
else {
- // current line start
var start = lineStarts[lineIndex];
- // take the start position of the next line - 1 = it should be some line break
var pos = lineStarts[lineIndex + 1] - 1;
ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos)));
- // walk backwards skipping line breaks, stop the the beginning of current line.
- // i.e:
- //
- // $ <- end of line for this position should match the start position
while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) {
pos--;
}
@@ -7767,45 +6956,21 @@ var ts;
}
}
ts.getEndLinePosition = getEndLinePosition;
- /**
- * 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, name, hasGlobalName) {
return !(hasGlobalName && hasGlobalName(name)) && !sourceFile.identifiers.has(name);
}
ts.isFileLevelUniqueName = isFileLevelUniqueName;
- // Returns true if this node is missing from the actual source code. A 'missing' node is different
- // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes
- // in the tree), it is definitely missing. However, a node may be defined, but still be
- // missing. This happens whenever the parser knows it needs to parse something, but can't
- // get anything in the source code that it expects at that location. For example:
- //
- // let a: ;
- //
- // Here, the Type in the Type-Annotation is not-optional (as there is a colon in the source
- // code). So the parser will attempt to parse out a type, and will create an actual node.
- // However, this node will be 'missing' in the sense that no actual source-code/tokens are
- // contained within it.
function nodeIsMissing(node) {
if (node === undefined) {
return true;
}
- return node.pos === node.end && node.pos >= 0 && node.kind !== 1 /* EndOfFileToken */;
+ return node.pos === node.end && node.pos >= 0 && node.kind !== 1;
}
ts.nodeIsMissing = nodeIsMissing;
function nodeIsPresent(node) {
return !nodeIsMissing(node);
}
ts.nodeIsPresent = nodeIsPresent;
- /**
- * 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, from) {
if (from === undefined || from.length === 0)
return to;
@@ -7819,17 +6984,10 @@ var ts;
return to;
}
ts.prependStatements = prependStatements;
- /**
- * Determine if the given comment is a triple-slash
- *
- * @return true if the comment is a triple-slash comment else false
- */
function isRecognizedTripleSlashComment(text, commentPos, commentEnd) {
- // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text
- // so that we don't end up computing comment string and doing match for all // comments
- if (text.charCodeAt(commentPos + 1) === 47 /* slash */ &&
+ if (text.charCodeAt(commentPos + 1) === 47 &&
commentPos + 2 < commentEnd &&
- text.charCodeAt(commentPos + 2) === 47 /* slash */) {
+ text.charCodeAt(commentPos + 2) === 47) {
var textSubStr = text.substring(commentPos, commentEnd);
return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) ||
textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ||
@@ -7841,27 +6999,21 @@ var ts;
}
ts.isRecognizedTripleSlashComment = isRecognizedTripleSlashComment;
function isPinnedComment(text, start) {
- return text.charCodeAt(start + 1) === 42 /* asterisk */ &&
- text.charCodeAt(start + 2) === 33 /* exclamation */;
+ return text.charCodeAt(start + 1) === 42 &&
+ text.charCodeAt(start + 2) === 33;
}
ts.isPinnedComment = isPinnedComment;
function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
- // With nodes that have no width (i.e. 'Missing' nodes), we actually *don't*
- // want to skip trivia because this will launch us forward to the next token.
if (nodeIsMissing(node)) {
return node.pos;
}
if (ts.isJSDocNode(node)) {
- return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, /*stopAfterLineBreak*/ false, /*stopAtComments*/ true);
+ return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true);
}
if (includeJsDoc && ts.hasJSDocNodes(node)) {
return getTokenPosOfNode(node.jsDoc[0]);
}
- // For a syntax list, it is possible that one of its children has JSDocComment nodes, while
- // the syntax list itself considers them as normal trivia. Therefore if we simply skip
- // trivia for the list, we may have skipped the JSDocComment as well. So we should process its
- // first child to determine the actual position of its first token.
- if (node.kind === 299 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 300 && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -7895,51 +7047,38 @@ var ts;
function getPos(range) {
return range.pos;
}
- /**
- * 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, node) {
return ts.binarySearch(nodeArray, node, getPos, ts.compareValues);
}
ts.indexOfNode = indexOfNode;
- /**
- * Gets flags that control emit behavior of a node.
- */
function getEmitFlags(node) {
var emitNode = node.emitNode;
return emitNode && emitNode.flags || 0;
}
ts.getEmitFlags = getEmitFlags;
function getLiteralText(node, sourceFile) {
- // If we don't need to downlevel and we can reach the original source text using
- // the node's parent reference, then simply get the text as it was originally written.
- if (!nodeIsSynthesized(node) && node.parent && !(ts.isNumericLiteral(node) && node.numericLiteralFlags & 512 /* ContainsSeparator */)) {
+ if (!nodeIsSynthesized(node) && node.parent && !(ts.isNumericLiteral(node) && node.numericLiteralFlags & 512)) {
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
}
- var escapeText = getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? escapeString : escapeNonAsciiString;
- // If we can't reach the original source text, use the canonical form if it's a number,
- // or a (possibly escaped) quoted form of the original text if it's string-like.
+ var escapeText = getEmitFlags(node) & 16777216 ? escapeString : escapeNonAsciiString;
switch (node.kind) {
- case 9 /* StringLiteral */:
+ case 9:
if (node.singleQuote) {
- return "'" + escapeText(node.text, 39 /* singleQuote */) + "'";
+ return "'" + escapeText(node.text, 39) + "'";
}
else {
- return '"' + escapeText(node.text, 34 /* doubleQuote */) + '"';
+ return '"' + escapeText(node.text, 34) + '"';
}
- case 13 /* NoSubstitutionTemplateLiteral */:
- return "`" + escapeText(node.text, 96 /* backtick */) + "`";
- case 14 /* TemplateHead */:
- // tslint:disable-next-line no-invalid-template-strings
- return "`" + escapeText(node.text, 96 /* backtick */) + "${";
- case 15 /* TemplateMiddle */:
- // tslint:disable-next-line no-invalid-template-strings
- return "}" + escapeText(node.text, 96 /* backtick */) + "${";
- case 16 /* TemplateTail */:
- return "}" + escapeText(node.text, 96 /* backtick */) + "`";
- case 8 /* NumericLiteral */:
- case 12 /* RegularExpressionLiteral */:
+ case 13:
+ return "`" + escapeText(node.text, 96) + "`";
+ case 14:
+ return "`" + escapeText(node.text, 96) + "${";
+ case 15:
+ return "}" + escapeText(node.text, 96) + "${";
+ case 16:
+ return "}" + escapeText(node.text, 96) + "`";
+ case 8:
+ case 12:
return node.text;
}
return ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for.");
@@ -7949,74 +7088,59 @@ var ts;
return ts.isString(value) ? '"' + escapeNonAsciiString(value) + '"' : "" + value;
}
ts.getTextOfConstantValue = getTextOfConstantValue;
- // Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__'
function escapeLeadingUnderscores(identifier) {
- return (identifier.length >= 2 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ ? "_" + identifier : identifier);
+ return (identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier);
}
ts.escapeLeadingUnderscores = escapeLeadingUnderscores;
- /**
- * @deprecated Use `id.escapedText` to get the escaped text of an Identifier.
- * @param identifier The identifier to escape
- */
function escapeIdentifier(identifier) {
return identifier;
}
ts.escapeIdentifier = escapeIdentifier;
- // Make an identifier from an external module name by extracting the string after the last "/" and replacing
- // all non-alphanumeric characters with underscores
function makeIdentifierFromModuleName(moduleName) {
return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_");
}
ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName;
function isBlockOrCatchScoped(declaration) {
- return (ts.getCombinedNodeFlags(declaration) & 3 /* BlockScoped */) !== 0 ||
+ return (ts.getCombinedNodeFlags(declaration) & 3) !== 0 ||
isCatchClauseVariableDeclarationOrBindingElement(declaration);
}
ts.isBlockOrCatchScoped = isBlockOrCatchScoped;
function isCatchClauseVariableDeclarationOrBindingElement(declaration) {
var node = getRootDeclaration(declaration);
- return node.kind === 232 /* VariableDeclaration */ && node.parent.kind === 269 /* CatchClause */;
+ return node.kind === 232 && node.parent.kind === 269;
}
ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement;
function isAmbientModule(node) {
- return ts.isModuleDeclaration(node) && (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node));
+ return ts.isModuleDeclaration(node) && (node.name.kind === 9 || isGlobalScopeAugmentation(node));
}
ts.isAmbientModule = isAmbientModule;
function isModuleWithStringLiteralName(node) {
- return ts.isModuleDeclaration(node) && node.name.kind === 9 /* StringLiteral */;
+ return ts.isModuleDeclaration(node) && node.name.kind === 9;
}
ts.isModuleWithStringLiteralName = isModuleWithStringLiteralName;
function isNonGlobalAmbientModule(node) {
return ts.isModuleDeclaration(node) && ts.isStringLiteral(node.name);
}
ts.isNonGlobalAmbientModule = isNonGlobalAmbientModule;
- /**
- * 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) {
return ts.isModuleDeclaration(node) || ts.isIdentifier(node);
}
ts.isEffectiveModuleDeclaration = isEffectiveModuleDeclaration;
- /** Given a symbol for a module, checks that it is a shorthand ambient module. */
function isShorthandAmbientModuleSymbol(moduleSymbol) {
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
}
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
function isShorthandAmbientModule(node) {
- // The only kind of module that can be missing a body is a shorthand ambient module.
- return node && node.kind === 239 /* ModuleDeclaration */ && (!node.body);
+ return node && node.kind === 239 && (!node.body);
}
function isBlockScopedContainerTopLevel(node) {
- return node.kind === 274 /* SourceFile */ ||
- node.kind === 239 /* ModuleDeclaration */ ||
+ return node.kind === 274 ||
+ node.kind === 239 ||
ts.isFunctionLike(node);
}
ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;
function isGlobalScopeAugmentation(module) {
- return !!(module.flags & 512 /* GlobalAugmentation */);
+ return !!(module.flags & 512);
}
ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation;
function isExternalModuleAugmentation(node) {
@@ -8024,13 +7148,10 @@ var ts;
}
ts.isExternalModuleAugmentation = isExternalModuleAugmentation;
function isModuleAugmentationExternal(node) {
- // external module augmentation is a ambient module declaration that is either:
- // - defined in the top level scope and source file is an external module
- // - defined inside ambient module declaration located in the top level scope and source file not an external module
switch (node.parent.kind) {
- case 274 /* SourceFile */:
+ case 274:
return ts.isExternalModule(node.parent);
- case 240 /* ModuleBlock */:
+ case 240:
return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);
}
return false;
@@ -8042,24 +7163,22 @@ var ts;
ts.isEffectiveExternalModule = isEffectiveExternalModule;
function isBlockScope(node, parentNode) {
switch (node.kind) {
- case 274 /* SourceFile */:
- case 241 /* CaseBlock */:
- case 269 /* CatchClause */:
- case 239 /* ModuleDeclaration */:
- case 220 /* ForStatement */:
- case 221 /* ForInStatement */:
- case 222 /* ForOfStatement */:
- case 155 /* Constructor */:
- case 154 /* MethodDeclaration */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
- case 234 /* FunctionDeclaration */:
- case 192 /* FunctionExpression */:
- case 193 /* ArrowFunction */:
+ case 274:
+ case 241:
+ case 269:
+ case 239:
+ case 220:
+ case 221:
+ case 222:
+ case 155:
+ case 154:
+ case 156:
+ case 157:
+ case 234:
+ case 192:
+ case 193:
return true;
- case 213 /* Block */:
- // function block is not considered block-scope container
- // see comment in binder.ts: bind(...), case for SyntaxKind.Block
+ case 213:
return !ts.isFunctionLike(parentNode);
}
return false;
@@ -8067,28 +7186,28 @@ var ts;
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 158 /* CallSignature */:
- case 159 /* ConstructSignature */:
- case 153 /* MethodSignature */:
- case 160 /* IndexSignature */:
- case 163 /* FunctionType */:
- case 164 /* ConstructorType */:
- case 284 /* JSDocFunctionType */:
- case 235 /* ClassDeclaration */:
- case 205 /* ClassExpression */:
- case 236 /* InterfaceDeclaration */:
- case 237 /* TypeAliasDeclaration */:
- case 296 /* JSDocTemplateTag */:
- case 234 /* FunctionDeclaration */:
- case 154 /* MethodDeclaration */:
- case 155 /* Constructor */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
- case 192 /* FunctionExpression */:
- case 193 /* ArrowFunction */:
- case 292 /* JSDocCallbackTag */:
- case 297 /* JSDocTypedefTag */:
- case 288 /* JSDocSignature */:
+ case 158:
+ case 159:
+ case 153:
+ case 160:
+ case 163:
+ case 164:
+ case 284:
+ case 235:
+ case 205:
+ case 236:
+ case 237:
+ case 297:
+ case 234:
+ case 154:
+ case 155:
+ case 156:
+ case 157:
+ case 192:
+ case 193:
+ case 292:
+ case 298:
+ case 288:
return true;
default:
ts.assertTypeIsNever(node);
@@ -8098,8 +7217,8 @@ var ts;
ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters;
function isAnyImportSyntax(node) {
switch (node.kind) {
- case 244 /* ImportDeclaration */:
- case 243 /* ImportEqualsDeclaration */:
+ case 244:
+ case 243:
return true;
default:
return false;
@@ -8108,15 +7227,15 @@ var ts;
ts.isAnyImportSyntax = isAnyImportSyntax;
function isLateVisibilityPaintedStatement(node) {
switch (node.kind) {
- case 244 /* ImportDeclaration */:
- case 243 /* ImportEqualsDeclaration */:
- case 214 /* VariableStatement */:
- case 235 /* ClassDeclaration */:
- case 234 /* FunctionDeclaration */:
- case 239 /* ModuleDeclaration */:
- case 237 /* TypeAliasDeclaration */:
- case 236 /* InterfaceDeclaration */:
- case 238 /* EnumDeclaration */:
+ case 244:
+ case 243:
+ case 214:
+ case 235:
+ case 234:
+ case 239:
+ case 237:
+ case 236:
+ case 238:
return true;
default:
return false;
@@ -8127,15 +7246,10 @@ var ts;
return isAnyImportSyntax(node) || ts.isExportDeclaration(node);
}
ts.isAnyImportOrReExport = isAnyImportOrReExport;
- // Gets the nearest enclosing block scope container that has the provided node
- // as a descendant, that is not the provided node.
function getEnclosingBlockScopeContainer(node) {
return findAncestor(node.parent, function (current) { return isBlockScope(current, current.parent); });
}
ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer;
- // Return display name of an identifier
- // Computed property names will just be emitted as "[]", where is the source
- // text of the expression in the computed property.
function declarationNameToString(name) {
return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name);
}
@@ -8146,13 +7260,13 @@ var ts;
ts.getNameFromIndexInfo = getNameFromIndexInfo;
function getTextOfPropertyName(name) {
switch (name.kind) {
- case 71 /* Identifier */:
+ case 71:
return name.escapedText;
- case 9 /* StringLiteral */:
- case 8 /* NumericLiteral */:
+ case 9:
+ case 8:
return escapeLeadingUnderscores(name.text);
- case 147 /* ComputedPropertyName */:
- return isStringOrNumericLiteral(name.expression) ? escapeLeadingUnderscores(name.expression.text) : undefined; // TODO: GH#18217 Almost all uses of this assume the result to be defined!
+ case 147:
+ return isStringOrNumericLiteral(name.expression) ? escapeLeadingUnderscores(name.expression.text) : undefined;
default:
ts.Debug.assertNever(name);
}
@@ -8160,11 +7274,11 @@ var ts;
ts.getTextOfPropertyName = getTextOfPropertyName;
function entityNameToString(name) {
switch (name.kind) {
- case 71 /* Identifier */:
+ case 71:
return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name);
- case 146 /* QualifiedName */:
+ case 146:
return entityNameToString(name.left) + "." + entityNameToString(name.right);
- case 185 /* PropertyAccessExpression */:
+ case 185:
return entityNameToString(name.expression) + "." + entityNameToString(name.name);
default:
throw ts.Debug.assertNever(name);
@@ -8186,7 +7300,7 @@ var ts;
return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3);
}
ts.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile;
- function createDiagnosticForNodeFromMessageChain(node, messageChain) {
+ function createDiagnosticForNodeFromMessageChain(node, messageChain, relatedInformation) {
var sourceFile = getSourceFileOfNode(node);
var span = getErrorSpanForNode(sourceFile, node);
return {
@@ -8195,12 +7309,13 @@ var ts;
length: span.length,
code: messageChain.code,
category: messageChain.category,
- messageText: messageChain.next ? messageChain : messageChain.messageText
+ messageText: messageChain.next ? messageChain : messageChain.messageText,
+ relatedInformation: relatedInformation
};
}
ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;
function getSpanOfTokenAtPosition(sourceFile, pos) {
- var scanner = ts.createScanner(sourceFile.languageVersion, /*skipTrivia*/ true, sourceFile.languageVariant, sourceFile.text, /*onError:*/ undefined, pos);
+ var scanner = ts.createScanner(sourceFile.languageVersion, true, sourceFile.languageVariant, sourceFile.text, undefined, pos);
scanner.scan();
var start = scanner.getTokenPos();
return ts.createTextSpanFromBounds(start, scanner.getTextPos());
@@ -8208,12 +7323,10 @@ var ts;
ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
function getErrorSpanForArrowFunction(sourceFile, node) {
var pos = ts.skipTrivia(sourceFile.text, node.pos);
- if (node.body && node.body.kind === 213 /* Block */) {
+ if (node.body && node.body.kind === 213) {
var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
if (startLine < endLine) {
- // The arrow function spans multiple lines,
- // make the error span be the first line, inclusive.
return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1);
}
}
@@ -8222,46 +7335,40 @@ var ts;
function getErrorSpanForNode(sourceFile, node) {
var errorNode = node;
switch (node.kind) {
- case 274 /* SourceFile */:
- var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false);
+ case 274:
+ var pos_1 = ts.skipTrivia(sourceFile.text, 0, false);
if (pos_1 === sourceFile.text.length) {
- // file is empty - return span for the beginning of the file
return ts.createTextSpan(0, 0);
}
return getSpanOfTokenAtPosition(sourceFile, pos_1);
- // This list is a work in progress. Add missing node kinds to improve their error
- // spans.
- case 232 /* VariableDeclaration */:
- case 182 /* BindingElement */:
- case 235 /* ClassDeclaration */:
- case 205 /* ClassExpression */:
- case 236 /* InterfaceDeclaration */:
- case 239 /* ModuleDeclaration */:
- case 238 /* EnumDeclaration */:
- case 273 /* EnumMember */:
- case 234 /* FunctionDeclaration */:
- case 192 /* FunctionExpression */:
- case 154 /* MethodDeclaration */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
- case 237 /* TypeAliasDeclaration */:
- case 152 /* PropertyDeclaration */:
- case 151 /* PropertySignature */:
+ case 232:
+ case 182:
+ case 235:
+ case 205:
+ case 236:
+ case 239:
+ case 238:
+ case 273:
+ case 234:
+ case 192:
+ case 154:
+ case 156:
+ case 157:
+ case 237:
+ case 152:
+ case 151:
errorNode = node.name;
break;
- case 193 /* ArrowFunction */:
+ case 193:
return getErrorSpanForArrowFunction(sourceFile, node);
}
if (errorNode === undefined) {
- // If we don't have a better node, then just set the error on the first token of
- // construct.
return getSpanOfTokenAtPosition(sourceFile, node.pos);
}
var isMissing = nodeIsMissing(errorNode);
var pos = isMissing
? errorNode.pos
: ts.skipTrivia(sourceFile.text, errorNode.pos);
- // These asserts should all be satisfied for a properly constructed `errorNode`.
if (isMissing) {
ts.Debug.assert(pos === errorNode.pos, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809");
ts.Debug.assert(pos === errorNode.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809");
@@ -8278,58 +7385,57 @@ var ts;
}
ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule;
function isJsonSourceFile(file) {
- return file.scriptKind === 6 /* JSON */;
+ return file.scriptKind === 6;
}
ts.isJsonSourceFile = isJsonSourceFile;
function isConstEnumDeclaration(node) {
- return node.kind === 238 /* EnumDeclaration */ && isConst(node);
+ return node.kind === 238 && isConst(node);
}
ts.isConstEnumDeclaration = isConstEnumDeclaration;
function isConst(node) {
- return !!(ts.getCombinedNodeFlags(node) & 2 /* Const */)
- || !!(ts.getCombinedModifierFlags(node) & 2048 /* Const */);
+ return !!(ts.getCombinedNodeFlags(node) & 2)
+ || !!(ts.getCombinedModifierFlags(node) & 2048);
}
ts.isConst = isConst;
function isLet(node) {
- return !!(ts.getCombinedNodeFlags(node) & 1 /* Let */);
+ return !!(ts.getCombinedNodeFlags(node) & 1);
}
ts.isLet = isLet;
function isSuperCall(n) {
- return n.kind === 187 /* CallExpression */ && n.expression.kind === 97 /* SuperKeyword */;
+ return n.kind === 187 && n.expression.kind === 97;
}
ts.isSuperCall = isSuperCall;
function isImportCall(n) {
- return n.kind === 187 /* CallExpression */ && n.expression.kind === 91 /* ImportKeyword */;
+ return n.kind === 187 && n.expression.kind === 91;
}
ts.isImportCall = isImportCall;
function isLiteralImportTypeNode(n) {
- return n.kind === 179 /* ImportType */ &&
- n.argument.kind === 178 /* LiteralType */ &&
+ return n.kind === 179 &&
+ n.argument.kind === 178 &&
ts.isStringLiteral(n.argument.literal);
}
ts.isLiteralImportTypeNode = isLiteralImportTypeNode;
function isPrologueDirective(node) {
- return node.kind === 216 /* ExpressionStatement */
- && node.expression.kind === 9 /* StringLiteral */;
+ return node.kind === 216
+ && node.expression.kind === 9;
}
ts.isPrologueDirective = isPrologueDirective;
function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
- return node.kind !== 10 /* JsxText */ ? ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : undefined;
+ return node.kind !== 10 ? ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : undefined;
}
ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;
function getJSDocCommentRanges(node, text) {
- var commentRanges = (node.kind === 149 /* Parameter */ ||
- node.kind === 148 /* TypeParameter */ ||
- node.kind === 192 /* FunctionExpression */ ||
- node.kind === 193 /* ArrowFunction */ ||
- node.kind === 191 /* ParenthesizedExpression */) ?
+ var commentRanges = (node.kind === 149 ||
+ node.kind === 148 ||
+ node.kind === 192 ||
+ node.kind === 193 ||
+ node.kind === 191) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
ts.getLeadingCommentRanges(text, node.pos);
- // True if the comment starts with '/**' but not if it is '/**/'
return ts.filter(commentRanges, function (comment) {
- return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ &&
- text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ &&
- text.charCodeAt(comment.pos + 3) !== 47 /* slash */;
+ return text.charCodeAt(comment.pos + 1) === 42 &&
+ text.charCodeAt(comment.pos + 2) === 42 &&
+ text.charCodeAt(comment.pos + 3) !== 47;
});
}
ts.getJSDocCommentRanges = getJSDocCommentRanges;
@@ -8338,87 +7444,75 @@ var ts;
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/;
var defaultLibReferenceRegEx = /^(\/\/\/\s*/;
function isPartOfTypeNode(node) {
- if (161 /* FirstTypeNode */ <= node.kind && node.kind <= 179 /* LastTypeNode */) {
+ if (161 <= node.kind && node.kind <= 179) {
return true;
}
switch (node.kind) {
- case 119 /* AnyKeyword */:
- case 142 /* UnknownKeyword */:
- case 134 /* NumberKeyword */:
- case 137 /* StringKeyword */:
- case 122 /* BooleanKeyword */:
- case 138 /* SymbolKeyword */:
- case 140 /* UndefinedKeyword */:
- case 131 /* NeverKeyword */:
+ case 119:
+ case 142:
+ case 134:
+ case 137:
+ case 122:
+ case 138:
+ case 140:
+ case 131:
return true;
- case 105 /* VoidKeyword */:
- return node.parent.kind !== 196 /* VoidExpression */;
- case 207 /* ExpressionWithTypeArguments */:
+ case 105:
+ return node.parent.kind !== 196;
+ case 207:
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
- case 148 /* TypeParameter */:
- return node.parent.kind === 177 /* MappedType */ || node.parent.kind === 172 /* InferType */;
- // Identifiers and qualified names may be type nodes, depending on their context. Climb
- // above them to find the lowest container
- case 71 /* Identifier */:
- // If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
- if (node.parent.kind === 146 /* QualifiedName */ && node.parent.right === node) {
+ case 148:
+ return node.parent.kind === 177 || node.parent.kind === 172;
+ case 71:
+ if (node.parent.kind === 146 && node.parent.right === node) {
node = node.parent;
}
- else if (node.parent.kind === 185 /* PropertyAccessExpression */ && node.parent.name === node) {
+ else if (node.parent.kind === 185 && node.parent.name === node) {
node = node.parent;
}
- // At this point, node is either a qualified name or an identifier
- ts.Debug.assert(node.kind === 71 /* Identifier */ || node.kind === 146 /* QualifiedName */ || node.kind === 185 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
- // falls through
- case 146 /* QualifiedName */:
- case 185 /* PropertyAccessExpression */:
- case 99 /* ThisKeyword */: {
+ ts.Debug.assert(node.kind === 71 || node.kind === 146 || node.kind === 185, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
+ case 146:
+ case 185:
+ case 99: {
var parent = node.parent;
- if (parent.kind === 165 /* TypeQuery */) {
+ if (parent.kind === 165) {
return false;
}
- if (parent.kind === 179 /* ImportType */) {
+ if (parent.kind === 179) {
return !parent.isTypeOf;
}
- // Do not recursively call isPartOfTypeNode on the parent. In the example:
- //
- // let a: A.B.C;
- //
- // Calling isPartOfTypeNode would consider the qualified name A.B a type node.
- // Only C and A.B.C are type nodes.
- if (161 /* FirstTypeNode */ <= parent.kind && parent.kind <= 179 /* LastTypeNode */) {
+ if (161 <= parent.kind && parent.kind <= 179) {
return true;
}
switch (parent.kind) {
- case 207 /* ExpressionWithTypeArguments */:
+ case 207:
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 148 /* TypeParameter */:
+ case 148:
return node === parent.constraint;
- case 152 /* PropertyDeclaration */:
- case 151 /* PropertySignature */:
- case 149 /* Parameter */:
- case 232 /* VariableDeclaration */:
+ case 152:
+ case 151:
+ case 149:
+ case 232:
return node === parent.type;
- case 234 /* FunctionDeclaration */:
- case 192 /* FunctionExpression */:
- case 193 /* ArrowFunction */:
- case 155 /* Constructor */:
- case 154 /* MethodDeclaration */:
- case 153 /* MethodSignature */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
+ case 234:
+ case 192:
+ case 193:
+ case 155:
+ case 154:
+ case 153:
+ case 156:
+ case 157:
return node === parent.type;
- case 158 /* CallSignature */:
- case 159 /* ConstructSignature */:
- case 160 /* IndexSignature */:
+ case 158:
+ case 159:
+ case 160:
return node === parent.type;
- case 190 /* TypeAssertionExpression */:
+ case 190:
return node === parent.type;
- case 187 /* CallExpression */:
- case 188 /* NewExpression */:
+ case 187:
+ case 188:
return ts.contains(parent.typeArguments, node);
- case 189 /* TaggedTemplateExpression */:
- // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments.
+ case 189:
return false;
}
}
@@ -8436,29 +7530,27 @@ var ts;
return false;
}
ts.isChildOfNodeWithKind = isChildOfNodeWithKind;
- // Warning: This has the same semantics as the forEach family of functions,
- // in that traversal terminates in the event that 'visitor' supplies a truthy value.
function forEachReturnStatement(body, visitor) {
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 225 /* ReturnStatement */:
+ case 225:
return visitor(node);
- case 241 /* CaseBlock */:
- case 213 /* Block */:
- case 217 /* IfStatement */:
- case 218 /* DoStatement */:
- case 219 /* WhileStatement */:
- case 220 /* ForStatement */:
- case 221 /* ForInStatement */:
- case 222 /* ForOfStatement */:
- case 226 /* WithStatement */:
- case 227 /* SwitchStatement */:
- case 266 /* CaseClause */:
- case 267 /* DefaultClause */:
- case 228 /* LabeledStatement */:
- case 230 /* TryStatement */:
- case 269 /* CatchClause */:
+ case 241:
+ case 213:
+ case 217:
+ case 218:
+ case 219:
+ case 220:
+ case 221:
+ case 222:
+ case 226:
+ case 227:
+ case 266:
+ case 267:
+ case 228:
+ case 230:
+ case 269:
return ts.forEachChild(node, traverse);
}
}
@@ -8468,52 +7560,39 @@ var ts;
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 203 /* YieldExpression */:
+ case 203:
visitor(node);
var operand = node.expression;
if (operand) {
traverse(operand);
}
return;
- case 238 /* EnumDeclaration */:
- case 236 /* InterfaceDeclaration */:
- case 239 /* ModuleDeclaration */:
- case 237 /* TypeAliasDeclaration */:
- case 235 /* ClassDeclaration */:
- case 205 /* ClassExpression */:
- // These are not allowed inside a generator now, but eventually they may be allowed
- // as local types. Regardless, any yield statements contained within them should be
- // skipped in this traversal.
+ case 238:
+ case 236:
+ case 239:
+ case 237:
+ case 235:
+ case 205:
return;
default:
if (ts.isFunctionLike(node)) {
- if (node.name && node.name.kind === 147 /* ComputedPropertyName */) {
- // Note that we will not include methods/accessors of a class because they would require
- // first descending into the class. This is by design.
+ if (node.name && node.name.kind === 147) {
traverse(node.name.expression);
return;
}
}
else if (!isPartOfTypeNode(node)) {
- // This is the general case, which should include mostly expressions and statements.
- // Also includes NodeArrays.
ts.forEachChild(node, traverse);
}
}
}
}
ts.forEachYieldExpression = forEachYieldExpression;
- /**
- * 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) {
- if (node && node.kind === 167 /* ArrayType */) {
+ if (node && node.kind === 167) {
return node.elementType;
}
- else if (node && node.kind === 162 /* TypeReference */) {
+ else if (node && node.kind === 162) {
return ts.singleOrUndefined(node.typeArguments);
}
else {
@@ -8523,12 +7602,12 @@ var ts;
ts.getRestParameterElementType = getRestParameterElementType;
function getMembersOfDeclaration(node) {
switch (node.kind) {
- case 236 /* InterfaceDeclaration */:
- case 235 /* ClassDeclaration */:
- case 205 /* ClassExpression */:
- case 166 /* TypeLiteral */:
+ case 236:
+ case 235:
+ case 205:
+ case 166:
return node.members;
- case 184 /* ObjectLiteralExpression */:
+ case 184:
return node.properties;
}
}
@@ -8536,14 +7615,14 @@ var ts;
function isVariableLike(node) {
if (node) {
switch (node.kind) {
- case 182 /* BindingElement */:
- case 273 /* EnumMember */:
- case 149 /* Parameter */:
- case 270 /* PropertyAssignment */:
- case 152 /* PropertyDeclaration */:
- case 151 /* PropertySignature */:
- case 271 /* ShorthandPropertyAssignment */:
- case 232 /* VariableDeclaration */:
+ case 182:
+ case 273:
+ case 149:
+ case 270:
+ case 152:
+ case 151:
+ case 271:
+ case 232:
return true;
}
}
@@ -8555,8 +7634,8 @@ var ts;
}
ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor;
function isVariableDeclarationInVariableStatement(node) {
- return node.parent.kind === 233 /* VariableDeclarationList */
- && node.parent.parent.kind === 214 /* VariableStatement */;
+ return node.parent.kind === 233
+ && node.parent.parent.kind === 214;
}
ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement;
function isValidESSymbolDeclaration(node) {
@@ -8567,13 +7646,13 @@ var ts;
ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration;
function introducesArgumentsExoticObject(node) {
switch (node.kind) {
- case 154 /* MethodDeclaration */:
- case 153 /* MethodSignature */:
- case 155 /* Constructor */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
- case 234 /* FunctionDeclaration */:
- case 192 /* FunctionExpression */:
+ case 154:
+ case 153:
+ case 155:
+ case 156:
+ case 157:
+ case 234:
+ case 192:
return true;
}
return false;
@@ -8584,7 +7663,7 @@ var ts;
if (beforeUnwrapLabelCallback) {
beforeUnwrapLabelCallback(node);
}
- if (node.statement.kind !== 228 /* LabeledStatement */) {
+ if (node.statement.kind !== 228) {
return node.statement;
}
node = node.statement;
@@ -8592,30 +7671,30 @@ var ts;
}
ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel;
function isFunctionBlock(node) {
- return node && node.kind === 213 /* Block */ && ts.isFunctionLike(node.parent);
+ return node && node.kind === 213 && ts.isFunctionLike(node.parent);
}
ts.isFunctionBlock = isFunctionBlock;
function isObjectLiteralMethod(node) {
- return node && node.kind === 154 /* MethodDeclaration */ && node.parent.kind === 184 /* ObjectLiteralExpression */;
+ return node && node.kind === 154 && node.parent.kind === 184;
}
ts.isObjectLiteralMethod = isObjectLiteralMethod;
function isObjectLiteralOrClassExpressionMethod(node) {
- return node.kind === 154 /* MethodDeclaration */ &&
- (node.parent.kind === 184 /* ObjectLiteralExpression */ ||
- node.parent.kind === 205 /* ClassExpression */);
+ return node.kind === 154 &&
+ (node.parent.kind === 184 ||
+ node.parent.kind === 205);
}
ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;
function isIdentifierTypePredicate(predicate) {
- return predicate && predicate.kind === 1 /* Identifier */;
+ return predicate && predicate.kind === 1;
}
ts.isIdentifierTypePredicate = isIdentifierTypePredicate;
function isThisTypePredicate(predicate) {
- return predicate && predicate.kind === 0 /* This */;
+ return predicate && predicate.kind === 0;
}
ts.isThisTypePredicate = isThisTypePredicate;
function getPropertyAssignment(objectLiteral, key, key2) {
return objectLiteral.properties.filter(function (property) {
- if (property.kind === 270 /* PropertyAssignment */) {
+ if (property.kind === 270) {
var propName = getTextOfPropertyName(property.name);
return key === propName || (!!key2 && key2 === propName);
}
@@ -8652,87 +7731,64 @@ var ts;
}
ts.getContainingClass = getContainingClass;
function getThisContainer(node, includeArrowFunctions) {
- ts.Debug.assert(node.kind !== 274 /* SourceFile */);
+ ts.Debug.assert(node.kind !== 274);
while (true) {
node = node.parent;
if (!node) {
- return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that.
+ return ts.Debug.fail();
}
switch (node.kind) {
- case 147 /* ComputedPropertyName */:
- // If the grandparent node is an object literal (as opposed to a class),
- // then the computed property is not a 'this' container.
- // A computed property name in a class needs to be a this container
- // so that we can error on it.
+ case 147:
if (ts.isClassLike(node.parent.parent)) {
return node;
}
- // If this is a computed property, then the parent should not
- // make it a this container. The parent might be a property
- // in an object literal, like a method or accessor. But in order for
- // such a parent to be a this container, the reference must be in
- // the *body* of the container.
node = node.parent;
break;
- case 150 /* Decorator */:
- // Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 149 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
- // If the decorator's parent is a Parameter, we resolve the this container from
- // the grandparent class declaration.
+ case 150:
+ if (node.parent.kind === 149 && ts.isClassElement(node.parent.parent)) {
node = node.parent.parent;
}
else if (ts.isClassElement(node.parent)) {
- // If the decorator's parent is a class element, we resolve the 'this' container
- // from the parent class declaration.
node = node.parent;
}
break;
- case 193 /* ArrowFunction */:
+ case 193:
if (!includeArrowFunctions) {
continue;
}
- // falls through
- case 234 /* FunctionDeclaration */:
- case 192 /* FunctionExpression */:
- case 239 /* ModuleDeclaration */:
- case 152 /* PropertyDeclaration */:
- case 151 /* PropertySignature */:
- case 154 /* MethodDeclaration */:
- case 153 /* MethodSignature */:
- case 155 /* Constructor */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
- case 158 /* CallSignature */:
- case 159 /* ConstructSignature */:
- case 160 /* IndexSignature */:
- case 238 /* EnumDeclaration */:
- case 274 /* SourceFile */:
+ case 234:
+ case 192:
+ case 239:
+ case 152:
+ case 151:
+ case 154:
+ case 153:
+ case 155:
+ case 156:
+ case 157:
+ case 158:
+ case 159:
+ case 160:
+ case 238:
+ case 274:
return node;
}
}
}
ts.getThisContainer = getThisContainer;
function getNewTargetContainer(node) {
- var container = getThisContainer(node, /*includeArrowFunctions*/ false);
+ var container = getThisContainer(node, false);
if (container) {
switch (container.kind) {
- case 155 /* Constructor */:
- case 234 /* FunctionDeclaration */:
- case 192 /* FunctionExpression */:
+ case 155:
+ case 234:
+ case 192:
return container;
}
}
return undefined;
}
ts.getNewTargetContainer = getNewTargetContainer;
- /**
- * 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, stopOnFunctions) {
while (true) {
node = node.parent;
@@ -8740,34 +7796,28 @@ var ts;
return node;
}
switch (node.kind) {
- case 147 /* ComputedPropertyName */:
+ case 147:
node = node.parent;
break;
- case 234 /* FunctionDeclaration */:
- case 192 /* FunctionExpression */:
- case 193 /* ArrowFunction */:
+ case 234:
+ case 192:
+ case 193:
if (!stopOnFunctions) {
continue;
}
- // falls through
- case 152 /* PropertyDeclaration */:
- case 151 /* PropertySignature */:
- case 154 /* MethodDeclaration */:
- case 153 /* MethodSignature */:
- case 155 /* Constructor */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
+ case 152:
+ case 151:
+ case 154:
+ case 153:
+ case 155:
+ case 156:
+ case 157:
return node;
- case 150 /* Decorator */:
- // Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 149 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
- // If the decorator's parent is a Parameter, we resolve the this container from
- // the grandparent class declaration.
+ case 150:
+ if (node.parent.kind === 149 && ts.isClassElement(node.parent.parent)) {
node = node.parent.parent;
}
else if (ts.isClassElement(node.parent)) {
- // If the decorator's parent is a class element, we resolve the 'this' container
- // from the parent class declaration.
node = node.parent;
}
break;
@@ -8776,47 +7826,41 @@ var ts;
}
ts.getSuperContainer = getSuperContainer;
function getImmediatelyInvokedFunctionExpression(func) {
- if (func.kind === 192 /* FunctionExpression */ || func.kind === 193 /* ArrowFunction */) {
+ if (func.kind === 192 || func.kind === 193) {
var prev = func;
var parent = func.parent;
- while (parent.kind === 191 /* ParenthesizedExpression */) {
+ while (parent.kind === 191) {
prev = parent;
parent = parent.parent;
}
- if (parent.kind === 187 /* CallExpression */ && parent.expression === prev) {
+ if (parent.kind === 187 && parent.expression === prev) {
return parent;
}
}
}
ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;
- /**
- * Determines whether a node is a property or element access expression for `super`.
- */
function isSuperProperty(node) {
var kind = node.kind;
- return (kind === 185 /* PropertyAccessExpression */ || kind === 186 /* ElementAccessExpression */)
- && node.expression.kind === 97 /* SuperKeyword */;
+ return (kind === 185 || kind === 186)
+ && node.expression.kind === 97;
}
ts.isSuperProperty = isSuperProperty;
- /**
- * Determines whether a node is a property or element access expression for `this`.
- */
function isThisProperty(node) {
var kind = node.kind;
- return (kind === 185 /* PropertyAccessExpression */ || kind === 186 /* ElementAccessExpression */)
- && node.expression.kind === 99 /* ThisKeyword */;
+ return (kind === 185 || kind === 186)
+ && node.expression.kind === 99;
}
ts.isThisProperty = isThisProperty;
function getEntityNameFromTypeNode(node) {
switch (node.kind) {
- case 162 /* TypeReference */:
+ case 162:
return node.typeName;
- case 207 /* ExpressionWithTypeArguments */:
+ case 207:
return isEntityNameExpression(node.expression)
? node.expression
: undefined;
- case 71 /* Identifier */:
- case 146 /* QualifiedName */:
+ case 71:
+ case 146:
return node;
}
return undefined;
@@ -8824,10 +7868,10 @@ var ts;
ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;
function getInvokedExpression(node) {
switch (node.kind) {
- case 189 /* TaggedTemplateExpression */:
+ case 189:
return node.tag;
- case 257 /* JsxOpeningElement */:
- case 256 /* JsxSelfClosingElement */:
+ case 257:
+ case 256:
return node.tagName;
default:
return node.expression;
@@ -8836,45 +7880,41 @@ var ts;
ts.getInvokedExpression = getInvokedExpression;
function nodeCanBeDecorated(node, parent, grandparent) {
switch (node.kind) {
- case 235 /* ClassDeclaration */:
- // classes are valid targets
+ case 235:
return true;
- case 152 /* PropertyDeclaration */:
- // property declarations are valid if their parent is a class declaration.
- return parent.kind === 235 /* ClassDeclaration */;
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
- case 154 /* MethodDeclaration */:
- // if this method has a body and its parent is a class declaration, this is a valid target.
+ case 152:
+ return parent.kind === 235;
+ case 156:
+ case 157:
+ case 154:
return node.body !== undefined
- && parent.kind === 235 /* ClassDeclaration */;
- case 149 /* Parameter */:
- // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
+ && parent.kind === 235;
+ case 149:
return parent.body !== undefined
- && (parent.kind === 155 /* Constructor */
- || parent.kind === 154 /* MethodDeclaration */
- || parent.kind === 157 /* SetAccessor */)
- && grandparent.kind === 235 /* ClassDeclaration */;
+ && (parent.kind === 155
+ || parent.kind === 154
+ || parent.kind === 157)
+ && grandparent.kind === 235;
}
return false;
}
ts.nodeCanBeDecorated = nodeCanBeDecorated;
function nodeIsDecorated(node, parent, grandparent) {
return node.decorators !== undefined
- && nodeCanBeDecorated(node, parent, grandparent); // TODO: GH#18217
+ && nodeCanBeDecorated(node, parent, grandparent);
}
ts.nodeIsDecorated = nodeIsDecorated;
function nodeOrChildIsDecorated(node, parent, grandparent) {
- return nodeIsDecorated(node, parent, grandparent) || childIsDecorated(node, parent); // TODO: GH#18217
+ return nodeIsDecorated(node, parent, grandparent) || childIsDecorated(node, parent);
}
ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;
function childIsDecorated(node, parent) {
switch (node.kind) {
- case 235 /* ClassDeclaration */:
- return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217
- case 154 /* MethodDeclaration */:
- case 157 /* SetAccessor */:
- return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217
+ case 235:
+ return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); });
+ case 154:
+ case 157:
+ return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); });
default:
return false;
}
@@ -8882,9 +7922,9 @@ var ts;
ts.childIsDecorated = childIsDecorated;
function isJSXTagName(node) {
var parent = node.parent;
- if (parent.kind === 257 /* JsxOpeningElement */ ||
- parent.kind === 256 /* JsxSelfClosingElement */ ||
- parent.kind === 258 /* JsxClosingElement */) {
+ if (parent.kind === 257 ||
+ parent.kind === 256 ||
+ parent.kind === 258) {
return parent.tagName === node;
}
return false;
@@ -8892,56 +7932,55 @@ var ts;
ts.isJSXTagName = isJSXTagName;
function isExpressionNode(node) {
switch (node.kind) {
- case 97 /* SuperKeyword */:
- case 95 /* NullKeyword */:
- case 101 /* TrueKeyword */:
- case 86 /* FalseKeyword */:
- case 12 /* RegularExpressionLiteral */:
- case 183 /* ArrayLiteralExpression */:
- case 184 /* ObjectLiteralExpression */:
- case 185 /* PropertyAccessExpression */:
- case 186 /* ElementAccessExpression */:
- case 187 /* CallExpression */:
- case 188 /* NewExpression */:
- case 189 /* TaggedTemplateExpression */:
- case 208 /* AsExpression */:
- case 190 /* TypeAssertionExpression */:
- case 209 /* NonNullExpression */:
- case 191 /* ParenthesizedExpression */:
- case 192 /* FunctionExpression */:
- case 205 /* ClassExpression */:
- case 193 /* ArrowFunction */:
- case 196 /* VoidExpression */:
- case 194 /* DeleteExpression */:
- case 195 /* TypeOfExpression */:
- case 198 /* PrefixUnaryExpression */:
- case 199 /* PostfixUnaryExpression */:
- case 200 /* BinaryExpression */:
- case 201 /* ConditionalExpression */:
- case 204 /* SpreadElement */:
- case 202 /* TemplateExpression */:
- case 13 /* NoSubstitutionTemplateLiteral */:
- case 206 /* OmittedExpression */:
- case 255 /* JsxElement */:
- case 256 /* JsxSelfClosingElement */:
- case 259 /* JsxFragment */:
- case 203 /* YieldExpression */:
- case 197 /* AwaitExpression */:
- case 210 /* MetaProperty */:
+ case 97:
+ case 95:
+ case 101:
+ case 86:
+ case 12:
+ case 183:
+ case 184:
+ case 185:
+ case 186:
+ case 187:
+ case 188:
+ case 189:
+ case 208:
+ case 190:
+ case 209:
+ case 191:
+ case 192:
+ case 205:
+ case 193:
+ case 196:
+ case 194:
+ case 195:
+ case 198:
+ case 199:
+ case 200:
+ case 201:
+ case 204:
+ case 202:
+ case 13:
+ case 206:
+ case 255:
+ case 256:
+ case 259:
+ case 203:
+ case 197:
+ case 210:
return true;
- case 146 /* QualifiedName */:
- while (node.parent.kind === 146 /* QualifiedName */) {
+ case 146:
+ while (node.parent.kind === 146) {
node = node.parent;
}
- return node.parent.kind === 165 /* TypeQuery */ || isJSXTagName(node);
- case 71 /* Identifier */:
- if (node.parent.kind === 165 /* TypeQuery */ || isJSXTagName(node)) {
+ return node.parent.kind === 165 || isJSXTagName(node);
+ case 71:
+ if (node.parent.kind === 165 || isJSXTagName(node)) {
return true;
}
- // falls through
- case 8 /* NumericLiteral */:
- case 9 /* StringLiteral */:
- case 99 /* ThisKeyword */:
+ case 8:
+ case 9:
+ case 99:
return isInExpressionContext(node);
default:
return false;
@@ -8951,47 +7990,47 @@ var ts;
function isInExpressionContext(node) {
var parent = node.parent;
switch (parent.kind) {
- case 232 /* VariableDeclaration */:
- case 149 /* Parameter */:
- case 152 /* PropertyDeclaration */:
- case 151 /* PropertySignature */:
- case 273 /* EnumMember */:
- case 270 /* PropertyAssignment */:
- case 182 /* BindingElement */:
+ case 232:
+ case 149:
+ case 152:
+ case 151:
+ case 273:
+ case 270:
+ case 182:
return parent.initializer === node;
- case 216 /* ExpressionStatement */:
- case 217 /* IfStatement */:
- case 218 /* DoStatement */:
- case 219 /* WhileStatement */:
- case 225 /* ReturnStatement */:
- case 226 /* WithStatement */:
- case 227 /* SwitchStatement */:
- case 266 /* CaseClause */:
- case 229 /* ThrowStatement */:
+ case 216:
+ case 217:
+ case 218:
+ case 219:
+ case 225:
+ case 226:
+ case 227:
+ case 266:
+ case 229:
return parent.expression === node;
- case 220 /* ForStatement */:
+ case 220:
var forStatement = parent;
- return (forStatement.initializer === node && forStatement.initializer.kind !== 233 /* VariableDeclarationList */) ||
+ return (forStatement.initializer === node && forStatement.initializer.kind !== 233) ||
forStatement.condition === node ||
forStatement.incrementor === node;
- case 221 /* ForInStatement */:
- case 222 /* ForOfStatement */:
+ case 221:
+ case 222:
var forInStatement = parent;
- return (forInStatement.initializer === node && forInStatement.initializer.kind !== 233 /* VariableDeclarationList */) ||
+ return (forInStatement.initializer === node && forInStatement.initializer.kind !== 233) ||
forInStatement.expression === node;
- case 190 /* TypeAssertionExpression */:
- case 208 /* AsExpression */:
+ case 190:
+ case 208:
return node === parent.expression;
- case 211 /* TemplateSpan */:
+ case 211:
return node === parent.expression;
- case 147 /* ComputedPropertyName */:
+ case 147:
return node === parent.expression;
- case 150 /* Decorator */:
- case 265 /* JsxExpression */:
- case 264 /* JsxSpreadAttribute */:
- case 272 /* SpreadAssignment */:
+ case 150:
+ case 265:
+ case 264:
+ case 272:
return true;
- case 207 /* ExpressionWithTypeArguments */:
+ case 207:
return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
default:
return isExpressionNode(parent);
@@ -8999,7 +8038,7 @@ var ts;
}
ts.isInExpressionContext = isInExpressionContext;
function isExternalModuleImportEqualsDeclaration(node) {
- return node.kind === 243 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 254 /* ExternalModuleReference */;
+ return node.kind === 243 && node.moduleReference.kind === 254;
}
ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;
function getExternalModuleImportEqualsDeclarationExpression(node) {
@@ -9008,7 +8047,7 @@ var ts;
}
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
function isInternalModuleImportEqualsDeclaration(node) {
- return node.kind === 243 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 254 /* ExternalModuleReference */;
+ return node.kind === 243 && node.moduleReference.kind !== 254;
}
ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;
function isSourceFileJavaScript(file) {
@@ -9020,15 +8059,15 @@ var ts;
}
ts.isSourceFileNotJavaScript = isSourceFileNotJavaScript;
function isInJavaScriptFile(node) {
- return !!node && !!(node.flags & 65536 /* JavaScriptFile */);
+ return !!node && !!(node.flags & 65536);
}
ts.isInJavaScriptFile = isInJavaScriptFile;
function isInJsonFile(node) {
- return !!node && !!(node.flags & 16777216 /* JsonFile */);
+ return !!node && !!(node.flags & 16777216);
}
ts.isInJsonFile = isInJsonFile;
function isInJSDoc(node) {
- return !!node && !!(node.flags & 2097152 /* JSDoc */);
+ return !!node && !!(node.flags & 2097152);
}
ts.isInJSDoc = isInJSDoc;
function isJSDocIndexSignature(node) {
@@ -9036,15 +8075,15 @@ var ts;
ts.isIdentifier(node.typeName) &&
node.typeName.escapedText === "Object" &&
node.typeArguments && node.typeArguments.length === 2 &&
- (node.typeArguments[0].kind === 137 /* StringKeyword */ || node.typeArguments[0].kind === 134 /* NumberKeyword */);
+ (node.typeArguments[0].kind === 137 || node.typeArguments[0].kind === 134);
}
ts.isJSDocIndexSignature = isJSDocIndexSignature;
function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) {
- if (callExpression.kind !== 187 /* CallExpression */) {
+ if (callExpression.kind !== 187) {
return false;
}
var _a = callExpression, expression = _a.expression, args = _a.arguments;
- if (expression.kind !== 71 /* Identifier */ || expression.escapedText !== "require") {
+ if (expression.kind !== 71 || expression.escapedText !== "require") {
return false;
}
if (args.length !== 1) {
@@ -9055,11 +8094,11 @@ var ts;
}
ts.isRequireCall = isRequireCall;
function isSingleOrDoubleQuote(charCode) {
- return charCode === 39 /* singleQuote */ || charCode === 34 /* doubleQuote */;
+ return charCode === 39 || charCode === 34;
}
ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote;
function isStringDoubleQuoted(str, sourceFile) {
- return getSourceTextOfNodeFromSourceFile(sourceFile, str).charCodeAt(0) === 34 /* doubleQuote */;
+ return getSourceTextOfNodeFromSourceFile(sourceFile, str).charCodeAt(0) === 34;
}
ts.isStringDoubleQuoted = isStringDoubleQuoted;
function getDeclarationOfJSInitializer(node) {
@@ -9072,16 +8111,16 @@ var ts;
name = node.parent.name;
decl = node.parent;
}
- else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 58 /* EqualsToken */ && node.parent.right === node) {
+ else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 58 && node.parent.right === node) {
name = node.parent.left;
decl = name;
}
- else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 54 /* BarBarToken */) {
+ else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 54) {
if (ts.isVariableDeclaration(node.parent.parent) && node.parent.parent.initializer === node.parent) {
name = node.parent.parent.name;
decl = node.parent.parent;
}
- else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 58 /* EqualsToken */ && node.parent.parent.right === node.parent) {
+ else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 58 && node.parent.parent.right === node.parent) {
name = node.parent.parent.left;
decl = name;
}
@@ -9095,46 +8134,36 @@ var ts;
return decl;
}
ts.getDeclarationOfJSInitializer = getDeclarationOfJSInitializer;
- /** Get the initializer, taking into account defaulted Javascript initializers */
function getEffectiveInitializer(node) {
if (isInJavaScriptFile(node) && node.initializer &&
- ts.isBinaryExpression(node.initializer) && node.initializer.operatorToken.kind === 54 /* BarBarToken */ &&
+ ts.isBinaryExpression(node.initializer) && node.initializer.operatorToken.kind === 54 &&
node.name && isEntityNameExpression(node.name) && isSameEntityName(node.name, node.initializer.left)) {
return node.initializer.right;
}
return node.initializer;
}
ts.getEffectiveInitializer = getEffectiveInitializer;
- /**
- * 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 getDeclaredJavascriptInitializer(node) {
+ var init = getEffectiveInitializer(node);
+ return init && getJavascriptInitializer(init, isPrototypeAccess(node.name));
+ }
+ ts.getDeclaredJavascriptInitializer = getDeclaredJavascriptInitializer;
function getAssignedJavascriptInitializer(node) {
- if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 58 /* EqualsToken */) {
+ if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 58) {
var isPrototypeAssignment = isPrototypeAccess(node.parent.left);
return getJavascriptInitializer(node.parent.right, isPrototypeAssignment) ||
getDefaultedJavascriptInitializer(node.parent.left, node.parent.right, isPrototypeAssignment);
}
}
ts.getAssignedJavascriptInitializer = getAssignedJavascriptInitializer;
- /**
- * 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, isPrototypeAssignment) {
if (ts.isCallExpression(initializer)) {
var e = skipParentheses(initializer.expression);
- return e.kind === 192 /* FunctionExpression */ || e.kind === 193 /* ArrowFunction */ ? initializer : undefined;
+ return e.kind === 192 || e.kind === 193 ? initializer : undefined;
}
- if (initializer.kind === 192 /* FunctionExpression */ ||
- initializer.kind === 205 /* ClassExpression */ ||
- initializer.kind === 193 /* ArrowFunction */) {
+ if (initializer.kind === 192 ||
+ initializer.kind === 205 ||
+ initializer.kind === 193) {
return initializer;
}
if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) {
@@ -9142,32 +8171,23 @@ var ts;
}
}
ts.getJavascriptInitializer = getJavascriptInitializer;
- /**
- * A defaulted Javascript initializer matches the pattern
- * `Lhs = Lhs || JavascriptInitializer`
- * or `var Lhs = Lhs || JavascriptInitializer`
- *
- * The second Lhs is required to be the same as the first except that it may be prefixed with
- * 'window.', 'global.' or 'self.' The second Lhs is otherwise ignored by the binder and checker.
- */
function getDefaultedJavascriptInitializer(name, initializer, isPrototypeAssignment) {
- var e = ts.isBinaryExpression(initializer) && initializer.operatorToken.kind === 54 /* BarBarToken */ && getJavascriptInitializer(initializer.right, isPrototypeAssignment);
+ var e = ts.isBinaryExpression(initializer) && initializer.operatorToken.kind === 54 && getJavascriptInitializer(initializer.right, isPrototypeAssignment);
if (e && isSameEntityName(name, initializer.left)) {
return e;
}
}
function isDefaultedJavascriptInitializer(node) {
var name = ts.isVariableDeclaration(node.parent) ? node.parent.name :
- ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 58 /* EqualsToken */ ? node.parent.left :
+ ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 58 ? node.parent.left :
undefined;
return name && getJavascriptInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left);
}
ts.isDefaultedJavascriptInitializer = isDefaultedJavascriptInitializer;
- /** Given a Javascript initializer, return the outer name. That is, the lhs of the assignment or the declaration name. */
function getOuterNameOfJsInitializer(node) {
if (ts.isBinaryExpression(node.parent)) {
- var parent = (node.parent.operatorToken.kind === 54 /* BarBarToken */ && ts.isBinaryExpression(node.parent.parent)) ? node.parent.parent : node.parent;
- if (parent.operatorToken.kind === 58 /* EqualsToken */ && ts.isIdentifier(parent.left)) {
+ var parent = (node.parent.operatorToken.kind === 54 && ts.isBinaryExpression(node.parent.parent)) ? node.parent.parent : node.parent;
+ if (parent.operatorToken.kind === 58 && ts.isIdentifier(parent.left)) {
return parent.left;
}
}
@@ -9176,21 +8196,12 @@ var ts;
}
}
ts.getOuterNameOfJsInitializer = getOuterNameOfJsInitializer;
- /**
- * Is the 'declared' name the same as the one in the initializer?
- * @return true for identical entity names, as well as ones where the initializer is prefixed with
- * 'window', 'self' or 'global'. For example:
- *
- * var my = my || {}
- * var min = window.min || {}
- * my.app = self.my.app || class { }
- */
function isSameEntityName(name, initializer) {
if (ts.isIdentifier(name) && ts.isIdentifier(initializer)) {
return name.escapedText === initializer.escapedText;
}
if (ts.isIdentifier(name) && ts.isPropertyAccessExpression(initializer)) {
- return (initializer.expression.kind === 99 /* ThisKeyword */ ||
+ return (initializer.expression.kind === 99 ||
ts.isIdentifier(initializer.expression) &&
(initializer.expression.escapedText === "window" ||
initializer.expression.escapedText === "self" ||
@@ -9203,7 +8214,7 @@ var ts;
return false;
}
function getRightMostAssignedExpression(node) {
- while (isAssignmentExpression(node, /*excludeCompoundAssignements*/ true)) {
+ while (isAssignmentExpression(node, true)) {
node = node.right;
}
return node;
@@ -9217,30 +8228,25 @@ var ts;
return ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.escapedText === "module" && node.name.escapedText === "exports";
}
ts.isModuleExportsPropertyAccessExpression = isModuleExportsPropertyAccessExpression;
- /// Given a BinaryExpression, returns SpecialPropertyAssignmentKind for the various kinds of property
- /// assignments we treat as special in the binder
function getSpecialPropertyAssignmentKind(expr) {
if (!isInJavaScriptFile(expr) ||
- expr.operatorToken.kind !== 58 /* EqualsToken */ ||
+ expr.operatorToken.kind !== 58 ||
!ts.isPropertyAccessExpression(expr.left)) {
- return 0 /* None */;
+ return 0;
}
var lhs = expr.left;
- if (lhs.expression.kind === 99 /* ThisKeyword */) {
- return 4 /* ThisProperty */;
+ if (lhs.expression.kind === 99) {
+ return 4;
}
else if (ts.isIdentifier(lhs.expression) && lhs.expression.escapedText === "module" && lhs.name.escapedText === "exports") {
- // module.exports = expr
- return 2 /* ModuleExports */;
+ return 2;
}
else if (isEntityNameExpression(lhs.expression)) {
if (lhs.name.escapedText === "prototype" && ts.isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) {
- // F.prototype = { ... }
- return 6 /* Prototype */;
+ return 6;
}
else if (isPrototypeAccess(lhs.expression)) {
- // F.G....prototype.x = expr
- return 3 /* PrototypeProperty */;
+ return 3;
}
var nextToLast = lhs;
while (ts.isPropertyAccessExpression(nextToLast.expression)) {
@@ -9250,13 +8256,11 @@ var ts;
var id = nextToLast.expression;
if (id.escapedText === "exports" ||
id.escapedText === "module" && nextToLast.name.escapedText === "exports") {
- // exports.name = expr OR module.exports.name = expr
- return 1 /* ExportsProperty */;
+ return 1;
}
- // F.G...x = expr
- return 5 /* Property */;
+ return 5;
}
- return 0 /* None */;
+ return 0;
}
ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind;
function getInitializerOfBinaryExpression(expr) {
@@ -9267,12 +8271,12 @@ var ts;
}
ts.getInitializerOfBinaryExpression = getInitializerOfBinaryExpression;
function isPrototypePropertyAssignment(node) {
- return ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) === 3 /* PrototypeProperty */;
+ return ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) === 3;
}
ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment;
function isSpecialPropertyDeclaration(expr) {
return isInJavaScriptFile(expr) &&
- expr.parent && expr.parent.kind === 216 /* ExpressionStatement */ &&
+ expr.parent && expr.parent.kind === 216 &&
!!ts.getJSDocTypeTag(expr.parent);
}
ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration;
@@ -9282,14 +8286,14 @@ var ts;
ts.importFromModuleSpecifier = importFromModuleSpecifier;
function tryGetImportFromModuleSpecifier(node) {
switch (node.parent.kind) {
- case 244 /* ImportDeclaration */:
- case 250 /* ExportDeclaration */:
+ case 244:
+ case 250:
return node.parent;
- case 254 /* ExternalModuleReference */:
+ case 254:
return node.parent.parent;
- case 187 /* CallExpression */:
+ case 187:
return node.parent;
- case 178 /* LiteralType */:
+ case 178:
ts.Debug.assert(ts.isStringLiteral(node));
return ts.tryCast(node.parent.parent, ts.isImportTypeNode);
default:
@@ -9299,12 +8303,12 @@ var ts;
ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier;
function getExternalModuleName(node) {
switch (node.kind) {
- case 244 /* ImportDeclaration */:
- case 250 /* ExportDeclaration */:
+ case 244:
+ case 250:
return node.moduleSpecifier;
- case 243 /* ImportEqualsDeclaration */:
- return node.moduleReference.kind === 254 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined;
- case 179 /* ImportType */:
+ case 243:
+ return node.moduleReference.kind === 254 ? node.moduleReference.expression : undefined;
+ case 179:
return isLiteralImportTypeNode(node) ? node.argument.literal : undefined;
default:
return ts.Debug.assertNever(node);
@@ -9313,11 +8317,11 @@ var ts;
ts.getExternalModuleName = getExternalModuleName;
function getNamespaceDeclarationNode(node) {
switch (node.kind) {
- case 244 /* ImportDeclaration */:
+ case 244:
return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport);
- case 243 /* ImportEqualsDeclaration */:
+ case 243:
return node;
- case 250 /* ExportDeclaration */:
+ case 250:
return undefined;
default:
return ts.Debug.assertNever(node);
@@ -9325,19 +8329,19 @@ var ts;
}
ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;
function isDefaultImport(node) {
- return node.kind === 244 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
+ return node.kind === 244 && !!node.importClause && !!node.importClause.name;
}
ts.isDefaultImport = isDefaultImport;
function hasQuestionToken(node) {
if (node) {
switch (node.kind) {
- case 149 /* Parameter */:
- case 154 /* MethodDeclaration */:
- case 153 /* MethodSignature */:
- case 271 /* ShorthandPropertyAssignment */:
- case 270 /* PropertyAssignment */:
- case 152 /* PropertyDeclaration */:
- case 151 /* PropertySignature */:
+ case 149:
+ case 154:
+ case 153:
+ case 271:
+ case 270:
+ case 152:
+ case 151:
return node.questionToken !== undefined;
}
}
@@ -9345,14 +8349,14 @@ var ts;
}
ts.hasQuestionToken = hasQuestionToken;
function isJSDocConstructSignature(node) {
- return node.kind === 284 /* JSDocFunctionType */ &&
+ return node.kind === 284 &&
node.parameters.length > 0 &&
node.parameters[0].name &&
node.parameters[0].name.escapedText === "new";
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 297 /* JSDocTypedefTag */ || node.kind === 292 /* JSDocCallbackTag */;
+ return node.kind === 298 || node.kind === 292;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -9362,27 +8366,27 @@ var ts;
function getSourceOfAssignment(node) {
return ts.isExpressionStatement(node) &&
node.expression && ts.isBinaryExpression(node.expression) &&
- node.expression.operatorToken.kind === 58 /* EqualsToken */
+ node.expression.operatorToken.kind === 58
? node.expression.right
: undefined;
}
function getSourceOfDefaultedAssignment(node) {
return ts.isExpressionStatement(node) &&
ts.isBinaryExpression(node.expression) &&
- getSpecialPropertyAssignmentKind(node.expression) !== 0 /* None */ &&
+ getSpecialPropertyAssignmentKind(node.expression) !== 0 &&
ts.isBinaryExpression(node.expression.right) &&
- node.expression.right.operatorToken.kind === 54 /* BarBarToken */
+ node.expression.right.operatorToken.kind === 54
? node.expression.right.right
: undefined;
}
function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) {
switch (node.kind) {
- case 214 /* VariableStatement */:
+ case 214:
var v = getSingleVariableOfVariableStatement(node);
return v && v.initializer;
- case 152 /* PropertyDeclaration */:
+ case 152:
return node.initializer;
- case 270 /* PropertyAssignment */:
+ case 270:
return node.initializer;
}
}
@@ -9392,7 +8396,7 @@ var ts;
function getNestedModuleDeclaration(node) {
return ts.isModuleDeclaration(node) &&
node.body &&
- node.body.kind === 239 /* ModuleDeclaration */
+ node.body.kind === 239
? node.body
: undefined;
}
@@ -9404,15 +8408,9 @@ var ts;
var parent = node.parent;
if (!parent)
return;
- if (parent.kind === 270 /* PropertyAssignment */ || parent.kind === 152 /* PropertyDeclaration */ || getNestedModuleDeclaration(parent)) {
+ if (parent.kind === 270 || parent.kind === 152 || getNestedModuleDeclaration(parent)) {
getJSDocCommentsAndTagsWorker(parent);
}
- // Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement.
- // /**
- // * @param {number} name
- // * @returns {number}
- // */
- // var x = function(name) { return name.length; }
if (parent.parent && (getSingleVariableOfVariableStatement(parent.parent) === node)) {
getJSDocCommentsAndTagsWorker(parent.parent);
}
@@ -9422,13 +8420,17 @@ var ts;
getSourceOfDefaultedAssignment(parent.parent.parent))) {
getJSDocCommentsAndTagsWorker(parent.parent.parent);
}
- if (ts.isBinaryExpression(node) && node.operatorToken.kind === 58 /* EqualsToken */ ||
- ts.isBinaryExpression(parent) && parent.operatorToken.kind === 58 /* EqualsToken */ ||
- node.kind === 185 /* PropertyAccessExpression */ && node.parent && node.parent.kind === 216 /* ExpressionStatement */) {
- getJSDocCommentsAndTagsWorker(parent);
+ if (ts.isBinaryExpression(node) && node.operatorToken.kind === 58 ||
+ ts.isBinaryExpression(parent) && parent.operatorToken.kind === 58 ||
+ node.kind === 185 && node.parent && node.parent.kind === 216) {
+ if (ts.isBinaryExpression(parent)) {
+ getJSDocCommentsAndTagsWorker(parent.parent);
+ }
+ else {
+ getJSDocCommentsAndTagsWorker(parent);
+ }
}
- // Pull parameter comments from declaring function as well
- if (node.kind === 149 /* Parameter */) {
+ if (node.kind === 149) {
result = ts.addRange(result, ts.getJSDocParameterTags(node));
}
if (isVariableLike(node) && ts.hasInitializer(node) && node.initializer !== hostNode && ts.hasJSDocNodes(node.initializer)) {
@@ -9440,7 +8442,6 @@ var ts;
}
}
ts.getJSDocCommentsAndTags = getJSDocCommentsAndTags;
- /** Does the opposite of `getJSDocParameterTags`: given a JSDoc parameter, finds the parameter corresponding to it. */
function getParameterSymbolFromJSDoc(node) {
if (node.symbol) {
return node.symbol;
@@ -9453,7 +8454,7 @@ var ts;
if (!decl) {
return undefined;
}
- var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 71 /* Identifier */ && p.name.escapedText === name; });
+ var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 71 && p.name.escapedText === name; });
return parameter && parameter.symbol;
}
ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc;
@@ -9488,7 +8489,7 @@ var ts;
ts.hasRestParameter = hasRestParameter;
function isRestParameter(node) {
var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
- return node.dotDotDotToken !== undefined || !!type && type.kind === 285 /* JSDocVariadicType */;
+ return node.dotDotDotToken !== undefined || !!type && type.kind === 285;
}
ts.isRestParameter = isRestParameter;
var AssignmentKind;
@@ -9501,73 +8502,65 @@ var ts;
var parent = node.parent;
while (true) {
switch (parent.kind) {
- case 200 /* BinaryExpression */:
+ case 200:
var binaryOperator = parent.operatorToken.kind;
return isAssignmentOperator(binaryOperator) && parent.left === node ?
- binaryOperator === 58 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :
- 0 /* None */;
- case 198 /* PrefixUnaryExpression */:
- case 199 /* PostfixUnaryExpression */:
+ binaryOperator === 58 ? 1 : 2 :
+ 0;
+ case 198:
+ case 199:
var unaryOperator = parent.operator;
- return unaryOperator === 43 /* PlusPlusToken */ || unaryOperator === 44 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */;
- case 221 /* ForInStatement */:
- case 222 /* ForOfStatement */:
- return parent.initializer === node ? 1 /* Definite */ : 0 /* None */;
- case 191 /* ParenthesizedExpression */:
- case 183 /* ArrayLiteralExpression */:
- case 204 /* SpreadElement */:
- case 209 /* NonNullExpression */:
+ return unaryOperator === 43 || unaryOperator === 44 ? 2 : 0;
+ case 221:
+ case 222:
+ return parent.initializer === node ? 1 : 0;
+ case 191:
+ case 183:
+ case 204:
+ case 209:
node = parent;
break;
- case 271 /* ShorthandPropertyAssignment */:
+ case 271:
if (parent.name !== node) {
- return 0 /* None */;
+ return 0;
}
node = parent.parent;
break;
- case 270 /* PropertyAssignment */:
+ case 270:
if (parent.name === node) {
- return 0 /* None */;
+ return 0;
}
node = parent.parent;
break;
default:
- return 0 /* None */;
+ return 0;
}
parent = node.parent;
}
}
ts.getAssignmentTargetKind = getAssignmentTargetKind;
- // A node is an assignment target if it is on the left hand side of an '=' token, if it is parented by a property
- // assignment in an object literal that is an assignment target, or if it is parented by an array literal that is
- // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ a }] = xxx'.
- // (Note that `p` is not a target in the above examples, only `a`.)
function isAssignmentTarget(node) {
- return getAssignmentTargetKind(node) !== 0 /* None */;
+ return getAssignmentTargetKind(node) !== 0;
}
ts.isAssignmentTarget = isAssignmentTarget;
- /**
- * 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) {
switch (node.kind) {
- case 213 /* Block */:
- case 214 /* VariableStatement */:
- case 226 /* WithStatement */:
- case 217 /* IfStatement */:
- case 227 /* SwitchStatement */:
- case 241 /* CaseBlock */:
- case 266 /* CaseClause */:
- case 267 /* DefaultClause */:
- case 228 /* LabeledStatement */:
- case 220 /* ForStatement */:
- case 221 /* ForInStatement */:
- case 222 /* ForOfStatement */:
- case 218 /* DoStatement */:
- case 219 /* WhileStatement */:
- case 230 /* TryStatement */:
- case 269 /* CatchClause */:
+ case 213:
+ case 214:
+ case 226:
+ case 217:
+ case 227:
+ case 241:
+ case 266:
+ case 267:
+ case 228:
+ case 220:
+ case 221:
+ case 222:
+ case 218:
+ case 219:
+ case 230:
+ case 269:
return true;
}
return false;
@@ -9584,27 +8577,26 @@ var ts;
return node;
}
function walkUpParenthesizedTypes(node) {
- return walkUp(node, 173 /* ParenthesizedType */);
+ return walkUp(node, 173);
}
ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes;
function walkUpParenthesizedExpressions(node) {
- return walkUp(node, 191 /* ParenthesizedExpression */);
+ return walkUp(node, 191);
}
ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions;
function skipParentheses(node) {
- while (node.kind === 191 /* ParenthesizedExpression */) {
+ while (node.kind === 191) {
node = node.expression;
}
return node;
}
ts.skipParentheses = skipParentheses;
- // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped
function isDeleteTarget(node) {
- if (node.kind !== 185 /* PropertyAccessExpression */ && node.kind !== 186 /* ElementAccessExpression */) {
+ if (node.kind !== 185 && node.kind !== 186) {
return false;
}
node = walkUpParenthesizedExpressions(node.parent);
- return node && node.kind === 194 /* DeleteExpression */;
+ return node && node.kind === 194;
}
ts.isDeleteTarget = isDeleteTarget;
function isNodeDescendantOf(node, ancestor) {
@@ -9616,17 +8608,15 @@ var ts;
return false;
}
ts.isNodeDescendantOf = isNodeDescendantOf;
- // True if `name` is the name of a declaration node
function isDeclarationName(name) {
return !ts.isSourceFile(name) && !ts.isBindingPattern(name) && ts.isDeclaration(name.parent) && name.parent.name === name;
}
ts.isDeclarationName = isDeclarationName;
- // See GH#16030
function isAnyDeclarationName(name) {
switch (name.kind) {
- case 71 /* Identifier */:
- case 9 /* StringLiteral */:
- case 8 /* NumericLiteral */: {
+ case 71:
+ case 9:
+ case 8: {
var parent = name.parent;
if (ts.isDeclaration(parent)) {
return parent.name === name;
@@ -9637,7 +8627,7 @@ var ts;
}
else {
var binExp = name.parent.parent;
- return ts.isBinaryExpression(binExp) && getSpecialPropertyAssignmentKind(binExp) !== 0 /* None */ && ts.getNameOfDeclaration(binExp) === name;
+ return ts.isBinaryExpression(binExp) && getSpecialPropertyAssignmentKind(binExp) !== 0 && ts.getNameOfDeclaration(binExp) === name;
}
}
default:
@@ -9646,64 +8636,51 @@ var ts;
}
ts.isAnyDeclarationName = isAnyDeclarationName;
function isLiteralComputedPropertyDeclarationName(node) {
- return (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) &&
- node.parent.kind === 147 /* ComputedPropertyName */ &&
+ return (node.kind === 9 || node.kind === 8) &&
+ node.parent.kind === 147 &&
ts.isDeclaration(node.parent.parent);
}
ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;
- // Return true if the given identifier is classified as an IdentifierName
function isIdentifierName(node) {
var parent = node.parent;
switch (parent.kind) {
- case 152 /* PropertyDeclaration */:
- case 151 /* PropertySignature */:
- case 154 /* MethodDeclaration */:
- case 153 /* MethodSignature */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
- case 273 /* EnumMember */:
- case 270 /* PropertyAssignment */:
- case 185 /* PropertyAccessExpression */:
- // Name in member declaration or property name in property access
+ case 152:
+ case 151:
+ case 154:
+ case 153:
+ case 156:
+ case 157:
+ case 273:
+ case 270:
+ case 185:
return parent.name === node;
- case 146 /* QualifiedName */:
- // Name on right hand side of dot in a type query or type reference
+ case 146:
if (parent.right === node) {
- while (parent.kind === 146 /* QualifiedName */) {
+ while (parent.kind === 146) {
parent = parent.parent;
}
- return parent.kind === 165 /* TypeQuery */ || parent.kind === 162 /* TypeReference */;
+ return parent.kind === 165 || parent.kind === 162;
}
return false;
- case 182 /* BindingElement */:
- case 248 /* ImportSpecifier */:
- // Property name in binding element or import specifier
+ case 182:
+ case 248:
return parent.propertyName === node;
- case 252 /* ExportSpecifier */:
- case 262 /* JsxAttribute */:
- // Any name in an export specifier or JSX Attribute
+ case 252:
+ case 262:
return true;
}
return false;
}
ts.isIdentifierName = isIdentifierName;
- // An alias symbol is created by one of the following declarations:
- // import = ...
- // import from ...
- // import * as from ...
- // import { x as } from ...
- // export { x as } from ...
- // export =
- // export default
function isAliasSymbolDeclaration(node) {
- return node.kind === 243 /* ImportEqualsDeclaration */ ||
- node.kind === 242 /* NamespaceExportDeclaration */ ||
- node.kind === 245 /* ImportClause */ && !!node.name ||
- node.kind === 246 /* NamespaceImport */ ||
- node.kind === 248 /* ImportSpecifier */ ||
- node.kind === 252 /* ExportSpecifier */ ||
- node.kind === 249 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
- ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) === 2 /* ModuleExports */;
+ return node.kind === 243 ||
+ node.kind === 242 ||
+ node.kind === 245 && !!node.name ||
+ node.kind === 246 ||
+ node.kind === 248 ||
+ node.kind === 252 ||
+ node.kind === 249 && exportAssignmentIsAlias(node) ||
+ ts.isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) === 2;
}
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
function exportAssignmentIsAlias(node) {
@@ -9712,16 +8689,15 @@ var ts;
}
ts.exportAssignmentIsAlias = exportAssignmentIsAlias;
function getClassExtendsHeritageClauseElement(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 85 /* ExtendsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 85);
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
}
ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement;
function getClassImplementsHeritageClauseElements(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 108 /* ImplementsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 108);
return heritageClause ? heritageClause.types : undefined;
}
ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;
- /** Returns the node in an `extends` or `implements` clause of a class or interface. */
function getAllSuperTypeNodes(node) {
return ts.isInterfaceDeclaration(node) ? getInterfaceBaseTypeNodes(node) || ts.emptyArray
: ts.isClassLike(node) ? ts.concatenate(ts.singleElementArray(getClassExtendsHeritageClauseElement(node)), getClassImplementsHeritageClauseElements(node)) || ts.emptyArray
@@ -9729,7 +8705,7 @@ var ts;
}
ts.getAllSuperTypeNodes = getAllSuperTypeNodes;
function getInterfaceBaseTypeNodes(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 85 /* ExtendsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 85);
return heritageClause ? heritageClause.types : undefined;
}
ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;
@@ -9763,11 +8739,11 @@ var ts;
}
ts.getAncestor = getAncestor;
function isKeyword(token) {
- return 72 /* FirstKeyword */ <= token && token <= 145 /* LastKeyword */;
+ return 72 <= token && token <= 145;
}
ts.isKeyword = isKeyword;
function isContextualKeyword(token) {
- return 117 /* FirstContextualKeyword */ <= token && token <= 145 /* LastContextualKeyword */;
+ return 117 <= token && token <= 145;
}
ts.isContextualKeyword = isContextualKeyword;
function isNonContextualKeyword(token) {
@@ -9780,7 +8756,7 @@ var ts;
}
ts.isStringANonContextualKeyword = isStringANonContextualKeyword;
function isTrivia(token) {
- return 2 /* FirstTriviaToken */ <= token && token <= 7 /* LastTriviaToken */;
+ return 2 <= token && token <= 7;
}
ts.isTrivia = isTrivia;
var FunctionFlags;
@@ -9793,88 +8769,75 @@ var ts;
})(FunctionFlags = ts.FunctionFlags || (ts.FunctionFlags = {}));
function getFunctionFlags(node) {
if (!node) {
- return 4 /* Invalid */;
+ return 4;
}
- var flags = 0 /* Normal */;
+ var flags = 0;
switch (node.kind) {
- case 234 /* FunctionDeclaration */:
- case 192 /* FunctionExpression */:
- case 154 /* MethodDeclaration */:
+ case 234:
+ case 192:
+ case 154:
if (node.asteriskToken) {
- flags |= 1 /* Generator */;
+ flags |= 1;
}
- // falls through
- case 193 /* ArrowFunction */:
- if (hasModifier(node, 256 /* Async */)) {
- flags |= 2 /* Async */;
+ case 193:
+ if (hasModifier(node, 256)) {
+ flags |= 2;
}
break;
}
if (!node.body) {
- flags |= 4 /* Invalid */;
+ flags |= 4;
}
return flags;
}
ts.getFunctionFlags = getFunctionFlags;
function isAsyncFunction(node) {
switch (node.kind) {
- case 234 /* FunctionDeclaration */:
- case 192 /* FunctionExpression */:
- case 193 /* ArrowFunction */:
- case 154 /* MethodDeclaration */:
+ case 234:
+ case 192:
+ case 193:
+ case 154:
return node.body !== undefined
&& node.asteriskToken === undefined
- && hasModifier(node, 256 /* Async */);
+ && hasModifier(node, 256);
}
return false;
}
ts.isAsyncFunction = isAsyncFunction;
function isStringOrNumericLiteral(node) {
var kind = node.kind;
- return kind === 9 /* StringLiteral */
- || kind === 8 /* NumericLiteral */;
+ return kind === 9
+ || kind === 8;
}
ts.isStringOrNumericLiteral = isStringOrNumericLiteral;
- /**
- * 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) {
var name = ts.getNameOfDeclaration(declaration);
return !!name && isDynamicName(name);
}
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
- return name.kind === 147 /* ComputedPropertyName */ &&
+ return name.kind === 147 &&
!isStringOrNumericLiteral(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
}
ts.isDynamicName = isDynamicName;
- /**
- * 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) {
return ts.isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression);
}
ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;
function getPropertyNameForPropertyNameNode(name) {
- if (name.kind === 71 /* Identifier */) {
+ if (name.kind === 71) {
return name.escapedText;
}
- if (name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */) {
+ if (name.kind === 9 || name.kind === 8) {
return escapeLeadingUnderscores(name.text);
}
- if (name.kind === 147 /* ComputedPropertyName */) {
+ if (name.kind === 147) {
var nameExpression = name.expression;
if (isWellKnownSymbolSyntactically(nameExpression)) {
return getPropertyNameForKnownSymbolName(ts.idText(nameExpression.name));
}
- else if (nameExpression.kind === 9 /* StringLiteral */ || nameExpression.kind === 8 /* NumericLiteral */) {
+ else if (nameExpression.kind === 9 || nameExpression.kind === 8) {
return escapeLeadingUnderscores(nameExpression.text);
}
}
@@ -9883,10 +8846,10 @@ var ts;
ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;
function isPropertyNameLiteral(node) {
switch (node.kind) {
- case 71 /* Identifier */:
- case 9 /* StringLiteral */:
- case 13 /* NoSubstitutionTemplateLiteral */:
- case 8 /* NumericLiteral */:
+ case 71:
+ case 9:
+ case 13:
+ case 8:
return true;
default:
return false;
@@ -9894,11 +8857,11 @@ var ts;
}
ts.isPropertyNameLiteral = isPropertyNameLiteral;
function getTextOfIdentifierOrLiteral(node) {
- return node.kind === 71 /* Identifier */ ? ts.idText(node) : node.text;
+ return node.kind === 71 ? ts.idText(node) : node.text;
}
ts.getTextOfIdentifierOrLiteral = getTextOfIdentifierOrLiteral;
function getEscapedTextOfIdentifierOrLiteral(node) {
- return node.kind === 71 /* Identifier */ ? node.escapedText : escapeLeadingUnderscores(node.text);
+ return node.kind === 71 ? node.escapedText : escapeLeadingUnderscores(node.text);
}
ts.getEscapedTextOfIdentifierOrLiteral = getEscapedTextOfIdentifierOrLiteral;
function getPropertyNameForKnownSymbolName(symbolName) {
@@ -9909,11 +8872,8 @@ var ts;
return ts.startsWith(symbol.escapedName, "__@");
}
ts.isKnownSymbol = isKnownSymbol;
- /**
- * Includes the word "Symbol" with unicode escapes
- */
function isESSymbolIdentifier(node) {
- return node.kind === 71 /* Identifier */ && node.escapedText === "Symbol";
+ return node.kind === 71 && node.escapedText === "Symbol";
}
ts.isESSymbolIdentifier = isESSymbolIdentifier;
function isPushOrUnshiftIdentifier(node) {
@@ -9922,11 +8882,11 @@ var ts;
ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;
function isParameterDeclaration(node) {
var root = getRootDeclaration(node);
- return root.kind === 149 /* Parameter */;
+ return root.kind === 149;
}
ts.isParameterDeclaration = isParameterDeclaration;
function getRootDeclaration(node) {
- while (node.kind === 182 /* BindingElement */) {
+ while (node.kind === 182) {
node = node.parent.parent;
}
return node;
@@ -9934,15 +8894,15 @@ var ts;
ts.getRootDeclaration = getRootDeclaration;
function nodeStartsNewLexicalEnvironment(node) {
var kind = node.kind;
- return kind === 155 /* Constructor */
- || kind === 192 /* FunctionExpression */
- || kind === 234 /* FunctionDeclaration */
- || kind === 193 /* ArrowFunction */
- || kind === 154 /* MethodDeclaration */
- || kind === 156 /* GetAccessor */
- || kind === 157 /* SetAccessor */
- || kind === 239 /* ModuleDeclaration */
- || kind === 274 /* SourceFile */;
+ return kind === 155
+ || kind === 192
+ || kind === 234
+ || kind === 193
+ || kind === 154
+ || kind === 156
+ || kind === 157
+ || kind === 239
+ || kind === 274;
}
ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;
function nodeIsSynthesized(range) {
@@ -9961,55 +8921,55 @@ var ts;
})(Associativity = ts.Associativity || (ts.Associativity = {}));
function getExpressionAssociativity(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 188 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 188 && expression.arguments !== undefined;
return getOperatorAssociativity(expression.kind, operator, hasArguments);
}
ts.getExpressionAssociativity = getExpressionAssociativity;
function getOperatorAssociativity(kind, operator, hasArguments) {
switch (kind) {
- case 188 /* NewExpression */:
- return hasArguments ? 0 /* Left */ : 1 /* Right */;
- case 198 /* PrefixUnaryExpression */:
- case 195 /* TypeOfExpression */:
- case 196 /* VoidExpression */:
- case 194 /* DeleteExpression */:
- case 197 /* AwaitExpression */:
- case 201 /* ConditionalExpression */:
- case 203 /* YieldExpression */:
- return 1 /* Right */;
- case 200 /* BinaryExpression */:
+ case 188:
+ return hasArguments ? 0 : 1;
+ case 198:
+ case 195:
+ case 196:
+ case 194:
+ case 197:
+ case 201:
+ case 203:
+ return 1;
+ case 200:
switch (operator) {
- case 40 /* AsteriskAsteriskToken */:
- case 58 /* EqualsToken */:
- case 59 /* PlusEqualsToken */:
- case 60 /* MinusEqualsToken */:
- case 62 /* AsteriskAsteriskEqualsToken */:
- case 61 /* AsteriskEqualsToken */:
- case 63 /* SlashEqualsToken */:
- case 64 /* PercentEqualsToken */:
- case 65 /* LessThanLessThanEqualsToken */:
- case 66 /* GreaterThanGreaterThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 68 /* AmpersandEqualsToken */:
- case 70 /* CaretEqualsToken */:
- case 69 /* BarEqualsToken */:
- return 1 /* Right */;
+ case 40:
+ case 58:
+ case 59:
+ case 60:
+ case 62:
+ case 61:
+ case 63:
+ case 64:
+ case 65:
+ case 66:
+ case 67:
+ case 68:
+ case 70:
+ case 69:
+ return 1;
}
}
- return 0 /* Left */;
+ return 0;
}
ts.getOperatorAssociativity = getOperatorAssociativity;
function getExpressionPrecedence(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 188 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 188 && expression.arguments !== undefined;
return getOperatorPrecedence(expression.kind, operator, hasArguments);
}
ts.getExpressionPrecedence = getExpressionPrecedence;
function getOperator(expression) {
- if (expression.kind === 200 /* BinaryExpression */) {
+ if (expression.kind === 200) {
return expression.operatorToken.kind;
}
- else if (expression.kind === 198 /* PrefixUnaryExpression */ || expression.kind === 199 /* PostfixUnaryExpression */) {
+ else if (expression.kind === 198 || expression.kind === 199) {
return expression.operator;
}
else {
@@ -10019,125 +8979,122 @@ var ts;
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 302 /* CommaListExpression */:
+ case 303:
return 0;
- case 204 /* SpreadElement */:
+ case 204:
return 1;
- case 203 /* YieldExpression */:
+ case 203:
return 2;
- case 201 /* ConditionalExpression */:
+ case 201:
return 4;
- case 200 /* BinaryExpression */:
+ case 200:
switch (operatorKind) {
- case 26 /* CommaToken */:
+ case 26:
return 0;
- case 58 /* EqualsToken */:
- case 59 /* PlusEqualsToken */:
- case 60 /* MinusEqualsToken */:
- case 62 /* AsteriskAsteriskEqualsToken */:
- case 61 /* AsteriskEqualsToken */:
- case 63 /* SlashEqualsToken */:
- case 64 /* PercentEqualsToken */:
- case 65 /* LessThanLessThanEqualsToken */:
- case 66 /* GreaterThanGreaterThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 68 /* AmpersandEqualsToken */:
- case 70 /* CaretEqualsToken */:
- case 69 /* BarEqualsToken */:
+ case 58:
+ case 59:
+ case 60:
+ case 62:
+ case 61:
+ case 63:
+ case 64:
+ case 65:
+ case 66:
+ case 67:
+ case 68:
+ case 70:
+ case 69:
return 3;
default:
return getBinaryOperatorPrecedence(operatorKind);
}
- case 198 /* PrefixUnaryExpression */:
- case 195 /* TypeOfExpression */:
- case 196 /* VoidExpression */:
- case 194 /* DeleteExpression */:
- case 197 /* AwaitExpression */:
+ case 198:
+ case 195:
+ case 196:
+ case 194:
+ case 197:
return 16;
- case 199 /* PostfixUnaryExpression */:
+ case 199:
return 17;
- case 187 /* CallExpression */:
+ case 187:
return 18;
- case 188 /* NewExpression */:
+ case 188:
return hasArguments ? 19 : 18;
- case 189 /* TaggedTemplateExpression */:
- case 185 /* PropertyAccessExpression */:
- case 186 /* ElementAccessExpression */:
+ case 189:
+ case 185:
+ case 186:
return 19;
- case 99 /* ThisKeyword */:
- case 97 /* SuperKeyword */:
- case 71 /* Identifier */:
- case 95 /* NullKeyword */:
- case 101 /* TrueKeyword */:
- case 86 /* FalseKeyword */:
- case 8 /* NumericLiteral */:
- case 9 /* StringLiteral */:
- case 183 /* ArrayLiteralExpression */:
- case 184 /* ObjectLiteralExpression */:
- case 192 /* FunctionExpression */:
- case 193 /* ArrowFunction */:
- case 205 /* ClassExpression */:
- case 255 /* JsxElement */:
- case 256 /* JsxSelfClosingElement */:
- case 259 /* JsxFragment */:
- case 12 /* RegularExpressionLiteral */:
- case 13 /* NoSubstitutionTemplateLiteral */:
- case 202 /* TemplateExpression */:
- case 191 /* ParenthesizedExpression */:
- case 206 /* OmittedExpression */:
+ case 99:
+ case 97:
+ case 71:
+ case 95:
+ case 101:
+ case 86:
+ case 8:
+ case 9:
+ case 183:
+ case 184:
+ case 192:
+ case 193:
+ case 205:
+ case 255:
+ case 256:
+ case 259:
+ case 12:
+ case 13:
+ case 202:
+ case 191:
+ case 206:
return 20;
default:
return -1;
}
}
ts.getOperatorPrecedence = getOperatorPrecedence;
- /* @internal */
function getBinaryOperatorPrecedence(kind) {
switch (kind) {
- case 54 /* BarBarToken */:
+ case 54:
return 5;
- case 53 /* AmpersandAmpersandToken */:
+ case 53:
return 6;
- case 49 /* BarToken */:
+ case 49:
return 7;
- case 50 /* CaretToken */:
+ case 50:
return 8;
- case 48 /* AmpersandToken */:
+ case 48:
return 9;
- case 32 /* EqualsEqualsToken */:
- case 33 /* ExclamationEqualsToken */:
- case 34 /* EqualsEqualsEqualsToken */:
- case 35 /* ExclamationEqualsEqualsToken */:
+ case 32:
+ case 33:
+ case 34:
+ case 35:
return 10;
- case 27 /* LessThanToken */:
- case 29 /* GreaterThanToken */:
- case 30 /* LessThanEqualsToken */:
- case 31 /* GreaterThanEqualsToken */:
- case 93 /* InstanceOfKeyword */:
- case 92 /* InKeyword */:
- case 118 /* AsKeyword */:
+ case 27:
+ case 29:
+ case 30:
+ case 31:
+ case 93:
+ case 92:
+ case 118:
return 11;
- case 45 /* LessThanLessThanToken */:
- case 46 /* GreaterThanGreaterThanToken */:
- case 47 /* GreaterThanGreaterThanGreaterThanToken */:
+ case 45:
+ case 46:
+ case 47:
return 12;
- case 37 /* PlusToken */:
- case 38 /* MinusToken */:
+ case 37:
+ case 38:
return 13;
- case 39 /* AsteriskToken */:
- case 41 /* SlashToken */:
- case 42 /* PercentToken */:
+ case 39:
+ case 41:
+ case 42:
return 14;
- case 40 /* AsteriskAsteriskToken */:
+ case 40:
return 15;
}
- // -1 is lower than all other precedences. Returning it will cause binary expression
- // parsing to stop.
return -1;
}
ts.getBinaryOperatorPrecedence = getBinaryOperatorPrecedence;
function createDiagnosticCollection() {
- var nonFileDiagnostics = []; // See GH#19873
+ var nonFileDiagnostics = [];
var filesWithDiagnostics = [];
var fileDiagnostics = ts.createMap();
var hasReadNonFileDiagnostics = false;
@@ -10155,13 +9112,12 @@ var ts;
if (diagnostic.file) {
diagnostics = fileDiagnostics.get(diagnostic.file.fileName);
if (!diagnostics) {
- diagnostics = []; // See GH#19873
+ diagnostics = [];
fileDiagnostics.set(diagnostic.file.fileName, diagnostics);
ts.insertSorted(filesWithDiagnostics, diagnostic.file.fileName, ts.compareStringsCaseSensitive);
}
}
else {
- // If we've already read the non-file diagnostics, do not modify the existing array.
if (hasReadNonFileDiagnostics) {
hasReadNonFileDiagnostics = false;
nonFileDiagnostics = nonFileDiagnostics.slice();
@@ -10187,11 +9143,6 @@ var ts;
}
}
ts.createDiagnosticCollection = createDiagnosticCollection;
- // This consists of the first 19 unprintable ASCII characters, canonical escapes, lineSeparator,
- // paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in
- // the language service. These characters should be escaped when printing, and if any characters are added,
- // the map below must be updated. Note that this regexp *does not* include the 'delete' character.
- // There is no reason for this other than that JSON.stringify does not handle it either.
var doubleQuoteEscapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
var singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
var backtickQuoteEscapedCharsRegExp = /[\\\`\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
@@ -10208,35 +9159,28 @@ var ts;
"\`": "\\\`",
"\u2028": "\\u2028",
"\u2029": "\\u2029",
- "\u0085": "\\u0085" // nextLine
+ "\u0085": "\\u0085"
});
- /**
- * 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, quoteChar) {
- var escapedCharsRegExp = quoteChar === 96 /* backtick */ ? backtickQuoteEscapedCharsRegExp :
- quoteChar === 39 /* singleQuote */ ? singleQuoteEscapedCharsRegExp :
+ var escapedCharsRegExp = quoteChar === 96 ? backtickQuoteEscapedCharsRegExp :
+ quoteChar === 39 ? singleQuoteEscapedCharsRegExp :
doubleQuoteEscapedCharsRegExp;
return s.replace(escapedCharsRegExp, getReplacement);
}
ts.escapeString = escapeString;
function getReplacement(c, offset, input) {
- if (c.charCodeAt(0) === 0 /* nullCharacter */) {
+ if (c.charCodeAt(0) === 0) {
var lookAhead = input.charCodeAt(offset + c.length);
- if (lookAhead >= 48 /* _0 */ && lookAhead <= 57 /* _9 */) {
- // If the null character is followed by digits, print as a hex escape to prevent the result from parsing as an octal (which is forbidden in strict mode)
+ if (lookAhead >= 48 && lookAhead <= 57) {
return "\\x00";
}
- // Otherwise, keep printing a literal \0 for the null character
return "\\0";
}
return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0));
}
function isIntrinsicJsxName(name) {
var ch = name.charCodeAt(0);
- return (ch >= 97 /* a */ && ch <= 122 /* z */) || name.indexOf("-") > -1;
+ return (ch >= 97 && ch <= 122) || name.indexOf("-") > -1;
}
ts.isIntrinsicJsxName = isIntrinsicJsxName;
function get16BitUnicodeEscapeSequence(charCode) {
@@ -10247,8 +9191,6 @@ var ts;
var nonAsciiCharacters = /[^\u0000-\u007F]/g;
function escapeNonAsciiString(s, quoteChar) {
s = escapeString(s, quoteChar);
- // Replace non-ASCII characters with '\uNNNN' escapes if any exist.
- // Otherwise just return the original string.
return nonAsciiCharacters.test(s) ?
s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) :
s;
@@ -10335,8 +9277,8 @@ var ts;
decreaseIndent: function () { indent--; },
getIndent: function () { return indent; },
getTextPos: function () { return output.length; },
- getLine: function () { return lineCount + 1; },
- getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; },
+ getLine: function () { return lineCount; },
+ getColumn: function () { return lineStart ? indent * getIndentSize() : output.length - linePos; },
getText: function () { return output; },
isAtStartOfLine: function () { return lineStart; },
clear: reset,
@@ -10367,14 +9309,11 @@ var ts;
return getResolvedExternalModuleName(host, file);
}
ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration;
- /**
- * Resolves a local path to a path which is absolute to the base of the emit
- */
function getExternalModuleNameFromPath(host, fileName, referencePath) {
var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); };
- var dir = ts.toPath(referencePath ? ts.getDirectoryPath(referencePath) : host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName);
+ var dir = toPath(referencePath ? ts.getDirectoryPath(referencePath) : host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName);
var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
- var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
+ var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, false);
var extensionless = ts.removeFileExtension(relativePath);
return referencePath ? ts.ensurePathIsNonModuleName(extensionless) : extensionless;
}
@@ -10393,29 +9332,19 @@ var ts;
ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath;
function getDeclarationEmitOutputFilePath(sourceFile, host) {
var options = host.getCompilerOptions();
- var outputDir = options.declarationDir || options.outDir; // Prefer declaration folder if specified
+ var outputDir = options.declarationDir || options.outDir;
var path = outputDir
? getSourceFilePathInNewDir(sourceFile, host, outputDir)
: sourceFile.fileName;
- return ts.removeFileExtension(path) + ".d.ts" /* Dts */;
+ return ts.removeFileExtension(path) + ".d.ts";
}
ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath;
- /**
- * 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, targetSourceFile) {
var options = host.getCompilerOptions();
var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); };
if (options.outFile || options.out) {
var moduleKind = ts.getEmitModuleKind(options);
var moduleEmitEnabled_1 = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System;
- // Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified
return ts.filter(host.getSourceFiles(), function (sourceFile) {
return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary);
});
@@ -10426,7 +9355,6 @@ var ts;
}
}
ts.getSourceFilesToEmit = getSourceFilesToEmit;
- /** Don't call this for `--outFile`, just for `--outDir` or plain emit. `--outFile` needs additional checks. */
function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) {
return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile)) && !sourceFile.isDeclarationFile && !isSourceFileFromExternalLibrary(sourceFile);
}
@@ -10463,14 +9391,12 @@ var ts;
return accessor.parameters[hasThis ? 1 : 0];
}
}
- /** Get the type annotation for the value parameter. */
function getSetAccessorTypeAnnotationNode(accessor) {
var parameter = getSetAccessorValueParameter(accessor);
return parameter && parameter.type;
}
ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode;
function getThisParameter(signature) {
- // callback tags do not currently support this parameters
if (signature.parameters.length && !ts.isJSDocSignature(signature)) {
var thisParameter = signature.parameters[0];
if (parameterIsThisKeyword(thisParameter)) {
@@ -10484,25 +9410,24 @@ var ts;
}
ts.parameterIsThisKeyword = parameterIsThisKeyword;
function isThisIdentifier(node) {
- return !!node && node.kind === 71 /* Identifier */ && identifierIsThisKeyword(node);
+ return !!node && node.kind === 71 && identifierIsThisKeyword(node);
}
ts.isThisIdentifier = isThisIdentifier;
function identifierIsThisKeyword(id) {
- return id.originalKeywordKind === 99 /* ThisKeyword */;
+ return id.originalKeywordKind === 99;
}
ts.identifierIsThisKeyword = identifierIsThisKeyword;
function getAllAccessorDeclarations(declarations, accessor) {
- // TODO: GH#18217
var firstAccessor;
var secondAccessor;
var getAccessor;
var setAccessor;
if (hasDynamicName(accessor)) {
firstAccessor = accessor;
- if (accessor.kind === 156 /* GetAccessor */) {
+ if (accessor.kind === 156) {
getAccessor = accessor;
}
- else if (accessor.kind === 157 /* SetAccessor */) {
+ else if (accessor.kind === 157) {
setAccessor = accessor;
}
else {
@@ -10511,8 +9436,8 @@ var ts;
}
else {
ts.forEach(declarations, function (member) {
- if ((member.kind === 156 /* GetAccessor */ || member.kind === 157 /* SetAccessor */)
- && hasModifier(member, 32 /* Static */) === hasModifier(accessor, 32 /* Static */)) {
+ if ((member.kind === 156 || member.kind === 157)
+ && hasModifier(member, 32) === hasModifier(accessor, 32)) {
var memberName = getPropertyNameForPropertyNameNode(member.name);
var accessorName = getPropertyNameForPropertyNameNode(accessor.name);
if (memberName === accessorName) {
@@ -10522,10 +9447,10 @@ var ts;
else if (!secondAccessor) {
secondAccessor = member;
}
- if (member.kind === 156 /* GetAccessor */ && !getAccessor) {
+ if (member.kind === 156 && !getAccessor) {
getAccessor = member;
}
- if (member.kind === 157 /* SetAccessor */ && !setAccessor) {
+ if (member.kind === 157 && !setAccessor) {
setAccessor = member;
}
}
@@ -10540,10 +9465,6 @@ var ts;
};
}
ts.getAllAccessorDeclarations = getAllAccessorDeclarations;
- /**
- * 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) {
return node.type || (isInJavaScriptFile(node) ? ts.getJSDocType(node) : undefined);
}
@@ -10552,10 +9473,6 @@ var ts;
return node.type;
}
ts.getTypeAnnotationNode = getTypeAnnotationNode;
- /**
- * 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) {
if (ts.isJSDocSignature(node)) {
return node.type && node.type.typeExpression && node.type.typeExpression.type;
@@ -10563,16 +9480,12 @@ var ts;
return node.type || (isInJavaScriptFile(node) ? ts.getJSDocReturnType(node) : undefined);
}
ts.getEffectiveReturnTypeNode = getEffectiveReturnTypeNode;
- /**
- * 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) {
if (ts.isJSDocSignature(node)) {
return ts.emptyArray;
}
if (isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 286 /* JSDocComment */);
+ ts.Debug.assert(node.parent.kind === 286);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
return node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : ts.emptyArray);
@@ -10582,14 +9495,9 @@ var ts;
return ts.flatMap(ts.getJSDocTags(node), function (tag) { return isNonTypeAliasTemplate(tag) ? tag.typeParameters : undefined; });
}
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
- /** template tags are only available when a typedef isn't already using them */
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 286 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 286 && tag.parent.tags.some(isJSDocTypeAlias));
}
- /**
- * 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) {
var parameter = getSetAccessorValueParameter(node);
return parameter && getEffectiveTypeAnnotationNode(parameter);
@@ -10600,7 +9508,6 @@ var ts;
}
ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments;
function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) {
- // If the leading comments start on different line than the start of node, write new line
if (leadingComments && leadingComments.length && pos !== leadingComments[0].pos &&
getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) {
writer.writeLine();
@@ -10608,7 +9515,6 @@ var ts;
}
ts.emitNewLineBeforeLeadingCommentsOfPosition = emitNewLineBeforeLeadingCommentsOfPosition;
function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) {
- // If the leading comments start on different line than the start of node, write new line
if (pos !== commentPos &&
getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos)) {
writer.writeLine();
@@ -10641,25 +9547,15 @@ var ts;
}
}
ts.emitComments = emitComments;
- /**
- * 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, lineMap, writer, writeComment, node, newLine, removeComments) {
var leadingComments;
var currentDetachedCommentInfo;
if (removeComments) {
- // removeComments is true, only reserve pinned comment at the top of file
- // For example:
- // /*! Pinned Comment */
- //
- // var x = 10;
if (node.pos === 0) {
leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedCommentLocal);
}
}
else {
- // removeComments is false, just get detached as normal and bypass the process to filter comment
leadingComments = ts.getLeadingCommentRanges(text, node.pos);
}
if (leadingComments) {
@@ -10671,9 +9567,6 @@ var ts;
var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end);
var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos);
if (commentLine >= lastCommentLine + 2) {
- // There was a blank line between the last comment and this comment. This
- // comment is not part of the copyright comments. Return what we have so
- // far.
break;
}
}
@@ -10681,15 +9574,11 @@ var ts;
lastComment = comment;
}
if (detachedComments.length) {
- // All comments look like they could have been part of the copyright header. Make
- // sure there is at least one blank line between it and the node. If not, it's not
- // a copyright header.
var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.last(detachedComments).end);
var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos));
if (nodeLine >= lastCommentLine + 2) {
- // Valid detachedComments
emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments);
- emitComments(text, lineMap, writer, detachedComments, /*leadingSeparator*/ false, /*trailingSeparator*/ true, newLine, writeComment);
+ emitComments(text, lineMap, writer, detachedComments, false, true, newLine, writeComment);
currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.last(detachedComments).end };
}
}
@@ -10701,7 +9590,7 @@ var ts;
}
ts.emitDetachedComments = emitDetachedComments;
function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) {
- if (text.charCodeAt(commentPos + 1) === 42 /* asterisk */) {
+ if (text.charCodeAt(commentPos + 1) === 42) {
var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, commentPos);
var lineCount = lineMap.length;
var firstCommentLineIndent = void 0;
@@ -10710,50 +9599,29 @@ var ts;
? text.length + 1
: lineMap[currentLine + 1];
if (pos !== commentPos) {
- // If we are not emitting first line, we need to write the spaces to adjust the alignment
if (firstCommentLineIndent === undefined) {
firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos);
}
- // These are number of spaces writer is going to write at current indent
var currentWriterIndentSpacing = writer.getIndent() * getIndentSize();
- // Number of spaces we want to be writing
- // eg: Assume writer indent
- // module m {
- // /* starts at character 9 this is line 1
- // * starts at character pos 4 line --1 = 8 - 8 + 3
- // More left indented comment */ --2 = 8 - 8 + 2
- // class c { }
- // }
- // module m {
- // /* this is line 1 -- Assume current writer indent 8
- // * line --3 = 8 - 4 + 5
- // More right indented comment */ --4 = 8 - 4 + 11
- // class c { }
- // }
var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart);
if (spacesToEmit > 0) {
var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize();
var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize());
- // Write indent size string ( in eg 1: = "", 2: "" , 3: string with 8 spaces 4: string with 12 spaces
writer.rawWrite(indentSizeSpaceString);
- // Emit the single spaces (in eg: 1: 3 spaces, 2: 2 spaces, 3: 1 space, 4: 3 spaces)
while (numberOfSingleSpacesToEmit) {
writer.rawWrite(" ");
numberOfSingleSpacesToEmit--;
}
}
else {
- // No spaces to emit write empty string
writer.rawWrite("");
}
}
- // Write the comment line text
writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart);
pos = nextLineStart;
}
}
else {
- // Single line comment of style //....
writer.write(text.substring(commentPos, commentEnd));
}
}
@@ -10762,33 +9630,29 @@ var ts;
var end = Math.min(commentEnd, nextLineStart - 1);
var currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, "");
if (currentLineText) {
- // trimmed forward and ending spaces text
writer.write(currentLineText);
if (end !== commentEnd) {
writer.writeLine();
}
}
else {
- // Empty string - make sure we write empty line
writer.writeLiteral(newLine);
}
}
function calculateIndent(text, pos, end) {
var currentLineIndent = 0;
for (; pos < end && ts.isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++) {
- if (text.charCodeAt(pos) === 9 /* tab */) {
- // Tabs = TabSize = indent size and go to next tabStop
+ if (text.charCodeAt(pos) === 9) {
currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize());
}
else {
- // Single space
currentLineIndent++;
}
}
return currentLineIndent;
}
function hasModifiers(node) {
- return getModifierFlags(node) !== 0 /* None */;
+ return getModifierFlags(node) !== 0;
}
ts.hasModifiers = hasModifiers;
function hasModifier(node, flags) {
@@ -10796,11 +9660,11 @@ var ts;
}
ts.hasModifier = hasModifier;
function hasStaticModifier(node) {
- return hasModifier(node, 32 /* Static */);
+ return hasModifier(node, 32);
}
ts.hasStaticModifier = hasStaticModifier;
function hasReadonlyModifier(node) {
- return hasModifier(node, 64 /* Readonly */);
+ return hasModifier(node, 64);
}
ts.hasReadonlyModifier = hasReadonlyModifier;
function getSelectedModifierFlags(node, flags) {
@@ -10808,59 +9672,58 @@ var ts;
}
ts.getSelectedModifierFlags = getSelectedModifierFlags;
function getModifierFlags(node) {
- if (node.modifierFlagsCache & 536870912 /* HasComputedFlags */) {
- return node.modifierFlagsCache & ~536870912 /* HasComputedFlags */;
+ if (node.modifierFlagsCache & 536870912) {
+ return node.modifierFlagsCache & ~536870912;
}
var flags = getModifierFlagsNoCache(node);
- node.modifierFlagsCache = flags | 536870912 /* HasComputedFlags */;
+ node.modifierFlagsCache = flags | 536870912;
return flags;
}
ts.getModifierFlags = getModifierFlags;
function getModifierFlagsNoCache(node) {
- var flags = 0 /* None */;
+ var flags = 0;
if (node.modifiers) {
for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
var modifier = _a[_i];
flags |= modifierToFlag(modifier.kind);
}
}
- if (node.flags & 4 /* NestedNamespace */ || (node.kind === 71 /* Identifier */ && node.isInJSDocNamespace)) {
- flags |= 1 /* Export */;
+ if (node.flags & 4 || (node.kind === 71 && node.isInJSDocNamespace)) {
+ flags |= 1;
}
return flags;
}
ts.getModifierFlagsNoCache = getModifierFlagsNoCache;
function modifierToFlag(token) {
switch (token) {
- case 115 /* StaticKeyword */: return 32 /* Static */;
- case 114 /* PublicKeyword */: return 4 /* Public */;
- case 113 /* ProtectedKeyword */: return 16 /* Protected */;
- case 112 /* PrivateKeyword */: return 8 /* Private */;
- case 117 /* AbstractKeyword */: return 128 /* Abstract */;
- case 84 /* ExportKeyword */: return 1 /* Export */;
- case 124 /* DeclareKeyword */: return 2 /* Ambient */;
- case 76 /* ConstKeyword */: return 2048 /* Const */;
- case 79 /* DefaultKeyword */: return 512 /* Default */;
- case 120 /* AsyncKeyword */: return 256 /* Async */;
- case 132 /* ReadonlyKeyword */: return 64 /* Readonly */;
+ case 115: return 32;
+ case 114: return 4;
+ case 113: return 16;
+ case 112: return 8;
+ case 117: return 128;
+ case 84: return 1;
+ case 124: return 2;
+ case 76: return 2048;
+ case 79: return 512;
+ case 120: return 256;
+ case 132: return 64;
}
- return 0 /* None */;
+ return 0;
}
ts.modifierToFlag = modifierToFlag;
function isLogicalOperator(token) {
- return token === 54 /* BarBarToken */
- || token === 53 /* AmpersandAmpersandToken */
- || token === 51 /* ExclamationToken */;
+ return token === 54
+ || token === 53
+ || token === 51;
}
ts.isLogicalOperator = isLogicalOperator;
function isAssignmentOperator(token) {
- return token >= 58 /* FirstAssignment */ && token <= 70 /* LastAssignment */;
+ return token >= 58 && token <= 70;
}
ts.isAssignmentOperator = isAssignmentOperator;
- /** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */
function tryGetClassExtendingExpressionWithTypeArguments(node) {
if (ts.isExpressionWithTypeArguments(node) &&
- node.parent.token === 85 /* ExtendsKeyword */ &&
+ node.parent.token === 85 &&
ts.isClassLike(node.parent.parent)) {
return node.parent.parent;
}
@@ -10869,16 +9732,16 @@ var ts;
function isAssignmentExpression(node, excludeCompoundAssignment) {
return ts.isBinaryExpression(node)
&& (excludeCompoundAssignment
- ? node.operatorToken.kind === 58 /* EqualsToken */
+ ? node.operatorToken.kind === 58
: isAssignmentOperator(node.operatorToken.kind))
&& ts.isLeftHandSideExpression(node.left);
}
ts.isAssignmentExpression = isAssignmentExpression;
function isDestructuringAssignment(node) {
- if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) {
+ if (isAssignmentExpression(node, true)) {
var kind = node.left.kind;
- return kind === 184 /* ObjectLiteralExpression */
- || kind === 183 /* ArrayLiteralExpression */;
+ return kind === 184
+ || kind === 183;
}
return false;
}
@@ -10888,16 +9751,16 @@ var ts;
}
ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
function isExpressionWithTypeArgumentsInClassImplementsClause(node) {
- return node.kind === 207 /* ExpressionWithTypeArguments */
+ return node.kind === 207
&& isEntityNameExpression(node.expression)
&& node.parent
- && node.parent.token === 108 /* ImplementsKeyword */
+ && node.parent.token === 108
&& node.parent.parent
&& ts.isClassLike(node.parent.parent);
}
ts.isExpressionWithTypeArgumentsInClassImplementsClause = isExpressionWithTypeArgumentsInClassImplementsClause;
function isEntityNameExpression(node) {
- return node.kind === 71 /* Identifier */ || isPropertyAccessEntityNameExpression(node);
+ return node.kind === 71 || isPropertyAccessEntityNameExpression(node);
}
ts.isEntityNameExpression = isEntityNameExpression;
function isPropertyAccessEntityNameExpression(node) {
@@ -10909,17 +9772,17 @@ var ts;
}
ts.isPrototypeAccess = isPrototypeAccess;
function isRightSideOfQualifiedNameOrPropertyAccess(node) {
- return (node.parent.kind === 146 /* QualifiedName */ && node.parent.right === node) ||
- (node.parent.kind === 185 /* PropertyAccessExpression */ && node.parent.name === node);
+ return (node.parent.kind === 146 && node.parent.right === node) ||
+ (node.parent.kind === 185 && node.parent.name === node);
}
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
function isEmptyObjectLiteral(expression) {
- return expression.kind === 184 /* ObjectLiteralExpression */ &&
+ return expression.kind === 184 &&
expression.properties.length === 0;
}
ts.isEmptyObjectLiteral = isEmptyObjectLiteral;
function isEmptyArrayLiteral(expression) {
- return expression.kind === 183 /* ArrayLiteralExpression */ &&
+ return expression.kind === 183 &&
expression.elements.length === 0;
}
ts.isEmptyArrayLiteral = isEmptyArrayLiteral;
@@ -10928,23 +9791,17 @@ var ts;
}
ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault;
function isExportDefaultSymbol(symbol) {
- return symbol && ts.length(symbol.declarations) > 0 && hasModifier(symbol.declarations[0], 512 /* Default */);
+ return symbol && ts.length(symbol.declarations) > 0 && hasModifier(symbol.declarations[0], 512);
}
- /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */
function tryExtractTypeScriptExtension(fileName) {
return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });
}
ts.tryExtractTypeScriptExtension = tryExtractTypeScriptExtension;
- /**
- * Replace each instance of non-ascii characters by one, two, three, or four escape sequences
- * representing the UTF-8 encoding of the character, and return the expanded char code list.
- */
function getExpandedCharCodes(input) {
var output = [];
var length = input.length;
for (var i = 0; i < length; i++) {
var charCode = input.charCodeAt(i);
- // handle utf8
if (charCode < 0x80) {
output.push(charCode);
}
@@ -10970,9 +9827,6 @@ var ts;
return output;
}
var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- /**
- * Converts a string to a base-64 encoded ASCII string.
- */
function convertToBase64(input) {
var result = "";
var charCodes = getExpandedCharCodes(input);
@@ -10980,21 +9834,16 @@ var ts;
var length = charCodes.length;
var byte1, byte2, byte3, byte4;
while (i < length) {
- // Convert every 6-bits in the input 3 character points
- // into a base64 digit
byte1 = charCodes[i] >> 2;
byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4;
byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6;
byte4 = charCodes[i + 2] & 63;
- // We are out of characters in the input, set the extra
- // digits to 64 (padding character).
if (i + 1 >= length) {
byte3 = byte4 = 64;
}
else if (i + 2 >= length) {
byte4 = 64;
}
- // Write to the output
result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);
i += 3;
}
@@ -11020,12 +9869,9 @@ var ts;
i++;
nextCode = codes[i];
}
- // `value` may be greater than 10FFFF (the maximum unicode codepoint) - JS will just make this into an invalid character for us
output += String.fromCharCode(value);
}
else {
- // We don't want to kill the process when decoding fails (due to a following char byte not
- // following a leading char), so we just print the (bad) value
output += String.fromCharCode(charCode);
i++;
}
@@ -11047,11 +9893,9 @@ var ts;
var expandedCharCodes = [];
var i = 0;
while (i < length) {
- // Stop decoding once padding characters are present
if (input.charCodeAt(i) === base64Digits.charCodeAt(64)) {
break;
}
- // convert 4 input digits into three characters, ignoring padding characters at the end
var ch1 = base64Digits.indexOf(input[i]);
var ch2 = base64Digits.indexOf(input[i + 1]);
var ch3 = base64Digits.indexOf(input[i + 2]);
@@ -11059,10 +9903,10 @@ var ts;
var code1 = ((ch1 & 63) << 2) | ((ch2 >> 4) & 3);
var code2 = ((ch2 & 15) << 4) | ((ch3 >> 2) & 15);
var code3 = ((ch3 & 3) << 6) | (ch4 & 63);
- if (code2 === 0 && ch3 !== 0) { // code2 decoded to zero, but ch3 was padding - elide code2 and code3
+ if (code2 === 0 && ch3 !== 0) {
expandedCharCodes.push(code1);
}
- else if (code3 === 0 && ch4 !== 0) { // code3 decoded to zero, but ch4 was padding, elide code3
+ else if (code3 === 0 && ch4 !== 0) {
expandedCharCodes.push(code1, code2);
}
else {
@@ -11077,17 +9921,14 @@ var ts;
var lineFeed = "\n";
function getNewLineCharacter(options, getNewLine) {
switch (options.newLine) {
- case 0 /* CarriageReturnLineFeed */:
+ case 0:
return carriageReturnLineFeed;
- case 1 /* LineFeed */:
+ case 1:
return lineFeed;
}
return getNewLine ? getNewLine() : ts.sys ? ts.sys.newLine : carriageReturnLineFeed;
}
ts.getNewLineCharacter = getNewLineCharacter;
- /**
- * Formats an enum value as a string for debugging and debug assertions.
- */
function formatEnum(value, enumObject, isFlags) {
if (value === void 0) { value = 0; }
var members = getEnumMembers(enumObject);
@@ -11129,96 +9970,61 @@ var ts;
return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
}
function formatSyntaxKind(kind) {
- return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
+ return formatEnum(kind, ts.SyntaxKind, false);
}
ts.formatSyntaxKind = formatSyntaxKind;
function formatModifierFlags(flags) {
- return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true);
+ return formatEnum(flags, ts.ModifierFlags, true);
}
ts.formatModifierFlags = formatModifierFlags;
function formatTransformFlags(flags) {
- return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true);
+ return formatEnum(flags, ts.TransformFlags, true);
}
ts.formatTransformFlags = formatTransformFlags;
function formatEmitFlags(flags) {
- return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true);
+ return formatEnum(flags, ts.EmitFlags, true);
}
ts.formatEmitFlags = formatEmitFlags;
function formatSymbolFlags(flags) {
- return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true);
+ return formatEnum(flags, ts.SymbolFlags, true);
}
ts.formatSymbolFlags = formatSymbolFlags;
function formatTypeFlags(flags) {
- return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true);
+ return formatEnum(flags, ts.TypeFlags, true);
}
ts.formatTypeFlags = formatTypeFlags;
function formatObjectFlags(flags) {
- return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true);
+ return formatEnum(flags, ts.ObjectFlags, true);
}
ts.formatObjectFlags = formatObjectFlags;
- /**
- * Creates a new TextRange from the provided pos and end.
- *
- * @param pos The start position.
- * @param end The end position.
- */
function createRange(pos, end) {
return { pos: pos, end: end };
}
ts.createRange = createRange;
- /**
- * 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, end) {
return createRange(range.pos, end);
}
ts.moveRangeEnd = moveRangeEnd;
- /**
- * 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, pos) {
return createRange(pos, range.end);
}
ts.moveRangePos = moveRangePos;
- /**
- * Moves the start position of a range past any decorators.
- */
function moveRangePastDecorators(node) {
return node.decorators && node.decorators.length > 0
? moveRangePos(node, node.decorators.end)
: node;
}
ts.moveRangePastDecorators = moveRangePastDecorators;
- /**
- * Moves the start position of a range past any decorators or modifiers.
- */
function moveRangePastModifiers(node) {
return node.modifiers && node.modifiers.length > 0
? moveRangePos(node, node.modifiers.end)
: moveRangePastDecorators(node);
}
ts.moveRangePastModifiers = moveRangePastModifiers;
- /**
- * Determines whether a TextRange has the same start and end positions.
- *
- * @param range A TextRange.
- */
function isCollapsedRange(range) {
return range.pos === range.end;
}
ts.isCollapsedRange = isCollapsedRange;
- /**
- * Creates a new TextRange for a token at the provides start position.
- *
- * @param pos The start position.
- * @param token The token.
- */
function createTokenRange(pos, token) {
return createRange(pos, pos + ts.tokenToString(token).length);
}
@@ -11252,16 +10058,12 @@ var ts;
return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);
}
ts.getStartPositionOfRange = getStartPositionOfRange;
- /**
- * Determines whether a name was originally the declaration name of an enum or namespace
- * declaration.
- */
function isDeclarationNameOfEnumOrNamespace(node) {
var parseNode = ts.getParseTreeNode(node);
if (parseNode) {
switch (parseNode.parent.kind) {
- case 238 /* EnumDeclaration */:
- case 239 /* ModuleDeclaration */:
+ case 238:
+ case 239:
return parseNode === parseNode.parent.name;
}
}
@@ -11276,79 +10078,77 @@ var ts;
return node.initializer !== undefined;
}
function isWatchSet(options) {
- // Firefox has Object.prototype.watch
return options.watch && options.hasOwnProperty("watch");
}
ts.isWatchSet = isWatchSet;
+ function closeFileWatcher(watcher) {
+ watcher.close();
+ }
+ ts.closeFileWatcher = closeFileWatcher;
function getCheckFlags(symbol) {
- return symbol.flags & 33554432 /* Transient */ ? symbol.checkFlags : 0;
+ return symbol.flags & 33554432 ? symbol.checkFlags : 0;
}
ts.getCheckFlags = getCheckFlags;
function getDeclarationModifierFlagsFromSymbol(s) {
if (s.valueDeclaration) {
var flags = ts.getCombinedModifierFlags(s.valueDeclaration);
- return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~28 /* AccessibilityModifier */;
+ return s.parent && s.parent.flags & 32 ? flags : flags & ~28;
}
- if (getCheckFlags(s) & 6 /* Synthetic */) {
+ if (getCheckFlags(s) & 6) {
var checkFlags = s.checkFlags;
- var accessModifier = checkFlags & 256 /* ContainsPrivate */ ? 8 /* Private */ :
- checkFlags & 64 /* ContainsPublic */ ? 4 /* Public */ :
- 16 /* Protected */;
- var staticModifier = checkFlags & 512 /* ContainsStatic */ ? 32 /* Static */ : 0;
+ var accessModifier = checkFlags & 256 ? 8 :
+ checkFlags & 64 ? 4 :
+ 16;
+ var staticModifier = checkFlags & 512 ? 32 : 0;
return accessModifier | staticModifier;
}
- if (s.flags & 4194304 /* Prototype */) {
- return 4 /* Public */ | 32 /* Static */;
+ if (s.flags & 4194304) {
+ return 4 | 32;
}
return 0;
}
ts.getDeclarationModifierFlagsFromSymbol = getDeclarationModifierFlagsFromSymbol;
function skipAlias(symbol, checker) {
- return symbol.flags & 2097152 /* Alias */ ? checker.getAliasedSymbol(symbol) : symbol;
+ return symbol.flags & 2097152 ? checker.getAliasedSymbol(symbol) : symbol;
}
ts.skipAlias = skipAlias;
- /** See comment on `declareModuleMember` in `binder.ts`. */
function getCombinedLocalAndExportSymbolFlags(symbol) {
return symbol.exportSymbol ? symbol.exportSymbol.flags | symbol.flags : symbol.flags;
}
ts.getCombinedLocalAndExportSymbolFlags = getCombinedLocalAndExportSymbolFlags;
function isWriteOnlyAccess(node) {
- return accessKind(node) === 1 /* Write */;
+ return accessKind(node) === 1;
}
ts.isWriteOnlyAccess = isWriteOnlyAccess;
function isWriteAccess(node) {
- return accessKind(node) !== 0 /* Read */;
+ return accessKind(node) !== 0;
}
ts.isWriteAccess = isWriteAccess;
var AccessKind;
(function (AccessKind) {
- /** Only reads from a variable. */
AccessKind[AccessKind["Read"] = 0] = "Read";
- /** Only writes to a variable without using the result. E.g.: `x++;`. */
AccessKind[AccessKind["Write"] = 1] = "Write";
- /** Writes to a variable and uses the result as an expression. E.g.: `f(x++);`. */
AccessKind[AccessKind["ReadWrite"] = 2] = "ReadWrite";
})(AccessKind || (AccessKind = {}));
function accessKind(node) {
var parent = node.parent;
if (!parent)
- return 0 /* Read */;
+ return 0;
switch (parent.kind) {
- case 199 /* PostfixUnaryExpression */:
- case 198 /* PrefixUnaryExpression */:
+ case 199:
+ case 198:
var operator = parent.operator;
- return operator === 43 /* PlusPlusToken */ || operator === 44 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */;
- case 200 /* BinaryExpression */:
+ return operator === 43 || operator === 44 ? writeOrReadWrite() : 0;
+ case 200:
var _a = parent, left = _a.left, operatorToken = _a.operatorToken;
- return left === node && isAssignmentOperator(operatorToken.kind) ? writeOrReadWrite() : 0 /* Read */;
- case 185 /* PropertyAccessExpression */:
- return parent.name !== node ? 0 /* Read */ : accessKind(parent);
+ return left === node && isAssignmentOperator(operatorToken.kind) ? writeOrReadWrite() : 0;
+ case 185:
+ return parent.name !== node ? 0 : accessKind(parent);
default:
- return 0 /* Read */;
+ return 0;
}
function writeOrReadWrite() {
- // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect.
- return parent.parent && parent.parent.kind === 216 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
+ return parent.parent && parent.parent.kind === 216 ? 1 : 2;
}
}
function compareDataObjects(dst, src) {
@@ -11370,43 +10170,30 @@ var ts;
return true;
}
ts.compareDataObjects = compareDataObjects;
- /**
- * clears already present map by calling onDeleteExistingValue callback before deleting that key/value
- */
function clearMap(map, onDeleteValue) {
- // Remove all
map.forEach(onDeleteValue);
map.clear();
}
ts.clearMap = clearMap;
- /**
- * Mutates the map with newMap such that keys in map will be same as newMap.
- */
function mutateMap(map, newMap, options) {
var createNewValue = options.createNewValue, onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
- // Needs update
map.forEach(function (existingValue, key) {
var valueInNewMap = newMap.get(key);
- // Not present any more in new map, remove it
if (valueInNewMap === undefined) {
map.delete(key);
onDeleteValue(existingValue, key);
}
- // If present notify about existing values
else if (onExistingValue) {
onExistingValue(existingValue, valueInNewMap, key);
}
});
- // Add new values that are not already present
newMap.forEach(function (valueInNewMap, key) {
if (!map.has(key)) {
- // New values
map.set(key, createNewValue(key, valueInNewMap));
}
});
}
ts.mutateMap = mutateMap;
- /** Calls `callback` on `directory` and every ancestor directory it has, returning the first defined result. */
function forEachAncestorDirectory(directory, callback) {
while (true) {
var result = callback(directory);
@@ -11421,15 +10208,14 @@ var ts;
}
}
ts.forEachAncestorDirectory = forEachAncestorDirectory;
- // Return true if the given type is the constructor type for an abstract class
function isAbstractConstructorType(type) {
- return !!(getObjectFlags(type) & 16 /* Anonymous */) && !!type.symbol && isAbstractConstructorSymbol(type.symbol);
+ return !!(getObjectFlags(type) & 16) && !!type.symbol && isAbstractConstructorSymbol(type.symbol);
}
ts.isAbstractConstructorType = isAbstractConstructorType;
function isAbstractConstructorSymbol(symbol) {
- if (symbol.flags & 32 /* Class */) {
+ if (symbol.flags & 32) {
var declaration = getClassLikeDeclarationOfSymbol(symbol);
- return !!declaration && hasModifier(declaration, 128 /* Abstract */);
+ return !!declaration && hasModifier(declaration, 128);
}
return false;
}
@@ -11439,11 +10225,11 @@ var ts;
}
ts.getClassLikeDeclarationOfSymbol = getClassLikeDeclarationOfSymbol;
function getObjectFlags(type) {
- return type.flags & 131072 /* Object */ ? type.objectFlags : 0;
+ return type.flags & 131072 ? type.objectFlags : 0;
}
ts.getObjectFlags = getObjectFlags;
function typeHasCallOrConstructSignatures(type, checker) {
- return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
+ return checker.getSignaturesOfType(type, 0).length !== 0 || checker.getSignaturesOfType(type, 1).length !== 0;
}
ts.typeHasCallOrConstructSignatures = typeHasCallOrConstructSignatures;
function forSomeAncestorDirectory(directory, callback) {
@@ -11465,7 +10251,6 @@ var ts;
if (nodeIsPresent(child))
lastChild = child;
}, function (children) {
- // As an optimization, jump straight to the end of the list.
for (var i = children.length - 1; i >= 0; i--) {
if (nodeIsPresent(children[i])) {
lastChild = children[i];
@@ -11494,14 +10279,16 @@ var ts;
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 6 /* ESNext */:
+ case 6:
return "lib.esnext.full.d.ts";
- case 4 /* ES2017 */:
+ case 5:
+ return "lib.es2018.full.d.ts";
+ case 4:
return "lib.es2017.full.d.ts";
- case 3 /* ES2016 */:
+ case 3:
return "lib.es2016.full.d.ts";
- case 2 /* ES2015 */:
- return "lib.es6.d.ts"; // We don't use lib.es2015.full.d.ts due to breaking change.
+ case 2:
+ return "lib.es6.d.ts";
default:
return "lib.d.ts";
}
@@ -11519,7 +10306,6 @@ var ts;
return position >= span.start && position < textSpanEnd(span);
}
ts.textSpanContainsPosition = textSpanContainsPosition;
- // Returns true if 'span' contains 'other'.
function textSpanContainsTextSpan(span, other) {
return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);
}
@@ -11567,7 +10353,6 @@ var ts;
return { start: start, length: length };
}
ts.createTextSpan = createTextSpan;
- /* @internal */
function createTextRange(pos, end) {
if (end === void 0) { end = pos; }
ts.Debug.assert(end >= pos);
@@ -11594,14 +10379,6 @@ var ts;
}
ts.createTextChangeRange = createTextChangeRange;
ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0);
- /**
- * 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) {
if (changes.length === 0) {
return ts.unchangedTextChangeRange;
@@ -11609,93 +10386,12 @@ var ts;
if (changes.length === 1) {
return changes[0];
}
- // We change from talking about { { oldStart, oldLength }, newLength } to { oldStart, oldEnd, newEnd }
- // as it makes things much easier to reason about.
var change0 = changes[0];
var oldStartN = change0.span.start;
var oldEndN = textSpanEnd(change0.span);
var newEndN = oldStartN + change0.newLength;
for (var i = 1; i < changes.length; i++) {
var nextChange = changes[i];
- // Consider the following case:
- // i.e. two edits. The first represents the text change range { { 10, 50 }, 30 }. i.e. The span starting
- // at 10, with length 50 is reduced to length 30. The second represents the text change range { { 30, 30 }, 40 }.
- // i.e. the span starting at 30 with length 30 is increased to length 40.
- //
- // 0 10 20 30 40 50 60 70 80 90 100
- // -------------------------------------------------------------------------------------------------------
- // | /
- // | /----
- // T1 | /----
- // | /----
- // | /----
- // -------------------------------------------------------------------------------------------------------
- // | \
- // | \
- // T2 | \
- // | \
- // | \
- // -------------------------------------------------------------------------------------------------------
- //
- // Merging these turns out to not be too difficult. First, determining the new start of the change is trivial
- // it's just the min of the old and new starts. i.e.:
- //
- // 0 10 20 30 40 50 60 70 80 90 100
- // ------------------------------------------------------------*------------------------------------------
- // | /
- // | /----
- // T1 | /----
- // | /----
- // | /----
- // ----------------------------------------$-------------------$------------------------------------------
- // . | \
- // . | \
- // T2 . | \
- // . | \
- // . | \
- // ----------------------------------------------------------------------*--------------------------------
- //
- // (Note the dots represent the newly inferred start.
- // Determining the new and old end is also pretty simple. Basically it boils down to paying attention to the
- // absolute positions at the asterisks, and the relative change between the dollar signs. Basically, we see
- // which if the two $'s precedes the other, and we move that one forward until they line up. in this case that
- // means:
- //
- // 0 10 20 30 40 50 60 70 80 90 100
- // --------------------------------------------------------------------------------*----------------------
- // | /
- // | /----
- // T1 | /----
- // | /----
- // | /----
- // ------------------------------------------------------------$------------------------------------------
- // . | \
- // . | \
- // T2 . | \
- // . | \
- // . | \
- // ----------------------------------------------------------------------*--------------------------------
- //
- // In other words (in this case), we're recognizing that the second edit happened after where the first edit
- // ended with a delta of 20 characters (60 - 40). Thus, if we go back in time to where the first edit started
- // that's the same as if we started at char 80 instead of 60.
- //
- // As it so happens, the same logic applies if the second edit precedes the first edit. In that case rather
- // than pushing the first edit forward to match the second, we'll push the second edit forward to match the
- // first.
- //
- // In this case that means we have { oldStart: 10, oldEnd: 80, newEnd: 70 } or, in TextChangeRange
- // semantics: { { start: 10, length: 70 }, newLength: 60 }
- //
- // The math then works out as follows.
- // If we have { oldStart1, oldEnd1, newEnd1 } and { oldStart2, oldEnd2, newEnd2 } then we can compute the
- // final result like so:
- //
- // {
- // oldStart3: Min(oldStart1, oldStart2),
- // oldEnd3: Max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)),
- // newEnd3: Max(newEnd2, newEnd2 + (newEnd1 - oldEnd2))
- // }
var oldStart1 = oldStartN;
var oldEnd1 = oldEndN;
var newEnd1 = newEndN;
@@ -11706,13 +10402,13 @@ var ts;
oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1));
newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2));
}
- return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength*/ newEndN - oldStartN);
+ return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN);
}
ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;
function getTypeParameterOwner(d) {
- if (d && d.kind === 148 /* TypeParameter */) {
+ if (d && d.kind === 148) {
for (var current = d; current; current = current.parent) {
- if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 236 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 236) {
return current;
}
}
@@ -11720,7 +10416,7 @@ var ts;
}
ts.getTypeParameterOwner = getTypeParameterOwner;
function isParameterPropertyDeclaration(node) {
- return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 155 /* Constructor */;
+ return ts.hasModifier(node, 92) && node.parent.kind === 155;
}
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
function isEmptyBindingPattern(node) {
@@ -11738,7 +10434,7 @@ var ts;
}
ts.isEmptyBindingElement = isEmptyBindingElement;
function walkUpBindingElementsAndPatterns(node) {
- while (node && (node.kind === 182 /* BindingElement */ || ts.isBindingPattern(node))) {
+ while (node && (node.kind === 182 || ts.isBindingPattern(node))) {
node = node.parent;
}
return node;
@@ -11746,46 +10442,35 @@ var ts;
function getCombinedModifierFlags(node) {
node = walkUpBindingElementsAndPatterns(node);
var flags = ts.getModifierFlags(node);
- if (node.kind === 232 /* VariableDeclaration */) {
+ if (node.kind === 232) {
node = node.parent;
}
- if (node && node.kind === 233 /* VariableDeclarationList */) {
+ if (node && node.kind === 233) {
flags |= ts.getModifierFlags(node);
node = node.parent;
}
- if (node && node.kind === 214 /* VariableStatement */) {
+ if (node && node.kind === 214) {
flags |= ts.getModifierFlags(node);
}
return flags;
}
ts.getCombinedModifierFlags = getCombinedModifierFlags;
- // Returns the node flags for this node and all relevant parent nodes. This is done so that
- // nodes like variable declarations and binding elements can returned a view of their flags
- // that includes the modifiers from their container. i.e. flags like export/declare aren't
- // stored on the variable declaration directly, but on the containing variable statement
- // (if it has one). Similarly, flags for let/const are store on the variable declaration
- // list. By calling this function, all those flags are combined so that the client can treat
- // the node as if it actually had those flags.
function getCombinedNodeFlags(node) {
node = walkUpBindingElementsAndPatterns(node);
var flags = node.flags;
- if (node.kind === 232 /* VariableDeclaration */) {
+ if (node.kind === 232) {
node = node.parent;
}
- if (node && node.kind === 233 /* VariableDeclarationList */) {
+ if (node && node.kind === 233) {
flags |= node.flags;
node = node.parent;
}
- if (node && node.kind === 214 /* VariableStatement */) {
+ if (node && node.kind === 214) {
flags |= node.flags;
}
return flags;
}
ts.getCombinedNodeFlags = getCombinedNodeFlags;
- /**
- * Checks to see if the locale is in the appropriate format,
- * and if it is, attempts to set the appropriate language.
- */
function validateLocaleAndSetLanguage(locale, sys, errors) {
var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase());
if (!matchResult) {
@@ -11796,12 +10481,9 @@ var ts;
}
var language = matchResult[1];
var territory = matchResult[3];
- // First try the entire locale, then fall back to just language if that's all we have.
- // Either ways do not fail, and fallback to the English diagnostic strings.
if (!trySetLanguageAndTerritory(language, territory, errors)) {
- trySetLanguageAndTerritory(language, /*territory*/ undefined, errors);
+ trySetLanguageAndTerritory(language, undefined, errors);
}
- // Set the UI locale for string collation
ts.setUILocale(locale);
function trySetLanguageAndTerritory(language, territory, errors) {
var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath());
@@ -11814,7 +10496,6 @@ var ts;
if (!sys.fileExists(filePath)) {
return false;
}
- // TODO: Add codePage support for readFile?
var fileContents = "";
try {
fileContents = sys.readFile(filePath);
@@ -11826,7 +10507,6 @@ var ts;
return false;
}
try {
- // tslint:disable-next-line no-unnecessary-qualifier (making clear this is a global mutation!)
ts.localizedDiagnosticMessages = JSON.parse(fileContents);
}
catch (_a) {
@@ -11848,13 +10528,8 @@ var ts;
return !nodeTest || nodeTest(node) ? node : undefined;
}
ts.getOriginalNode = getOriginalNode;
- /**
- * Gets a value indicating whether a node originated in the parse tree.
- *
- * @param node The node to test.
- */
function isParseTreeNode(node) {
- return (node.flags & 8 /* Synthesized */) === 0;
+ return (node.flags & 8) === 0;
}
ts.isParseTreeNode = isParseTreeNode;
function getParseTreeNode(node, nodeTest) {
@@ -11868,15 +10543,9 @@ var ts;
return undefined;
}
ts.getParseTreeNode = getParseTreeNode;
- /**
- * Remove extra underscore from escaped identifier text content.
- *
- * @param identifier The escaped identifier text.
- * @returns The unescaped identifier text.
- */
function unescapeLeadingUnderscores(identifier) {
var id = identifier;
- return id.length >= 3 && id.charCodeAt(0) === 95 /* _ */ && id.charCodeAt(1) === 95 /* _ */ && id.charCodeAt(2) === 95 /* _ */ ? id.substr(1) : id;
+ return id.length >= 3 && id.charCodeAt(0) === 95 && id.charCodeAt(1) === 95 && id.charCodeAt(2) === 95 ? id.substr(1) : id;
}
ts.unescapeLeadingUnderscores = unescapeLeadingUnderscores;
function idText(identifier) {
@@ -11887,55 +10556,42 @@ var ts;
return unescapeLeadingUnderscores(symbol.escapedName);
}
ts.symbolName = symbolName;
- /**
- * 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) {
return id;
}
ts.unescapeIdentifier = unescapeIdentifier;
- /**
- * A JSDocTypedef tag has an _optional_ name field - if a name is not directly present, we should
- * attempt to draw the name from the node the declaration is on (as that declaration is what its' symbol
- * will be merged with)
- */
function nameForNamelessJSDocTypedef(declaration) {
var hostNode = declaration.parent.parent;
if (!hostNode) {
return undefined;
}
- // Covers classes, functions - any named declaration host node
if (ts.isDeclaration(hostNode)) {
return getDeclarationIdentifier(hostNode);
}
- // Covers remaining cases
switch (hostNode.kind) {
- case 214 /* VariableStatement */:
+ case 214:
if (hostNode.declarationList && hostNode.declarationList.declarations[0]) {
return getDeclarationIdentifier(hostNode.declarationList.declarations[0]);
}
return undefined;
- case 216 /* ExpressionStatement */:
+ case 216:
var expr = hostNode.expression;
switch (expr.kind) {
- case 185 /* PropertyAccessExpression */:
+ case 185:
return expr.name;
- case 186 /* ElementAccessExpression */:
+ case 186:
var arg = expr.argumentExpression;
if (ts.isIdentifier(arg)) {
return arg;
}
}
return undefined;
- case 1 /* EndOfFileToken */:
+ case 1:
return undefined;
- case 191 /* ParenthesizedExpression */: {
+ case 191: {
return getDeclarationIdentifier(hostNode.expression);
}
- case 228 /* LabeledStatement */: {
+ case 228: {
if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) {
return getDeclarationIdentifier(hostNode.statement);
}
@@ -11953,50 +10609,48 @@ var ts;
return declaration.name || nameForNamelessJSDocTypedef(declaration);
}
ts.getNameOfJSDocTypedef = getNameOfJSDocTypedef;
- /** @internal */
function isNamedDeclaration(node) {
- return !!node.name; // A 'name' property should always be a DeclarationName.
+ return !!node.name;
}
ts.isNamedDeclaration = isNamedDeclaration;
- // TODO: GH#18217 This is often used as if it returns a defined result
function getNameOfDeclaration(declaration) {
if (!declaration) {
return undefined;
}
switch (declaration.kind) {
- case 205 /* ClassExpression */:
- case 192 /* FunctionExpression */:
+ case 205:
+ case 192:
if (!declaration.name) {
return getAssignedName(declaration);
}
break;
- case 71 /* Identifier */:
+ case 71:
return declaration;
- case 298 /* JSDocPropertyTag */:
- case 293 /* JSDocParameterTag */: {
+ case 299:
+ case 293: {
var name = declaration.name;
- if (name.kind === 146 /* QualifiedName */) {
+ if (name.kind === 146) {
return name.right;
}
break;
}
- case 200 /* BinaryExpression */: {
+ case 200: {
var expr = declaration;
switch (ts.getSpecialPropertyAssignmentKind(expr)) {
- case 1 /* ExportsProperty */:
- case 4 /* ThisProperty */:
- case 5 /* Property */:
- case 3 /* PrototypeProperty */:
+ case 1:
+ case 4:
+ case 5:
+ case 3:
return expr.left.name;
default:
return undefined;
}
}
- case 292 /* JSDocCallbackTag */:
+ case 292:
return declaration.name;
- case 297 /* JSDocTypedefTag */:
+ case 298:
return getNameOfJSDocTypedef(declaration);
- case 249 /* ExportAssignment */: {
+ case 249: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
}
@@ -12020,19 +10674,6 @@ var ts;
}
}
}
- /**
- * 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) {
if (param.name) {
if (ts.isIdentifier(param.name)) {
@@ -12048,43 +10689,34 @@ var ts;
}
}
}
- // return empty array for: out-of-order binding patterns and JSDoc function syntax, which has un-named parameters
return ts.emptyArray;
}
ts.getJSDocParameterTags = getJSDocParameterTags;
- /**
- * 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) {
return !!getFirstJSDocTag(node, ts.isJSDocParameterTag);
}
ts.hasJSDocParameterTags = hasJSDocParameterTags;
- /** Gets the JSDoc augments tag for the node if present */
function getJSDocAugmentsTag(node) {
return getFirstJSDocTag(node, ts.isJSDocAugmentsTag);
}
ts.getJSDocAugmentsTag = getJSDocAugmentsTag;
- /** Gets the JSDoc class tag for the node if present */
function getJSDocClassTag(node) {
return getFirstJSDocTag(node, ts.isJSDocClassTag);
}
ts.getJSDocClassTag = getJSDocClassTag;
- /** Gets the JSDoc return tag for the node if present */
+ function getJSDocThisTag(node) {
+ return getFirstJSDocTag(node, ts.isJSDocThisTag);
+ }
+ ts.getJSDocThisTag = getJSDocThisTag;
function getJSDocReturnTag(node) {
return getFirstJSDocTag(node, ts.isJSDocReturnTag);
}
ts.getJSDocReturnTag = getJSDocReturnTag;
- /** Gets the JSDoc template tag for the node if present */
function getJSDocTemplateTag(node) {
return getFirstJSDocTag(node, ts.isJSDocTemplateTag);
}
ts.getJSDocTemplateTag = getJSDocTemplateTag;
- /** Gets the JSDoc type tag for the node if present and valid */
function getJSDocTypeTag(node) {
- // We should have already issued an error if there were multiple type jsdocs, so just use the first one.
var tag = getFirstJSDocTag(node, ts.isJSDocTypeTag);
if (tag && tag.typeExpression && tag.typeExpression.type) {
return tag;
@@ -12092,17 +10724,6 @@ var ts;
return undefined;
}
ts.getJSDocTypeTag = getJSDocTypeTag;
- /**
- * 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) {
var tag = getFirstJSDocTag(node, ts.isJSDocTypeTag);
if (!tag && ts.isParameter(node)) {
@@ -12111,21 +10732,13 @@ var ts;
return tag && tag.typeExpression && tag.typeExpression.type;
}
ts.getJSDocType = getJSDocType;
- /**
- * 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) {
var returnTag = getJSDocReturnTag(node);
return returnTag && returnTag.typeExpression && returnTag.typeExpression.type;
}
ts.getJSDocReturnType = getJSDocReturnType;
- /** Get all JSDoc tags related to a node, including those on parent nodes. */
function getJSDocTags(node) {
var tags = node.jsDocCache;
- // If cache is 'null', that means we did the work of searching for JSDoc tags and came up with nothing.
if (tags === undefined) {
var comments = ts.getJSDocCommentsAndTags(node);
ts.Debug.assert(comments.length < 2 || comments[0] !== comments[1]);
@@ -12134,745 +10747,710 @@ var ts;
return tags;
}
ts.getJSDocTags = getJSDocTags;
- /** Get the first JSDoc tag of a specified kind, or undefined if not present. */
function getFirstJSDocTag(node, predicate) {
return ts.find(getJSDocTags(node), predicate);
}
- /** Gets all JSDoc tags of a specified kind, or undefined if not present. */
function getAllJSDocTagsOfKind(node, kind) {
return getJSDocTags(node).filter(function (doc) { return doc.kind === kind; });
}
ts.getAllJSDocTagsOfKind = getAllJSDocTagsOfKind;
})(ts || (ts = {}));
-// Simple node tests of the form `node.kind === SyntaxKind.Foo`.
(function (ts) {
- // Literals
function isNumericLiteral(node) {
- return node.kind === 8 /* NumericLiteral */;
+ return node.kind === 8;
}
ts.isNumericLiteral = isNumericLiteral;
function isStringLiteral(node) {
- return node.kind === 9 /* StringLiteral */;
+ return node.kind === 9;
}
ts.isStringLiteral = isStringLiteral;
function isJsxText(node) {
- return node.kind === 10 /* JsxText */;
+ return node.kind === 10;
}
ts.isJsxText = isJsxText;
function isRegularExpressionLiteral(node) {
- return node.kind === 12 /* RegularExpressionLiteral */;
+ return node.kind === 12;
}
ts.isRegularExpressionLiteral = isRegularExpressionLiteral;
function isNoSubstitutionTemplateLiteral(node) {
- return node.kind === 13 /* NoSubstitutionTemplateLiteral */;
+ return node.kind === 13;
}
ts.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral;
- // Pseudo-literals
function isTemplateHead(node) {
- return node.kind === 14 /* TemplateHead */;
+ return node.kind === 14;
}
ts.isTemplateHead = isTemplateHead;
function isTemplateMiddle(node) {
- return node.kind === 15 /* TemplateMiddle */;
+ return node.kind === 15;
}
ts.isTemplateMiddle = isTemplateMiddle;
function isTemplateTail(node) {
- return node.kind === 16 /* TemplateTail */;
+ return node.kind === 16;
}
ts.isTemplateTail = isTemplateTail;
function isIdentifier(node) {
- return node.kind === 71 /* Identifier */;
+ return node.kind === 71;
}
ts.isIdentifier = isIdentifier;
- // Names
function isQualifiedName(node) {
- return node.kind === 146 /* QualifiedName */;
+ return node.kind === 146;
}
ts.isQualifiedName = isQualifiedName;
function isComputedPropertyName(node) {
- return node.kind === 147 /* ComputedPropertyName */;
+ return node.kind === 147;
}
ts.isComputedPropertyName = isComputedPropertyName;
- // Signature elements
function isTypeParameterDeclaration(node) {
- return node.kind === 148 /* TypeParameter */;
+ return node.kind === 148;
}
ts.isTypeParameterDeclaration = isTypeParameterDeclaration;
function isParameter(node) {
- return node.kind === 149 /* Parameter */;
+ return node.kind === 149;
}
ts.isParameter = isParameter;
function isDecorator(node) {
- return node.kind === 150 /* Decorator */;
+ return node.kind === 150;
}
ts.isDecorator = isDecorator;
- // TypeMember
function isPropertySignature(node) {
- return node.kind === 151 /* PropertySignature */;
+ return node.kind === 151;
}
ts.isPropertySignature = isPropertySignature;
function isPropertyDeclaration(node) {
- return node.kind === 152 /* PropertyDeclaration */;
+ return node.kind === 152;
}
ts.isPropertyDeclaration = isPropertyDeclaration;
function isMethodSignature(node) {
- return node.kind === 153 /* MethodSignature */;
+ return node.kind === 153;
}
ts.isMethodSignature = isMethodSignature;
function isMethodDeclaration(node) {
- return node.kind === 154 /* MethodDeclaration */;
+ return node.kind === 154;
}
ts.isMethodDeclaration = isMethodDeclaration;
function isConstructorDeclaration(node) {
- return node.kind === 155 /* Constructor */;
+ return node.kind === 155;
}
ts.isConstructorDeclaration = isConstructorDeclaration;
function isGetAccessorDeclaration(node) {
- return node.kind === 156 /* GetAccessor */;
+ return node.kind === 156;
}
ts.isGetAccessorDeclaration = isGetAccessorDeclaration;
function isSetAccessorDeclaration(node) {
- return node.kind === 157 /* SetAccessor */;
+ return node.kind === 157;
}
ts.isSetAccessorDeclaration = isSetAccessorDeclaration;
function isCallSignatureDeclaration(node) {
- return node.kind === 158 /* CallSignature */;
+ return node.kind === 158;
}
ts.isCallSignatureDeclaration = isCallSignatureDeclaration;
function isConstructSignatureDeclaration(node) {
- return node.kind === 159 /* ConstructSignature */;
+ return node.kind === 159;
}
ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration;
function isIndexSignatureDeclaration(node) {
- return node.kind === 160 /* IndexSignature */;
+ return node.kind === 160;
}
ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration;
- /* @internal */
function isGetOrSetAccessorDeclaration(node) {
- return node.kind === 157 /* SetAccessor */ || node.kind === 156 /* GetAccessor */;
+ return node.kind === 157 || node.kind === 156;
}
ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration;
- // Type
function isTypePredicateNode(node) {
- return node.kind === 161 /* TypePredicate */;
+ return node.kind === 161;
}
ts.isTypePredicateNode = isTypePredicateNode;
function isTypeReferenceNode(node) {
- return node.kind === 162 /* TypeReference */;
+ return node.kind === 162;
}
ts.isTypeReferenceNode = isTypeReferenceNode;
function isFunctionTypeNode(node) {
- return node.kind === 163 /* FunctionType */;
+ return node.kind === 163;
}
ts.isFunctionTypeNode = isFunctionTypeNode;
function isConstructorTypeNode(node) {
- return node.kind === 164 /* ConstructorType */;
+ return node.kind === 164;
}
ts.isConstructorTypeNode = isConstructorTypeNode;
function isTypeQueryNode(node) {
- return node.kind === 165 /* TypeQuery */;
+ return node.kind === 165;
}
ts.isTypeQueryNode = isTypeQueryNode;
function isTypeLiteralNode(node) {
- return node.kind === 166 /* TypeLiteral */;
+ return node.kind === 166;
}
ts.isTypeLiteralNode = isTypeLiteralNode;
function isArrayTypeNode(node) {
- return node.kind === 167 /* ArrayType */;
+ return node.kind === 167;
}
ts.isArrayTypeNode = isArrayTypeNode;
function isTupleTypeNode(node) {
- return node.kind === 168 /* TupleType */;
+ return node.kind === 168;
}
ts.isTupleTypeNode = isTupleTypeNode;
function isUnionTypeNode(node) {
- return node.kind === 169 /* UnionType */;
+ return node.kind === 169;
}
ts.isUnionTypeNode = isUnionTypeNode;
function isIntersectionTypeNode(node) {
- return node.kind === 170 /* IntersectionType */;
+ return node.kind === 170;
}
ts.isIntersectionTypeNode = isIntersectionTypeNode;
function isConditionalTypeNode(node) {
- return node.kind === 171 /* ConditionalType */;
+ return node.kind === 171;
}
ts.isConditionalTypeNode = isConditionalTypeNode;
function isInferTypeNode(node) {
- return node.kind === 172 /* InferType */;
+ return node.kind === 172;
}
ts.isInferTypeNode = isInferTypeNode;
function isParenthesizedTypeNode(node) {
- return node.kind === 173 /* ParenthesizedType */;
+ return node.kind === 173;
}
ts.isParenthesizedTypeNode = isParenthesizedTypeNode;
function isThisTypeNode(node) {
- return node.kind === 174 /* ThisType */;
+ return node.kind === 174;
}
ts.isThisTypeNode = isThisTypeNode;
function isTypeOperatorNode(node) {
- return node.kind === 175 /* TypeOperator */;
+ return node.kind === 175;
}
ts.isTypeOperatorNode = isTypeOperatorNode;
function isIndexedAccessTypeNode(node) {
- return node.kind === 176 /* IndexedAccessType */;
+ return node.kind === 176;
}
ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode;
function isMappedTypeNode(node) {
- return node.kind === 177 /* MappedType */;
+ return node.kind === 177;
}
ts.isMappedTypeNode = isMappedTypeNode;
function isLiteralTypeNode(node) {
- return node.kind === 178 /* LiteralType */;
+ return node.kind === 178;
}
ts.isLiteralTypeNode = isLiteralTypeNode;
function isImportTypeNode(node) {
- return node.kind === 179 /* ImportType */;
+ return node.kind === 179;
}
ts.isImportTypeNode = isImportTypeNode;
- // Binding patterns
function isObjectBindingPattern(node) {
- return node.kind === 180 /* ObjectBindingPattern */;
+ return node.kind === 180;
}
ts.isObjectBindingPattern = isObjectBindingPattern;
function isArrayBindingPattern(node) {
- return node.kind === 181 /* ArrayBindingPattern */;
+ return node.kind === 181;
}
ts.isArrayBindingPattern = isArrayBindingPattern;
function isBindingElement(node) {
- return node.kind === 182 /* BindingElement */;
+ return node.kind === 182;
}
ts.isBindingElement = isBindingElement;
- // Expression
function isArrayLiteralExpression(node) {
- return node.kind === 183 /* ArrayLiteralExpression */;
+ return node.kind === 183;
}
ts.isArrayLiteralExpression = isArrayLiteralExpression;
function isObjectLiteralExpression(node) {
- return node.kind === 184 /* ObjectLiteralExpression */;
+ return node.kind === 184;
}
ts.isObjectLiteralExpression = isObjectLiteralExpression;
function isPropertyAccessExpression(node) {
- return node.kind === 185 /* PropertyAccessExpression */;
+ return node.kind === 185;
}
ts.isPropertyAccessExpression = isPropertyAccessExpression;
function isElementAccessExpression(node) {
- return node.kind === 186 /* ElementAccessExpression */;
+ return node.kind === 186;
}
ts.isElementAccessExpression = isElementAccessExpression;
function isCallExpression(node) {
- return node.kind === 187 /* CallExpression */;
+ return node.kind === 187;
}
ts.isCallExpression = isCallExpression;
function isNewExpression(node) {
- return node.kind === 188 /* NewExpression */;
+ return node.kind === 188;
}
ts.isNewExpression = isNewExpression;
function isTaggedTemplateExpression(node) {
- return node.kind === 189 /* TaggedTemplateExpression */;
+ return node.kind === 189;
}
ts.isTaggedTemplateExpression = isTaggedTemplateExpression;
function isTypeAssertion(node) {
- return node.kind === 190 /* TypeAssertionExpression */;
+ return node.kind === 190;
}
ts.isTypeAssertion = isTypeAssertion;
function isParenthesizedExpression(node) {
- return node.kind === 191 /* ParenthesizedExpression */;
+ return node.kind === 191;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 301 /* PartiallyEmittedExpression */) {
+ while (node.kind === 302) {
node = node.expression;
}
return node;
}
ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;
function isFunctionExpression(node) {
- return node.kind === 192 /* FunctionExpression */;
+ return node.kind === 192;
}
ts.isFunctionExpression = isFunctionExpression;
function isArrowFunction(node) {
- return node.kind === 193 /* ArrowFunction */;
+ return node.kind === 193;
}
ts.isArrowFunction = isArrowFunction;
function isDeleteExpression(node) {
- return node.kind === 194 /* DeleteExpression */;
+ return node.kind === 194;
}
ts.isDeleteExpression = isDeleteExpression;
function isTypeOfExpression(node) {
- return node.kind === 195 /* TypeOfExpression */;
+ return node.kind === 195;
}
ts.isTypeOfExpression = isTypeOfExpression;
function isVoidExpression(node) {
- return node.kind === 196 /* VoidExpression */;
+ return node.kind === 196;
}
ts.isVoidExpression = isVoidExpression;
function isAwaitExpression(node) {
- return node.kind === 197 /* AwaitExpression */;
+ return node.kind === 197;
}
ts.isAwaitExpression = isAwaitExpression;
function isPrefixUnaryExpression(node) {
- return node.kind === 198 /* PrefixUnaryExpression */;
+ return node.kind === 198;
}
ts.isPrefixUnaryExpression = isPrefixUnaryExpression;
function isPostfixUnaryExpression(node) {
- return node.kind === 199 /* PostfixUnaryExpression */;
+ return node.kind === 199;
}
ts.isPostfixUnaryExpression = isPostfixUnaryExpression;
function isBinaryExpression(node) {
- return node.kind === 200 /* BinaryExpression */;
+ return node.kind === 200;
}
ts.isBinaryExpression = isBinaryExpression;
function isConditionalExpression(node) {
- return node.kind === 201 /* ConditionalExpression */;
+ return node.kind === 201;
}
ts.isConditionalExpression = isConditionalExpression;
function isTemplateExpression(node) {
- return node.kind === 202 /* TemplateExpression */;
+ return node.kind === 202;
}
ts.isTemplateExpression = isTemplateExpression;
function isYieldExpression(node) {
- return node.kind === 203 /* YieldExpression */;
+ return node.kind === 203;
}
ts.isYieldExpression = isYieldExpression;
function isSpreadElement(node) {
- return node.kind === 204 /* SpreadElement */;
+ return node.kind === 204;
}
ts.isSpreadElement = isSpreadElement;
function isClassExpression(node) {
- return node.kind === 205 /* ClassExpression */;
+ return node.kind === 205;
}
ts.isClassExpression = isClassExpression;
function isOmittedExpression(node) {
- return node.kind === 206 /* OmittedExpression */;
+ return node.kind === 206;
}
ts.isOmittedExpression = isOmittedExpression;
function isExpressionWithTypeArguments(node) {
- return node.kind === 207 /* ExpressionWithTypeArguments */;
+ return node.kind === 207;
}
ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;
function isAsExpression(node) {
- return node.kind === 208 /* AsExpression */;
+ return node.kind === 208;
}
ts.isAsExpression = isAsExpression;
function isNonNullExpression(node) {
- return node.kind === 209 /* NonNullExpression */;
+ return node.kind === 209;
}
ts.isNonNullExpression = isNonNullExpression;
function isMetaProperty(node) {
- return node.kind === 210 /* MetaProperty */;
+ return node.kind === 210;
}
ts.isMetaProperty = isMetaProperty;
- // Misc
function isTemplateSpan(node) {
- return node.kind === 211 /* TemplateSpan */;
+ return node.kind === 211;
}
ts.isTemplateSpan = isTemplateSpan;
function isSemicolonClassElement(node) {
- return node.kind === 212 /* SemicolonClassElement */;
+ return node.kind === 212;
}
ts.isSemicolonClassElement = isSemicolonClassElement;
- // Block
function isBlock(node) {
- return node.kind === 213 /* Block */;
+ return node.kind === 213;
}
ts.isBlock = isBlock;
function isVariableStatement(node) {
- return node.kind === 214 /* VariableStatement */;
+ return node.kind === 214;
}
ts.isVariableStatement = isVariableStatement;
function isEmptyStatement(node) {
- return node.kind === 215 /* EmptyStatement */;
+ return node.kind === 215;
}
ts.isEmptyStatement = isEmptyStatement;
function isExpressionStatement(node) {
- return node.kind === 216 /* ExpressionStatement */;
+ return node.kind === 216;
}
ts.isExpressionStatement = isExpressionStatement;
function isIfStatement(node) {
- return node.kind === 217 /* IfStatement */;
+ return node.kind === 217;
}
ts.isIfStatement = isIfStatement;
function isDoStatement(node) {
- return node.kind === 218 /* DoStatement */;
+ return node.kind === 218;
}
ts.isDoStatement = isDoStatement;
function isWhileStatement(node) {
- return node.kind === 219 /* WhileStatement */;
+ return node.kind === 219;
}
ts.isWhileStatement = isWhileStatement;
function isForStatement(node) {
- return node.kind === 220 /* ForStatement */;
+ return node.kind === 220;
}
ts.isForStatement = isForStatement;
function isForInStatement(node) {
- return node.kind === 221 /* ForInStatement */;
+ return node.kind === 221;
}
ts.isForInStatement = isForInStatement;
function isForOfStatement(node) {
- return node.kind === 222 /* ForOfStatement */;
+ return node.kind === 222;
}
ts.isForOfStatement = isForOfStatement;
function isContinueStatement(node) {
- return node.kind === 223 /* ContinueStatement */;
+ return node.kind === 223;
}
ts.isContinueStatement = isContinueStatement;
function isBreakStatement(node) {
- return node.kind === 224 /* BreakStatement */;
+ return node.kind === 224;
}
ts.isBreakStatement = isBreakStatement;
function isBreakOrContinueStatement(node) {
- return node.kind === 224 /* BreakStatement */ || node.kind === 223 /* ContinueStatement */;
+ return node.kind === 224 || node.kind === 223;
}
ts.isBreakOrContinueStatement = isBreakOrContinueStatement;
function isReturnStatement(node) {
- return node.kind === 225 /* ReturnStatement */;
+ return node.kind === 225;
}
ts.isReturnStatement = isReturnStatement;
function isWithStatement(node) {
- return node.kind === 226 /* WithStatement */;
+ return node.kind === 226;
}
ts.isWithStatement = isWithStatement;
function isSwitchStatement(node) {
- return node.kind === 227 /* SwitchStatement */;
+ return node.kind === 227;
}
ts.isSwitchStatement = isSwitchStatement;
function isLabeledStatement(node) {
- return node.kind === 228 /* LabeledStatement */;
+ return node.kind === 228;
}
ts.isLabeledStatement = isLabeledStatement;
function isThrowStatement(node) {
- return node.kind === 229 /* ThrowStatement */;
+ return node.kind === 229;
}
ts.isThrowStatement = isThrowStatement;
function isTryStatement(node) {
- return node.kind === 230 /* TryStatement */;
+ return node.kind === 230;
}
ts.isTryStatement = isTryStatement;
function isDebuggerStatement(node) {
- return node.kind === 231 /* DebuggerStatement */;
+ return node.kind === 231;
}
ts.isDebuggerStatement = isDebuggerStatement;
function isVariableDeclaration(node) {
- return node.kind === 232 /* VariableDeclaration */;
+ return node.kind === 232;
}
ts.isVariableDeclaration = isVariableDeclaration;
function isVariableDeclarationList(node) {
- return node.kind === 233 /* VariableDeclarationList */;
+ return node.kind === 233;
}
ts.isVariableDeclarationList = isVariableDeclarationList;
function isFunctionDeclaration(node) {
- return node.kind === 234 /* FunctionDeclaration */;
+ return node.kind === 234;
}
ts.isFunctionDeclaration = isFunctionDeclaration;
function isClassDeclaration(node) {
- return node.kind === 235 /* ClassDeclaration */;
+ return node.kind === 235;
}
ts.isClassDeclaration = isClassDeclaration;
function isInterfaceDeclaration(node) {
- return node.kind === 236 /* InterfaceDeclaration */;
+ return node.kind === 236;
}
ts.isInterfaceDeclaration = isInterfaceDeclaration;
function isTypeAliasDeclaration(node) {
- return node.kind === 237 /* TypeAliasDeclaration */;
+ return node.kind === 237;
}
ts.isTypeAliasDeclaration = isTypeAliasDeclaration;
function isEnumDeclaration(node) {
- return node.kind === 238 /* EnumDeclaration */;
+ return node.kind === 238;
}
ts.isEnumDeclaration = isEnumDeclaration;
function isModuleDeclaration(node) {
- return node.kind === 239 /* ModuleDeclaration */;
+ return node.kind === 239;
}
ts.isModuleDeclaration = isModuleDeclaration;
function isModuleBlock(node) {
- return node.kind === 240 /* ModuleBlock */;
+ return node.kind === 240;
}
ts.isModuleBlock = isModuleBlock;
function isCaseBlock(node) {
- return node.kind === 241 /* CaseBlock */;
+ return node.kind === 241;
}
ts.isCaseBlock = isCaseBlock;
function isNamespaceExportDeclaration(node) {
- return node.kind === 242 /* NamespaceExportDeclaration */;
+ return node.kind === 242;
}
ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration;
function isImportEqualsDeclaration(node) {
- return node.kind === 243 /* ImportEqualsDeclaration */;
+ return node.kind === 243;
}
ts.isImportEqualsDeclaration = isImportEqualsDeclaration;
function isImportDeclaration(node) {
- return node.kind === 244 /* ImportDeclaration */;
+ return node.kind === 244;
}
ts.isImportDeclaration = isImportDeclaration;
function isImportClause(node) {
- return node.kind === 245 /* ImportClause */;
+ return node.kind === 245;
}
ts.isImportClause = isImportClause;
function isNamespaceImport(node) {
- return node.kind === 246 /* NamespaceImport */;
+ return node.kind === 246;
}
ts.isNamespaceImport = isNamespaceImport;
function isNamedImports(node) {
- return node.kind === 247 /* NamedImports */;
+ return node.kind === 247;
}
ts.isNamedImports = isNamedImports;
function isImportSpecifier(node) {
- return node.kind === 248 /* ImportSpecifier */;
+ return node.kind === 248;
}
ts.isImportSpecifier = isImportSpecifier;
function isExportAssignment(node) {
- return node.kind === 249 /* ExportAssignment */;
+ return node.kind === 249;
}
ts.isExportAssignment = isExportAssignment;
function isExportDeclaration(node) {
- return node.kind === 250 /* ExportDeclaration */;
+ return node.kind === 250;
}
ts.isExportDeclaration = isExportDeclaration;
function isNamedExports(node) {
- return node.kind === 251 /* NamedExports */;
+ return node.kind === 251;
}
ts.isNamedExports = isNamedExports;
function isExportSpecifier(node) {
- return node.kind === 252 /* ExportSpecifier */;
+ return node.kind === 252;
}
ts.isExportSpecifier = isExportSpecifier;
function isMissingDeclaration(node) {
- return node.kind === 253 /* MissingDeclaration */;
+ return node.kind === 253;
}
ts.isMissingDeclaration = isMissingDeclaration;
- // Module References
function isExternalModuleReference(node) {
- return node.kind === 254 /* ExternalModuleReference */;
+ return node.kind === 254;
}
ts.isExternalModuleReference = isExternalModuleReference;
- // JSX
function isJsxElement(node) {
- return node.kind === 255 /* JsxElement */;
+ return node.kind === 255;
}
ts.isJsxElement = isJsxElement;
function isJsxSelfClosingElement(node) {
- return node.kind === 256 /* JsxSelfClosingElement */;
+ return node.kind === 256;
}
ts.isJsxSelfClosingElement = isJsxSelfClosingElement;
function isJsxOpeningElement(node) {
- return node.kind === 257 /* JsxOpeningElement */;
+ return node.kind === 257;
}
ts.isJsxOpeningElement = isJsxOpeningElement;
function isJsxClosingElement(node) {
- return node.kind === 258 /* JsxClosingElement */;
+ return node.kind === 258;
}
ts.isJsxClosingElement = isJsxClosingElement;
function isJsxFragment(node) {
- return node.kind === 259 /* JsxFragment */;
+ return node.kind === 259;
}
ts.isJsxFragment = isJsxFragment;
function isJsxOpeningFragment(node) {
- return node.kind === 260 /* JsxOpeningFragment */;
+ return node.kind === 260;
}
ts.isJsxOpeningFragment = isJsxOpeningFragment;
function isJsxClosingFragment(node) {
- return node.kind === 261 /* JsxClosingFragment */;
+ return node.kind === 261;
}
ts.isJsxClosingFragment = isJsxClosingFragment;
function isJsxAttribute(node) {
- return node.kind === 262 /* JsxAttribute */;
+ return node.kind === 262;
}
ts.isJsxAttribute = isJsxAttribute;
function isJsxAttributes(node) {
- return node.kind === 263 /* JsxAttributes */;
+ return node.kind === 263;
}
ts.isJsxAttributes = isJsxAttributes;
function isJsxSpreadAttribute(node) {
- return node.kind === 264 /* JsxSpreadAttribute */;
+ return node.kind === 264;
}
ts.isJsxSpreadAttribute = isJsxSpreadAttribute;
function isJsxExpression(node) {
- return node.kind === 265 /* JsxExpression */;
+ return node.kind === 265;
}
ts.isJsxExpression = isJsxExpression;
- // Clauses
function isCaseClause(node) {
- return node.kind === 266 /* CaseClause */;
+ return node.kind === 266;
}
ts.isCaseClause = isCaseClause;
function isDefaultClause(node) {
- return node.kind === 267 /* DefaultClause */;
+ return node.kind === 267;
}
ts.isDefaultClause = isDefaultClause;
function isHeritageClause(node) {
- return node.kind === 268 /* HeritageClause */;
+ return node.kind === 268;
}
ts.isHeritageClause = isHeritageClause;
function isCatchClause(node) {
- return node.kind === 269 /* CatchClause */;
+ return node.kind === 269;
}
ts.isCatchClause = isCatchClause;
- // Property assignments
function isPropertyAssignment(node) {
- return node.kind === 270 /* PropertyAssignment */;
+ return node.kind === 270;
}
ts.isPropertyAssignment = isPropertyAssignment;
function isShorthandPropertyAssignment(node) {
- return node.kind === 271 /* ShorthandPropertyAssignment */;
+ return node.kind === 271;
}
ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;
function isSpreadAssignment(node) {
- return node.kind === 272 /* SpreadAssignment */;
+ return node.kind === 272;
}
ts.isSpreadAssignment = isSpreadAssignment;
- // Enum
function isEnumMember(node) {
- return node.kind === 273 /* EnumMember */;
+ return node.kind === 273;
}
ts.isEnumMember = isEnumMember;
- // Top-level nodes
function isSourceFile(node) {
- return node.kind === 274 /* SourceFile */;
+ return node.kind === 274;
}
ts.isSourceFile = isSourceFile;
function isBundle(node) {
- return node.kind === 275 /* Bundle */;
+ return node.kind === 275;
}
ts.isBundle = isBundle;
function isUnparsedSource(node) {
- return node.kind === 276 /* UnparsedSource */;
+ return node.kind === 276;
}
ts.isUnparsedSource = isUnparsedSource;
- // JSDoc
function isJSDocTypeExpression(node) {
- return node.kind === 278 /* JSDocTypeExpression */;
+ return node.kind === 278;
}
ts.isJSDocTypeExpression = isJSDocTypeExpression;
function isJSDocAllType(node) {
- return node.kind === 279 /* JSDocAllType */;
+ return node.kind === 279;
}
ts.isJSDocAllType = isJSDocAllType;
function isJSDocUnknownType(node) {
- return node.kind === 280 /* JSDocUnknownType */;
+ return node.kind === 280;
}
ts.isJSDocUnknownType = isJSDocUnknownType;
function isJSDocNullableType(node) {
- return node.kind === 281 /* JSDocNullableType */;
+ return node.kind === 281;
}
ts.isJSDocNullableType = isJSDocNullableType;
function isJSDocNonNullableType(node) {
- return node.kind === 282 /* JSDocNonNullableType */;
+ return node.kind === 282;
}
ts.isJSDocNonNullableType = isJSDocNonNullableType;
function isJSDocOptionalType(node) {
- return node.kind === 283 /* JSDocOptionalType */;
+ return node.kind === 283;
}
ts.isJSDocOptionalType = isJSDocOptionalType;
function isJSDocFunctionType(node) {
- return node.kind === 284 /* JSDocFunctionType */;
+ return node.kind === 284;
}
ts.isJSDocFunctionType = isJSDocFunctionType;
function isJSDocVariadicType(node) {
- return node.kind === 285 /* JSDocVariadicType */;
+ return node.kind === 285;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 286 /* JSDocComment */;
+ return node.kind === 286;
}
ts.isJSDoc = isJSDoc;
function isJSDocAugmentsTag(node) {
- return node.kind === 290 /* JSDocAugmentsTag */;
+ return node.kind === 290;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 291 /* JSDocClassTag */;
+ return node.kind === 291;
}
ts.isJSDocClassTag = isJSDocClassTag;
+ function isJSDocThisTag(node) {
+ return node.kind === 295;
+ }
+ ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 293 /* JSDocParameterTag */;
+ return node.kind === 293;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 294 /* JSDocReturnTag */;
+ return node.kind === 294;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 295 /* JSDocTypeTag */;
+ return node.kind === 296;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 296 /* JSDocTemplateTag */;
+ return node.kind === 297;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 297 /* JSDocTypedefTag */;
+ return node.kind === 298;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 298 /* JSDocPropertyTag */;
+ return node.kind === 299;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 298 /* JSDocPropertyTag */ || node.kind === 293 /* JSDocParameterTag */;
+ return node.kind === 299 || node.kind === 293;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 287 /* JSDocTypeLiteral */;
+ return node.kind === 287;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 292 /* JSDocCallbackTag */;
+ return node.kind === 292;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 288 /* JSDocSignature */;
+ return node.kind === 288;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
-// Node tests
-//
-// All node tests in the following list should *not* reference parent pointers so that
-// they may be used with transformations.
(function (ts) {
- /* @internal */
function isSyntaxList(n) {
- return n.kind === 299 /* SyntaxList */;
+ return n.kind === 300;
}
ts.isSyntaxList = isSyntaxList;
- /* @internal */
function isNode(node) {
return isNodeKind(node.kind);
}
ts.isNode = isNode;
- /* @internal */
function isNodeKind(kind) {
- return kind >= 146 /* FirstNode */;
+ return kind >= 146;
}
ts.isNodeKind = isNodeKind;
- /**
- * 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) {
- return n.kind >= 0 /* FirstToken */ && n.kind <= 145 /* LastToken */;
+ return n.kind >= 0 && n.kind <= 145;
}
ts.isToken = isToken;
- // Node Arrays
- /* @internal */
function isNodeArray(array) {
return array.hasOwnProperty("pos") && array.hasOwnProperty("end");
}
ts.isNodeArray = isNodeArray;
- // Literals
- /* @internal */
function isLiteralKind(kind) {
- return 8 /* FirstLiteralToken */ <= kind && kind <= 13 /* LastLiteralToken */;
+ return 8 <= kind && kind <= 13;
}
ts.isLiteralKind = isLiteralKind;
function isLiteralExpression(node) {
return isLiteralKind(node.kind);
}
ts.isLiteralExpression = isLiteralExpression;
- // Pseudo-literals
- /* @internal */
function isTemplateLiteralKind(kind) {
- return 13 /* FirstTemplateToken */ <= kind && kind <= 16 /* LastTemplateToken */;
+ return 13 <= kind && kind <= 16;
}
ts.isTemplateLiteralKind = isTemplateLiteralKind;
function isTemplateLiteralToken(node) {
@@ -12881,48 +11459,42 @@ var ts;
ts.isTemplateLiteralToken = isTemplateLiteralToken;
function isTemplateMiddleOrTemplateTail(node) {
var kind = node.kind;
- return kind === 15 /* TemplateMiddle */
- || kind === 16 /* TemplateTail */;
+ return kind === 15
+ || kind === 16;
}
ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail;
function isStringTextContainingNode(node) {
- return node.kind === 9 /* StringLiteral */ || isTemplateLiteralKind(node.kind);
+ return node.kind === 9 || isTemplateLiteralKind(node.kind);
}
ts.isStringTextContainingNode = isStringTextContainingNode;
- // Identifiers
- /* @internal */
function isGeneratedIdentifier(node) {
- return ts.isIdentifier(node) && (node.autoGenerateFlags & 7 /* KindMask */) > 0 /* None */;
+ return ts.isIdentifier(node) && (node.autoGenerateFlags & 7) > 0;
}
ts.isGeneratedIdentifier = isGeneratedIdentifier;
- // Keywords
- /* @internal */
function isModifierKind(token) {
switch (token) {
- case 117 /* AbstractKeyword */:
- case 120 /* AsyncKeyword */:
- case 76 /* ConstKeyword */:
- case 124 /* DeclareKeyword */:
- case 79 /* DefaultKeyword */:
- case 84 /* ExportKeyword */:
- case 114 /* PublicKeyword */:
- case 112 /* PrivateKeyword */:
- case 113 /* ProtectedKeyword */:
- case 132 /* ReadonlyKeyword */:
- case 115 /* StaticKeyword */:
+ case 117:
+ case 120:
+ case 76:
+ case 124:
+ case 79:
+ case 84:
+ case 114:
+ case 112:
+ case 113:
+ case 132:
+ case 115:
return true;
}
return false;
}
ts.isModifierKind = isModifierKind;
- /* @internal */
function isParameterPropertyModifier(kind) {
- return !!(ts.modifierToFlag(kind) & 92 /* ParameterPropertyModifier */);
+ return !!(ts.modifierToFlag(kind) & 92);
}
ts.isParameterPropertyModifier = isParameterPropertyModifier;
- /* @internal */
function isClassMemberModifier(idToken) {
- return isParameterPropertyModifier(idToken) || idToken === 115 /* StaticKeyword */;
+ return isParameterPropertyModifier(idToken) || idToken === 115;
}
ts.isClassMemberModifier = isClassMemberModifier;
function isModifier(node) {
@@ -12931,111 +11503,104 @@ var ts;
ts.isModifier = isModifier;
function isEntityName(node) {
var kind = node.kind;
- return kind === 146 /* QualifiedName */
- || kind === 71 /* Identifier */;
+ return kind === 146
+ || kind === 71;
}
ts.isEntityName = isEntityName;
function isPropertyName(node) {
var kind = node.kind;
- return kind === 71 /* Identifier */
- || kind === 9 /* StringLiteral */
- || kind === 8 /* NumericLiteral */
- || kind === 147 /* ComputedPropertyName */;
+ return kind === 71
+ || kind === 9
+ || kind === 8
+ || kind === 147;
}
ts.isPropertyName = isPropertyName;
function isBindingName(node) {
var kind = node.kind;
- return kind === 71 /* Identifier */
- || kind === 180 /* ObjectBindingPattern */
- || kind === 181 /* ArrayBindingPattern */;
+ return kind === 71
+ || kind === 180
+ || kind === 181;
}
ts.isBindingName = isBindingName;
- // Functions
function isFunctionLike(node) {
return node && isFunctionLikeKind(node.kind);
}
ts.isFunctionLike = isFunctionLike;
- /* @internal */
function isFunctionLikeDeclaration(node) {
return node && isFunctionLikeDeclarationKind(node.kind);
}
ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration;
function isFunctionLikeDeclarationKind(kind) {
switch (kind) {
- case 234 /* FunctionDeclaration */:
- case 154 /* MethodDeclaration */:
- case 155 /* Constructor */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
- case 192 /* FunctionExpression */:
- case 193 /* ArrowFunction */:
+ case 234:
+ case 154:
+ case 155:
+ case 156:
+ case 157:
+ case 192:
+ case 193:
return true;
default:
return false;
}
}
- /* @internal */
function isFunctionLikeKind(kind) {
switch (kind) {
- case 153 /* MethodSignature */:
- case 158 /* CallSignature */:
- case 288 /* JSDocSignature */:
- case 159 /* ConstructSignature */:
- case 160 /* IndexSignature */:
- case 163 /* FunctionType */:
- case 284 /* JSDocFunctionType */:
- case 164 /* ConstructorType */:
+ case 153:
+ case 158:
+ case 288:
+ case 159:
+ case 160:
+ case 163:
+ case 284:
+ case 164:
return true;
default:
return isFunctionLikeDeclarationKind(kind);
}
}
ts.isFunctionLikeKind = isFunctionLikeKind;
- /* @internal */
function isFunctionOrModuleBlock(node) {
return ts.isSourceFile(node) || ts.isModuleBlock(node) || ts.isBlock(node) && isFunctionLike(node.parent);
}
ts.isFunctionOrModuleBlock = isFunctionOrModuleBlock;
- // Classes
function isClassElement(node) {
var kind = node.kind;
- return kind === 155 /* Constructor */
- || kind === 152 /* PropertyDeclaration */
- || kind === 154 /* MethodDeclaration */
- || kind === 156 /* GetAccessor */
- || kind === 157 /* SetAccessor */
- || kind === 160 /* IndexSignature */
- || kind === 212 /* SemicolonClassElement */;
+ return kind === 155
+ || kind === 152
+ || kind === 154
+ || kind === 156
+ || kind === 157
+ || kind === 160
+ || kind === 212;
}
ts.isClassElement = isClassElement;
function isClassLike(node) {
- return node && (node.kind === 235 /* ClassDeclaration */ || node.kind === 205 /* ClassExpression */);
+ return node && (node.kind === 235 || node.kind === 205);
}
ts.isClassLike = isClassLike;
function isAccessor(node) {
- return node && (node.kind === 156 /* GetAccessor */ || node.kind === 157 /* SetAccessor */);
+ return node && (node.kind === 156 || node.kind === 157);
}
ts.isAccessor = isAccessor;
- /* @internal */
function isMethodOrAccessor(node) {
switch (node.kind) {
- case 154 /* MethodDeclaration */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
+ case 154:
+ case 156:
+ case 157:
return true;
default:
return false;
}
}
ts.isMethodOrAccessor = isMethodOrAccessor;
- // Type members
function isTypeElement(node) {
var kind = node.kind;
- return kind === 159 /* ConstructSignature */
- || kind === 158 /* CallSignature */
- || kind === 151 /* PropertySignature */
- || kind === 153 /* MethodSignature */
- || kind === 160 /* IndexSignature */;
+ return kind === 159
+ || kind === 158
+ || kind === 151
+ || kind === 153
+ || kind === 160;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
@@ -13044,153 +11609,125 @@ var ts;
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
- return kind === 270 /* PropertyAssignment */
- || kind === 271 /* ShorthandPropertyAssignment */
- || kind === 272 /* SpreadAssignment */
- || kind === 154 /* MethodDeclaration */
- || kind === 156 /* GetAccessor */
- || kind === 157 /* SetAccessor */;
+ return kind === 270
+ || kind === 271
+ || kind === 272
+ || kind === 154
+ || kind === 156
+ || kind === 157;
}
ts.isObjectLiteralElementLike = isObjectLiteralElementLike;
- // Type
function isTypeNodeKind(kind) {
- return (kind >= 161 /* FirstTypeNode */ && kind <= 179 /* LastTypeNode */)
- || kind === 119 /* AnyKeyword */
- || kind === 142 /* UnknownKeyword */
- || kind === 134 /* NumberKeyword */
- || kind === 135 /* ObjectKeyword */
- || kind === 122 /* BooleanKeyword */
- || kind === 137 /* StringKeyword */
- || kind === 138 /* SymbolKeyword */
- || kind === 99 /* ThisKeyword */
- || kind === 105 /* VoidKeyword */
- || kind === 140 /* UndefinedKeyword */
- || kind === 95 /* NullKeyword */
- || kind === 131 /* NeverKeyword */
- || kind === 207 /* ExpressionWithTypeArguments */
- || kind === 279 /* JSDocAllType */
- || kind === 280 /* JSDocUnknownType */
- || kind === 281 /* JSDocNullableType */
- || kind === 282 /* JSDocNonNullableType */
- || kind === 283 /* JSDocOptionalType */
- || kind === 284 /* JSDocFunctionType */
- || kind === 285 /* JSDocVariadicType */;
+ return (kind >= 161 && kind <= 179)
+ || kind === 119
+ || kind === 142
+ || kind === 134
+ || kind === 135
+ || kind === 122
+ || kind === 137
+ || kind === 138
+ || kind === 99
+ || kind === 105
+ || kind === 140
+ || kind === 95
+ || kind === 131
+ || kind === 207
+ || kind === 279
+ || kind === 280
+ || kind === 281
+ || kind === 282
+ || kind === 283
+ || kind === 284
+ || kind === 285;
}
- /**
- * 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) {
return isTypeNodeKind(node.kind);
}
ts.isTypeNode = isTypeNode;
function isFunctionOrConstructorTypeNode(node) {
switch (node.kind) {
- case 163 /* FunctionType */:
- case 164 /* ConstructorType */:
+ case 163:
+ case 164:
return true;
}
return false;
}
ts.isFunctionOrConstructorTypeNode = isFunctionOrConstructorTypeNode;
- // Binding patterns
- /* @internal */
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
- return kind === 181 /* ArrayBindingPattern */
- || kind === 180 /* ObjectBindingPattern */;
+ return kind === 181
+ || kind === 180;
}
return false;
}
ts.isBindingPattern = isBindingPattern;
- /* @internal */
function isAssignmentPattern(node) {
var kind = node.kind;
- return kind === 183 /* ArrayLiteralExpression */
- || kind === 184 /* ObjectLiteralExpression */;
+ return kind === 183
+ || kind === 184;
}
ts.isAssignmentPattern = isAssignmentPattern;
- /* @internal */
function isArrayBindingElement(node) {
var kind = node.kind;
- return kind === 182 /* BindingElement */
- || kind === 206 /* OmittedExpression */;
+ return kind === 182
+ || kind === 206;
}
ts.isArrayBindingElement = isArrayBindingElement;
- /**
- * Determines whether the BindingOrAssignmentElement is a BindingElement-like declaration
- */
- /* @internal */
function isDeclarationBindingElement(bindingElement) {
switch (bindingElement.kind) {
- case 232 /* VariableDeclaration */:
- case 149 /* Parameter */:
- case 182 /* BindingElement */:
+ case 232:
+ case 149:
+ case 182:
return true;
}
return false;
}
ts.isDeclarationBindingElement = isDeclarationBindingElement;
- /**
- * Determines whether a node is a BindingOrAssignmentPattern
- */
- /* @internal */
function isBindingOrAssignmentPattern(node) {
return isObjectBindingOrAssignmentPattern(node)
|| isArrayBindingOrAssignmentPattern(node);
}
ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern;
- /**
- * Determines whether a node is an ObjectBindingOrAssignmentPattern
- */
- /* @internal */
function isObjectBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 180 /* ObjectBindingPattern */:
- case 184 /* ObjectLiteralExpression */:
+ case 180:
+ case 184:
return true;
}
return false;
}
ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern;
- /**
- * Determines whether a node is an ArrayBindingOrAssignmentPattern
- */
- /* @internal */
function isArrayBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 181 /* ArrayBindingPattern */:
- case 183 /* ArrayLiteralExpression */:
+ case 181:
+ case 183:
return true;
}
return false;
}
ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern;
- /* @internal */
function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
var kind = node.kind;
- return kind === 185 /* PropertyAccessExpression */
- || kind === 146 /* QualifiedName */
- || kind === 179 /* ImportType */;
+ return kind === 185
+ || kind === 146
+ || kind === 179;
}
ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode;
- // Expression
function isPropertyAccessOrQualifiedName(node) {
var kind = node.kind;
- return kind === 185 /* PropertyAccessExpression */
- || kind === 146 /* QualifiedName */;
+ return kind === 185
+ || kind === 146;
}
ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName;
function isCallLikeExpression(node) {
switch (node.kind) {
- case 257 /* JsxOpeningElement */:
- case 256 /* JsxSelfClosingElement */:
- case 187 /* CallExpression */:
- case 188 /* NewExpression */:
- case 189 /* TaggedTemplateExpression */:
- case 150 /* Decorator */:
+ case 257:
+ case 256:
+ case 187:
+ case 188:
+ case 189:
+ case 150:
return true;
default:
return false;
@@ -13198,106 +11735,98 @@ var ts;
}
ts.isCallLikeExpression = isCallLikeExpression;
function isCallOrNewExpression(node) {
- return node.kind === 187 /* CallExpression */ || node.kind === 188 /* NewExpression */;
+ return node.kind === 187 || node.kind === 188;
}
ts.isCallOrNewExpression = isCallOrNewExpression;
function isTemplateLiteral(node) {
var kind = node.kind;
- return kind === 202 /* TemplateExpression */
- || kind === 13 /* NoSubstitutionTemplateLiteral */;
+ return kind === 202
+ || kind === 13;
}
ts.isTemplateLiteral = isTemplateLiteral;
- /* @internal */
function isLeftHandSideExpression(node) {
return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
}
ts.isLeftHandSideExpression = isLeftHandSideExpression;
function isLeftHandSideExpressionKind(kind) {
switch (kind) {
- case 185 /* PropertyAccessExpression */:
- case 186 /* ElementAccessExpression */:
- case 188 /* NewExpression */:
- case 187 /* CallExpression */:
- case 255 /* JsxElement */:
- case 256 /* JsxSelfClosingElement */:
- case 259 /* JsxFragment */:
- case 189 /* TaggedTemplateExpression */:
- case 183 /* ArrayLiteralExpression */:
- case 191 /* ParenthesizedExpression */:
- case 184 /* ObjectLiteralExpression */:
- case 205 /* ClassExpression */:
- case 192 /* FunctionExpression */:
- case 71 /* Identifier */:
- case 12 /* RegularExpressionLiteral */:
- case 8 /* NumericLiteral */:
- case 9 /* StringLiteral */:
- case 13 /* NoSubstitutionTemplateLiteral */:
- case 202 /* TemplateExpression */:
- case 86 /* FalseKeyword */:
- case 95 /* NullKeyword */:
- case 99 /* ThisKeyword */:
- case 101 /* TrueKeyword */:
- case 97 /* SuperKeyword */:
- case 209 /* NonNullExpression */:
- case 210 /* MetaProperty */:
- case 91 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
+ case 185:
+ case 186:
+ case 188:
+ case 187:
+ case 255:
+ case 256:
+ case 259:
+ case 189:
+ case 183:
+ case 191:
+ case 184:
+ case 205:
+ case 192:
+ case 71:
+ case 12:
+ case 8:
+ case 9:
+ case 13:
+ case 202:
+ case 86:
+ case 95:
+ case 99:
+ case 101:
+ case 97:
+ case 209:
+ case 210:
+ case 91:
return true;
default:
return false;
}
}
- /* @internal */
function isUnaryExpression(node) {
return isUnaryExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
}
ts.isUnaryExpression = isUnaryExpression;
function isUnaryExpressionKind(kind) {
switch (kind) {
- case 198 /* PrefixUnaryExpression */:
- case 199 /* PostfixUnaryExpression */:
- case 194 /* DeleteExpression */:
- case 195 /* TypeOfExpression */:
- case 196 /* VoidExpression */:
- case 197 /* AwaitExpression */:
- case 190 /* TypeAssertionExpression */:
+ case 198:
+ case 199:
+ case 194:
+ case 195:
+ case 196:
+ case 197:
+ case 190:
return true;
default:
return isLeftHandSideExpressionKind(kind);
}
}
- /* @internal */
function isUnaryExpressionWithWrite(expr) {
switch (expr.kind) {
- case 199 /* PostfixUnaryExpression */:
+ case 199:
return true;
- case 198 /* PrefixUnaryExpression */:
- return expr.operator === 43 /* PlusPlusToken */ ||
- expr.operator === 44 /* MinusMinusToken */;
+ case 198:
+ return expr.operator === 43 ||
+ expr.operator === 44;
default:
return false;
}
}
ts.isUnaryExpressionWithWrite = isUnaryExpressionWithWrite;
- /* @internal */
- /**
- * Determines whether a node is an expression based only on its kind.
- * Use `isExpressionNode` if not in transforms.
- */
function isExpression(node) {
return isExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
}
ts.isExpression = isExpression;
function isExpressionKind(kind) {
switch (kind) {
- case 201 /* ConditionalExpression */:
- case 203 /* YieldExpression */:
- case 193 /* ArrowFunction */:
- case 200 /* BinaryExpression */:
- case 204 /* SpreadElement */:
- case 208 /* AsExpression */:
- case 206 /* OmittedExpression */:
- case 302 /* CommaListExpression */:
- case 301 /* PartiallyEmittedExpression */:
+ case 201:
+ case 203:
+ case 193:
+ case 200:
+ case 204:
+ case 208:
+ case 206:
+ case 303:
+ case 302:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -13305,21 +11834,18 @@ var ts;
}
function isAssertionExpression(node) {
var kind = node.kind;
- return kind === 190 /* TypeAssertionExpression */
- || kind === 208 /* AsExpression */;
+ return kind === 190
+ || kind === 208;
}
ts.isAssertionExpression = isAssertionExpression;
- /* @internal */
function isPartiallyEmittedExpression(node) {
- return node.kind === 301 /* PartiallyEmittedExpression */;
+ return node.kind === 302;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
- /* @internal */
function isNotEmittedStatement(node) {
- return node.kind === 300 /* NotEmittedStatement */;
+ return node.kind === 301;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
- /* @internal */
function isNotEmittedOrPartiallyEmittedNode(node) {
return isNotEmittedStatement(node)
|| isPartiallyEmittedExpression(node);
@@ -13327,169 +11853,152 @@ var ts;
ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;
function isIterationStatement(node, lookInLabeledStatements) {
switch (node.kind) {
- case 220 /* ForStatement */:
- case 221 /* ForInStatement */:
- case 222 /* ForOfStatement */:
- case 218 /* DoStatement */:
- case 219 /* WhileStatement */:
+ case 220:
+ case 221:
+ case 222:
+ case 218:
+ case 219:
return true;
- case 228 /* LabeledStatement */:
+ case 228:
return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);
}
return false;
}
ts.isIterationStatement = isIterationStatement;
- /* @internal */
function isForInOrOfStatement(node) {
- return node.kind === 221 /* ForInStatement */ || node.kind === 222 /* ForOfStatement */;
+ return node.kind === 221 || node.kind === 222;
}
ts.isForInOrOfStatement = isForInOrOfStatement;
- // Element
- /* @internal */
function isConciseBody(node) {
return ts.isBlock(node)
|| isExpression(node);
}
ts.isConciseBody = isConciseBody;
- /* @internal */
function isFunctionBody(node) {
return ts.isBlock(node);
}
ts.isFunctionBody = isFunctionBody;
- /* @internal */
function isForInitializer(node) {
return ts.isVariableDeclarationList(node)
|| isExpression(node);
}
ts.isForInitializer = isForInitializer;
- /* @internal */
function isModuleBody(node) {
var kind = node.kind;
- return kind === 240 /* ModuleBlock */
- || kind === 239 /* ModuleDeclaration */
- || kind === 71 /* Identifier */;
+ return kind === 240
+ || kind === 239
+ || kind === 71;
}
ts.isModuleBody = isModuleBody;
- /* @internal */
function isNamespaceBody(node) {
var kind = node.kind;
- return kind === 240 /* ModuleBlock */
- || kind === 239 /* ModuleDeclaration */;
+ return kind === 240
+ || kind === 239;
}
ts.isNamespaceBody = isNamespaceBody;
- /* @internal */
function isJSDocNamespaceBody(node) {
var kind = node.kind;
- return kind === 71 /* Identifier */
- || kind === 239 /* ModuleDeclaration */;
+ return kind === 71
+ || kind === 239;
}
ts.isJSDocNamespaceBody = isJSDocNamespaceBody;
- /* @internal */
function isNamedImportBindings(node) {
var kind = node.kind;
- return kind === 247 /* NamedImports */
- || kind === 246 /* NamespaceImport */;
+ return kind === 247
+ || kind === 246;
}
ts.isNamedImportBindings = isNamedImportBindings;
- /* @internal */
function isModuleOrEnumDeclaration(node) {
- return node.kind === 239 /* ModuleDeclaration */ || node.kind === 238 /* EnumDeclaration */;
+ return node.kind === 239 || node.kind === 238;
}
ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;
function isDeclarationKind(kind) {
- return kind === 193 /* ArrowFunction */
- || kind === 182 /* BindingElement */
- || kind === 235 /* ClassDeclaration */
- || kind === 205 /* ClassExpression */
- || kind === 155 /* Constructor */
- || kind === 238 /* EnumDeclaration */
- || kind === 273 /* EnumMember */
- || kind === 252 /* ExportSpecifier */
- || kind === 234 /* FunctionDeclaration */
- || kind === 192 /* FunctionExpression */
- || kind === 156 /* GetAccessor */
- || kind === 245 /* ImportClause */
- || kind === 243 /* ImportEqualsDeclaration */
- || kind === 248 /* ImportSpecifier */
- || kind === 236 /* InterfaceDeclaration */
- || kind === 262 /* JsxAttribute */
- || kind === 154 /* MethodDeclaration */
- || kind === 153 /* MethodSignature */
- || kind === 239 /* ModuleDeclaration */
- || kind === 242 /* NamespaceExportDeclaration */
- || kind === 246 /* NamespaceImport */
- || kind === 149 /* Parameter */
- || kind === 270 /* PropertyAssignment */
- || kind === 152 /* PropertyDeclaration */
- || kind === 151 /* PropertySignature */
- || kind === 157 /* SetAccessor */
- || kind === 271 /* ShorthandPropertyAssignment */
- || kind === 237 /* TypeAliasDeclaration */
- || kind === 148 /* TypeParameter */
- || kind === 232 /* VariableDeclaration */
- || kind === 297 /* JSDocTypedefTag */
- || kind === 292 /* JSDocCallbackTag */
- || kind === 298 /* JSDocPropertyTag */;
+ return kind === 193
+ || kind === 182
+ || kind === 235
+ || kind === 205
+ || kind === 155
+ || kind === 238
+ || kind === 273
+ || kind === 252
+ || kind === 234
+ || kind === 192
+ || kind === 156
+ || kind === 245
+ || kind === 243
+ || kind === 248
+ || kind === 236
+ || kind === 262
+ || kind === 154
+ || kind === 153
+ || kind === 239
+ || kind === 242
+ || kind === 246
+ || kind === 149
+ || kind === 270
+ || kind === 152
+ || kind === 151
+ || kind === 157
+ || kind === 271
+ || kind === 237
+ || kind === 148
+ || kind === 232
+ || kind === 298
+ || kind === 292
+ || kind === 299;
}
function isDeclarationStatementKind(kind) {
- return kind === 234 /* FunctionDeclaration */
- || kind === 253 /* MissingDeclaration */
- || kind === 235 /* ClassDeclaration */
- || kind === 236 /* InterfaceDeclaration */
- || kind === 237 /* TypeAliasDeclaration */
- || kind === 238 /* EnumDeclaration */
- || kind === 239 /* ModuleDeclaration */
- || kind === 244 /* ImportDeclaration */
- || kind === 243 /* ImportEqualsDeclaration */
- || kind === 250 /* ExportDeclaration */
- || kind === 249 /* ExportAssignment */
- || kind === 242 /* NamespaceExportDeclaration */;
+ return kind === 234
+ || kind === 253
+ || kind === 235
+ || kind === 236
+ || kind === 237
+ || kind === 238
+ || kind === 239
+ || kind === 244
+ || kind === 243
+ || kind === 250
+ || kind === 249
+ || kind === 242;
}
function isStatementKindButNotDeclarationKind(kind) {
- return kind === 224 /* BreakStatement */
- || kind === 223 /* ContinueStatement */
- || kind === 231 /* DebuggerStatement */
- || kind === 218 /* DoStatement */
- || kind === 216 /* ExpressionStatement */
- || kind === 215 /* EmptyStatement */
- || kind === 221 /* ForInStatement */
- || kind === 222 /* ForOfStatement */
- || kind === 220 /* ForStatement */
- || kind === 217 /* IfStatement */
- || kind === 228 /* LabeledStatement */
- || kind === 225 /* ReturnStatement */
- || kind === 227 /* SwitchStatement */
- || kind === 229 /* ThrowStatement */
- || kind === 230 /* TryStatement */
- || kind === 214 /* VariableStatement */
- || kind === 219 /* WhileStatement */
- || kind === 226 /* WithStatement */
- || kind === 300 /* NotEmittedStatement */
- || kind === 304 /* EndOfDeclarationMarker */
- || kind === 303 /* MergeDeclarationMarker */;
+ return kind === 224
+ || kind === 223
+ || kind === 231
+ || kind === 218
+ || kind === 216
+ || kind === 215
+ || kind === 221
+ || kind === 222
+ || kind === 220
+ || kind === 217
+ || kind === 228
+ || kind === 225
+ || kind === 227
+ || kind === 229
+ || kind === 230
+ || kind === 214
+ || kind === 219
+ || kind === 226
+ || kind === 301
+ || kind === 305
+ || kind === 304;
}
- /* @internal */
function isDeclaration(node) {
- if (node.kind === 148 /* TypeParameter */) {
- return node.parent.kind !== 296 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node);
+ if (node.kind === 148) {
+ return node.parent.kind !== 297 || ts.isInJavaScriptFile(node);
}
return isDeclarationKind(node.kind);
}
ts.isDeclaration = isDeclaration;
- /* @internal */
function isDeclarationStatement(node) {
return isDeclarationStatementKind(node.kind);
}
ts.isDeclarationStatement = isDeclarationStatement;
- /**
- * Determines whether the node is a statement that is not also a declaration
- */
- /* @internal */
function isStatementButNotDeclaration(node) {
return isStatementKindButNotDeclarationKind(node.kind);
}
ts.isStatementButNotDeclaration = isStatementButNotDeclaration;
- /* @internal */
function isStatement(node) {
var kind = node.kind;
return isStatementKindButNotDeclarationKind(kind)
@@ -13498,183 +12007,156 @@ var ts;
}
ts.isStatement = isStatement;
function isBlockStatement(node) {
- if (node.kind !== 213 /* Block */)
+ if (node.kind !== 213)
return false;
if (node.parent !== undefined) {
- if (node.parent.kind === 230 /* TryStatement */ || node.parent.kind === 269 /* CatchClause */) {
+ if (node.parent.kind === 230 || node.parent.kind === 269) {
return false;
}
}
return !ts.isFunctionBlock(node);
}
- // Module references
- /* @internal */
function isModuleReference(node) {
var kind = node.kind;
- return kind === 254 /* ExternalModuleReference */
- || kind === 146 /* QualifiedName */
- || kind === 71 /* Identifier */;
+ return kind === 254
+ || kind === 146
+ || kind === 71;
}
ts.isModuleReference = isModuleReference;
- // JSX
- /* @internal */
function isJsxTagNameExpression(node) {
var kind = node.kind;
- return kind === 99 /* ThisKeyword */
- || kind === 71 /* Identifier */
- || kind === 185 /* PropertyAccessExpression */;
+ return kind === 99
+ || kind === 71
+ || kind === 185;
}
ts.isJsxTagNameExpression = isJsxTagNameExpression;
- /* @internal */
function isJsxChild(node) {
var kind = node.kind;
- return kind === 255 /* JsxElement */
- || kind === 265 /* JsxExpression */
- || kind === 256 /* JsxSelfClosingElement */
- || kind === 10 /* JsxText */
- || kind === 259 /* JsxFragment */;
+ return kind === 255
+ || kind === 265
+ || kind === 256
+ || kind === 10
+ || kind === 259;
}
ts.isJsxChild = isJsxChild;
- /* @internal */
function isJsxAttributeLike(node) {
var kind = node.kind;
- return kind === 262 /* JsxAttribute */
- || kind === 264 /* JsxSpreadAttribute */;
+ return kind === 262
+ || kind === 264;
}
ts.isJsxAttributeLike = isJsxAttributeLike;
- /* @internal */
function isStringLiteralOrJsxExpression(node) {
var kind = node.kind;
- return kind === 9 /* StringLiteral */
- || kind === 265 /* JsxExpression */;
+ return kind === 9
+ || kind === 265;
}
ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
function isJsxOpeningLikeElement(node) {
var kind = node.kind;
- return kind === 257 /* JsxOpeningElement */
- || kind === 256 /* JsxSelfClosingElement */;
+ return kind === 257
+ || kind === 256;
}
ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement;
- // Clauses
function isCaseOrDefaultClause(node) {
var kind = node.kind;
- return kind === 266 /* CaseClause */
- || kind === 267 /* DefaultClause */;
+ return kind === 266
+ || kind === 267;
}
ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
- // JSDoc
- /** True if node is of some JSDoc syntax kind. */
- /* @internal */
function isJSDocNode(node) {
- return node.kind >= 278 /* FirstJSDocNode */ && node.kind <= 298 /* LastJSDocNode */;
+ return node.kind >= 278 && node.kind <= 299;
}
ts.isJSDocNode = isJSDocNode;
- /** True if node is of a kind that may contain comment text. */
function isJSDocCommentContainingNode(node) {
- return node.kind === 286 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 286 || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
- // TODO: determine what this does before making it public.
- /* @internal */
function isJSDocTag(node) {
- return node.kind >= 289 /* FirstJSDocTagNode */ && node.kind <= 298 /* LastJSDocTagNode */;
+ return node.kind >= 289 && node.kind <= 299;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
- return node.kind === 157 /* SetAccessor */;
+ return node.kind === 157;
}
ts.isSetAccessor = isSetAccessor;
function isGetAccessor(node) {
- return node.kind === 156 /* GetAccessor */;
+ return node.kind === 156;
}
ts.isGetAccessor = isGetAccessor;
- /** True if has jsdoc nodes attached to it. */
- /* @internal */
- // TODO: GH#19856 Would like to return `node is Node & { jsDoc: JSDoc[] }` but it causes long compile times
function hasJSDocNodes(node) {
var jsDoc = node.jsDoc;
return !!jsDoc && jsDoc.length > 0;
}
ts.hasJSDocNodes = hasJSDocNodes;
- /** True if has type node attached to it. */
- /* @internal */
function hasType(node) {
return !!node.type;
}
ts.hasType = hasType;
- /* True if the node could have a type node a `.type` */
- /* @internal */
function couldHaveType(node) {
switch (node.kind) {
- case 149 /* Parameter */:
- case 151 /* PropertySignature */:
- case 152 /* PropertyDeclaration */:
- case 153 /* MethodSignature */:
- case 154 /* MethodDeclaration */:
- case 155 /* Constructor */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
- case 158 /* CallSignature */:
- case 159 /* ConstructSignature */:
- case 160 /* IndexSignature */:
- case 161 /* TypePredicate */:
- case 163 /* FunctionType */:
- case 164 /* ConstructorType */:
- case 173 /* ParenthesizedType */:
- case 175 /* TypeOperator */:
- case 177 /* MappedType */:
- case 190 /* TypeAssertionExpression */:
- case 192 /* FunctionExpression */:
- case 193 /* ArrowFunction */:
- case 208 /* AsExpression */:
- case 232 /* VariableDeclaration */:
- case 234 /* FunctionDeclaration */:
- case 237 /* TypeAliasDeclaration */:
- case 278 /* JSDocTypeExpression */:
- case 281 /* JSDocNullableType */:
- case 282 /* JSDocNonNullableType */:
- case 283 /* JSDocOptionalType */:
- case 284 /* JSDocFunctionType */:
- case 285 /* JSDocVariadicType */:
+ case 149:
+ case 151:
+ case 152:
+ case 153:
+ case 154:
+ case 155:
+ case 156:
+ case 157:
+ case 158:
+ case 159:
+ case 160:
+ case 161:
+ case 163:
+ case 164:
+ case 173:
+ case 175:
+ case 177:
+ case 190:
+ case 192:
+ case 193:
+ case 208:
+ case 232:
+ case 234:
+ case 237:
+ case 278:
+ case 281:
+ case 282:
+ case 283:
+ case 284:
+ case 285:
return true;
}
return false;
}
ts.couldHaveType = couldHaveType;
- /** True if has initializer node attached to it. */
- /* @internal */
function hasInitializer(node) {
return !!node.initializer;
}
ts.hasInitializer = hasInitializer;
- /** True if has initializer node attached to it. */
- /* @internal */
function hasOnlyExpressionInitializer(node) {
return hasInitializer(node) && !ts.isForStatement(node) && !ts.isForInStatement(node) && !ts.isForOfStatement(node) && !ts.isJsxAttribute(node);
}
ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer;
function isObjectLiteralElement(node) {
switch (node.kind) {
- case 262 /* JsxAttribute */:
- case 264 /* JsxSpreadAttribute */:
- case 270 /* PropertyAssignment */:
- case 271 /* ShorthandPropertyAssignment */:
- case 154 /* MethodDeclaration */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
+ case 262:
+ case 264:
+ case 270:
+ case 271:
+ case 154:
+ case 156:
+ case 157:
return true;
default:
return false;
}
}
ts.isObjectLiteralElement = isObjectLiteralElement;
- /* @internal */
function isTypeReferenceType(node) {
- return node.kind === 162 /* TypeReference */ || node.kind === 207 /* ExpressionWithTypeArguments */;
+ return node.kind === 162 || node.kind === 207;
}
ts.isTypeReferenceType = isTypeReferenceType;
var MAX_SMI_X86 = 1073741823;
- /* @internal */
function guessIndentation(lines) {
var indentation = MAX_SMI_X86;
for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
@@ -13699,12 +12181,13 @@ var ts;
}
ts.guessIndentation = guessIndentation;
function isStringLiteralLike(node) {
- return node.kind === 9 /* StringLiteral */ || node.kind === 13 /* NoSubstitutionTemplateLiteral */;
+ return node.kind === 9 || node.kind === 13;
}
ts.isStringLiteralLike = isStringLiteralLike;
- /** @internal */
+})(ts || (ts = {}));
+(function (ts) {
function isNamedImportsOrExports(node) {
- return node.kind === 247 /* NamedImports */ || node.kind === 251 /* NamedExports */;
+ return node.kind === 247 || node.kind === 251;
}
ts.isNamedImportsOrExports = isNamedImportsOrExports;
function Symbol(flags, name) {
@@ -13718,19 +12201,19 @@ var ts;
}
function Type(checker, flags) {
this.flags = flags;
- if (Debug.isDebugging) {
+ if (ts.Debug.isDebugging) {
this.checker = checker;
}
}
- function Signature() { } // tslint:disable-line no-empty
+ function Signature() { }
function Node(kind, pos, end) {
this.pos = pos;
this.end = end;
this.kind = kind;
this.id = 0;
- this.flags = 0 /* None */;
- this.modifierFlagsCache = 0 /* None */;
- this.transformFlags = 0 /* None */;
+ this.flags = 0;
+ this.modifierFlagsCache = 0;
+ this.transformFlags = 0;
this.parent = undefined;
this.original = undefined;
}
@@ -13751,7 +12234,7 @@ var ts;
};
function formatStringFromArgs(text, args, baseIndex) {
if (baseIndex === void 0) { baseIndex = 0; }
- return text.replace(/{(\d+)}/g, function (_match, index) { return Debug.assertDefined(args[+index + baseIndex]); });
+ return text.replace(/{(\d+)}/g, function (_match, index) { return ts.Debug.assertDefined(args[+index + baseIndex]); });
}
ts.formatStringFromArgs = formatStringFromArgs;
function getLocaleSpecificMessage(message) {
@@ -13759,11 +12242,11 @@ var ts;
}
ts.getLocaleSpecificMessage = getLocaleSpecificMessage;
function createFileDiagnostic(file, start, length, message) {
- Debug.assertGreaterThanOrEqual(start, 0);
- Debug.assertGreaterThanOrEqual(length, 0);
+ ts.Debug.assertGreaterThanOrEqual(start, 0);
+ ts.Debug.assertGreaterThanOrEqual(length, 0);
if (file) {
- Debug.assertLessThanOrEqual(start, file.text.length);
- Debug.assertLessThanOrEqual(start + length, file.text.length);
+ ts.Debug.assertLessThanOrEqual(start, file.text.length);
+ ts.Debug.assertLessThanOrEqual(start + length, file.text.length);
}
var text = getLocaleSpecificMessage(message);
if (arguments.length > 4) {
@@ -13780,7 +12263,6 @@ var ts;
};
}
ts.createFileDiagnostic = createFileDiagnostic;
- /* @internal */
function formatMessage(_dummy, message) {
var text = getLocaleSpecificMessage(message);
if (arguments.length > 2) {
@@ -13847,14 +12329,13 @@ var ts;
ts.compareValues(d1.length, d2.length) ||
ts.compareValues(d1.code, d2.code) ||
compareMessageText(d1.messageText, d2.messageText) ||
- 0 /* EqualTo */;
+ 0;
}
ts.compareDiagnostics = compareDiagnostics;
function compareMessageText(t1, t2) {
var text1 = t1;
var text2 = t2;
while (text1 && text2) {
- // We still have both chains.
var string1 = ts.isString(text1) ? text1 : text1.messageText;
var string2 = ts.isString(text2) ? text2 : text2.messageText;
var res = ts.compareStringsCaseSensitive(string1, string2);
@@ -13865,20 +12346,18 @@ var ts;
text2 = ts.isString(text2) ? undefined : text2.next;
}
if (!text1 && !text2) {
- // if the chains are done, then these messages are the same.
- return 0 /* EqualTo */;
+ return 0;
}
- // We still have one chain remaining. The shorter chain should come first.
- return text1 ? 1 /* GreaterThan */ : -1 /* LessThan */;
+ return text1 ? 1 : -1;
}
function getEmitScriptTarget(compilerOptions) {
- return compilerOptions.target || 0 /* ES3 */;
+ return compilerOptions.target || 0;
}
ts.getEmitScriptTarget = getEmitScriptTarget;
function getEmitModuleKind(compilerOptions) {
return typeof compilerOptions.module === "number" ?
compilerOptions.module :
- getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */ ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
+ getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
}
ts.getEmitModuleKind = getEmitModuleKind;
function getEmitModuleResolutionKind(compilerOptions) {
@@ -13921,12 +12400,11 @@ var ts;
function hasZeroOrOneAsteriskCharacter(str) {
var seenAsterisk = false;
for (var i = 0; i < str.length; i++) {
- if (str.charCodeAt(i) === 42 /* asterisk */) {
+ if (str.charCodeAt(i) === 42) {
if (!seenAsterisk) {
seenAsterisk = true;
}
else {
- // have already seen asterisk
return false;
}
}
@@ -13934,128 +12412,80 @@ var ts;
return true;
}
ts.hasZeroOrOneAsteriskCharacter = hasZeroOrOneAsteriskCharacter;
- /**
- * 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.
- */
ts.directorySeparator = "/";
var altDirectorySeparator = "\\";
var urlSchemeSeparator = "://";
var backslashRegExp = /\\/g;
- /**
- * Normalize path separators.
- */
function normalizeSlashes(path) {
return path.replace(backslashRegExp, ts.directorySeparator);
}
ts.normalizeSlashes = normalizeSlashes;
function isVolumeCharacter(charCode) {
- return (charCode >= 97 /* a */ && charCode <= 122 /* z */) ||
- (charCode >= 65 /* A */ && charCode <= 90 /* Z */);
+ return (charCode >= 97 && charCode <= 122) ||
+ (charCode >= 65 && charCode <= 90);
}
function getFileUrlVolumeSeparatorEnd(url, start) {
var ch0 = url.charCodeAt(start);
- if (ch0 === 58 /* colon */)
+ if (ch0 === 58)
return start + 1;
- if (ch0 === 37 /* percent */ && url.charCodeAt(start + 1) === 51 /* _3 */) {
+ if (ch0 === 37 && url.charCodeAt(start + 1) === 51) {
var ch2 = url.charCodeAt(start + 2);
- if (ch2 === 97 /* a */ || ch2 === 65 /* A */)
+ if (ch2 === 97 || ch2 === 65)
return start + 3;
}
return -1;
}
- /**
- * Returns length of the root part of a path or URL (i.e. length of "/", "x:/", "//server/share/, file:///user/files").
- * If the root is part of a URL, the twos-complement of the root length is returned.
- */
function getEncodedRootLength(path) {
if (!path)
return 0;
var ch0 = path.charCodeAt(0);
- // POSIX or UNC
- if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) {
+ if (ch0 === 47 || ch0 === 92) {
if (path.charCodeAt(1) !== ch0)
- return 1; // POSIX: "/" (or non-normalized "\")
- var p1 = path.indexOf(ch0 === 47 /* slash */ ? ts.directorySeparator : altDirectorySeparator, 2);
+ return 1;
+ var p1 = path.indexOf(ch0 === 47 ? ts.directorySeparator : altDirectorySeparator, 2);
if (p1 < 0)
- return path.length; // UNC: "//server" or "\\server"
- return p1 + 1; // UNC: "//server/" or "\\server\"
+ return path.length;
+ return p1 + 1;
}
- // DOS
- if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* colon */) {
+ if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58) {
var ch2 = path.charCodeAt(2);
- if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */)
- return 3; // DOS: "c:/" or "c:\"
+ if (ch2 === 47 || ch2 === 92)
+ return 3;
if (path.length === 2)
- return 2; // DOS: "c:" (but not "c:d")
+ return 2;
}
- // URL
var schemeEnd = path.indexOf(urlSchemeSeparator);
if (schemeEnd !== -1) {
var authorityStart = schemeEnd + urlSchemeSeparator.length;
var authorityEnd = path.indexOf(ts.directorySeparator, authorityStart);
- if (authorityEnd !== -1) { // URL: "file:///", "file://server/", "file://server/path"
- // For local "file" URLs, include the leading DOS volume (if present).
- // Per https://www.ietf.org/rfc/rfc1738.txt, a host of "" or "localhost" is a
- // special case interpreted as "the machine from which the URL is being interpreted".
+ if (authorityEnd !== -1) {
var scheme = path.slice(0, schemeEnd);
var authority = path.slice(authorityStart, authorityEnd);
if (scheme === "file" && (authority === "" || authority === "localhost") &&
isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
var volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
if (volumeSeparatorEnd !== -1) {
- if (path.charCodeAt(volumeSeparatorEnd) === 47 /* slash */) {
- // URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/"
+ if (path.charCodeAt(volumeSeparatorEnd) === 47) {
return ~(volumeSeparatorEnd + 1);
}
if (volumeSeparatorEnd === path.length) {
- // URL: "file:///c:", "file://localhost/c:", "file:///c$3a", "file://localhost/c%3a"
- // but not "file:///c:d" or "file:///c%3ad"
return ~volumeSeparatorEnd;
}
}
}
- return ~(authorityEnd + 1); // URL: "file://server/", "http://server/"
+ return ~(authorityEnd + 1);
}
- return ~path.length; // URL: "file://server", "http://server"
+ return ~path.length;
}
- // relative
return 0;
}
- /**
- * 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) {
var rootLength = getEncodedRootLength(path);
return rootLength < 0 ? ~rootLength : rootLength;
}
ts.getRootLength = getRootLength;
- // TODO(rbuckton): replace references with `resolvePath`
function normalizePath(path) {
- return resolvePath(path);
+ return ts.resolvePath(path);
}
ts.normalizePath = normalizePath;
function normalizePathAndParts(path) {
@@ -14063,7 +12493,7 @@ var ts;
var _a = reducePathComponents(getPathComponents(path)), root = _a[0], parts = _a.slice(1);
if (parts.length) {
var joinedParts = root + parts.join(ts.directorySeparator);
- return { path: hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(joinedParts) : joinedParts, parts: parts };
+ return { path: ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(joinedParts) : joinedParts, parts: parts };
}
else {
return { path: root, parts: parts };
@@ -14072,13 +12502,10 @@ var ts;
ts.normalizePathAndParts = normalizePathAndParts;
function getDirectoryPath(path) {
path = normalizeSlashes(path);
- // If the path provided is itself the root, then return it.
var rootLength = getRootLength(path);
if (rootLength === path.length)
return path;
- // return the leading portion of the path up to the last (non-terminal) directory separator
- // but not including any trailing directory separator.
- path = removeTrailingDirectorySeparator(path);
+ path = ts.removeTrailingDirectorySeparator(path);
return path.slice(0, Math.max(rootLength, path.lastIndexOf(ts.directorySeparator)));
}
ts.getDirectoryPath = getDirectoryPath;
@@ -14090,17 +12517,10 @@ var ts;
return /^\.\.?($|[\\/])/.test(path);
}
ts.pathIsRelative = pathIsRelative;
- /**
- * Determines whether a path is an absolute path (e.g. starts with `/`, or a dos path
- * like `c:`, `c:\` or `c:/`).
- */
function isRootedDiskPath(path) {
return getEncodedRootLength(path) > 0;
}
ts.isRootedDiskPath = isRootedDiskPath;
- /**
- * Determines whether a path consists only of a path root.
- */
function isDiskPathRoot(path) {
var rootLength = getEncodedRootLength(path);
return rootLength > 0 && rootLength === path.length;
@@ -14109,7 +12529,7 @@ var ts;
function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) {
return !isRootedDiskPath(absoluteOrRelativePath)
? absoluteOrRelativePath
- : getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
+ : ts.getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, false);
}
ts.convertToRelativePath = convertToRelativePath;
function pathComponents(path, rootLength) {
@@ -14119,23 +12539,13 @@ var ts;
rest.pop();
return [root].concat(rest);
}
- /**
- * 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, currentDirectory) {
if (currentDirectory === void 0) { currentDirectory = ""; }
- path = combinePaths(currentDirectory, path);
+ path = ts.combinePaths(currentDirectory, path);
var rootLength = getRootLength(path);
return pathComponents(path, rootLength);
}
ts.getPathComponents = getPathComponents;
- /**
- * Reduce an array of path components to a more simplified path by navigating any
- * `"."` or `".."` entries in the path.
- */
function reducePathComponents(components) {
if (!ts.some(components))
return [];
@@ -14161,12 +12571,6 @@ var ts;
return reduced;
}
ts.reducePathComponents = reducePathComponents;
- /**
- * 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, currentDirectory) {
return reducePathComponents(getPathComponents(path, currentDirectory));
}
@@ -14175,22 +12579,20 @@ var ts;
return getPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory));
}
ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath;
- /**
- * Formats a parsed path consisting of a root component (at index 0) and zero or more path
- * segments (at indices > 0).
- */
function getPathFromPathComponents(pathComponents) {
if (pathComponents.length === 0)
return "";
- var root = pathComponents[0] && ensureTrailingDirectorySeparator(pathComponents[0]);
+ var root = pathComponents[0] && ts.ensureTrailingDirectorySeparator(pathComponents[0]);
if (pathComponents.length === 1)
return root;
return root + pathComponents.slice(1).join(ts.directorySeparator);
}
ts.getPathFromPathComponents = getPathFromPathComponents;
+})(ts || (ts = {}));
+(function (ts) {
function getPathComponentsRelativeTo(from, to, stringEqualityComparer, getCanonicalFileName) {
- var fromComponents = reducePathComponents(getPathComponents(from));
- var toComponents = reducePathComponents(getPathComponents(to));
+ var fromComponents = ts.reducePathComponents(ts.getPathComponents(from));
+ var toComponents = ts.reducePathComponents(ts.getPathComponents(to));
var start;
for (start = 0; start < fromComponents.length && start < toComponents.length; start++) {
var fromComponent = getCanonicalFileName(fromComponents[start]);
@@ -14209,66 +12611,57 @@ var ts;
}
return [""].concat(relative, components);
}
+ ts.getPathComponentsRelativeTo = getPathComponentsRelativeTo;
function getRelativePathFromFile(from, to, getCanonicalFileName) {
- return ensurePathIsNonModuleName(getRelativePathFromDirectory(getDirectoryPath(from), to, getCanonicalFileName));
+ return ensurePathIsNonModuleName(getRelativePathFromDirectory(ts.getDirectoryPath(from), to, getCanonicalFileName));
}
ts.getRelativePathFromFile = getRelativePathFromFile;
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
- Debug.assert((getRootLength(fromDirectory) > 0) === (getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
+ Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
var getCanonicalFileName = typeof getCanonicalFileNameOrIgnoreCase === "function" ? getCanonicalFileNameOrIgnoreCase : ts.identity;
var ignoreCase = typeof getCanonicalFileNameOrIgnoreCase === "boolean" ? getCanonicalFileNameOrIgnoreCase : false;
var pathComponents = getPathComponentsRelativeTo(fromDirectory, to, ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive, getCanonicalFileName);
- return getPathFromPathComponents(pathComponents);
+ return ts.getPathFromPathComponents(pathComponents);
}
ts.getRelativePathFromDirectory = getRelativePathFromDirectory;
function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) {
var pathComponents = getPathComponentsRelativeTo(resolvePath(currentDirectory, directoryPathOrUrl), resolvePath(currentDirectory, relativeOrAbsolutePath), ts.equateStringsCaseSensitive, getCanonicalFileName);
var firstComponent = pathComponents[0];
- if (isAbsolutePathAnUrl && isRootedDiskPath(firstComponent)) {
+ if (isAbsolutePathAnUrl && ts.isRootedDiskPath(firstComponent)) {
var prefix = firstComponent.charAt(0) === ts.directorySeparator ? "file://" : "file:///";
pathComponents[0] = prefix + firstComponent;
}
- return getPathFromPathComponents(pathComponents);
+ return ts.getPathFromPathComponents(pathComponents);
}
ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl;
- /**
- * 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) {
- return getRootLength(path) === 0 && !pathIsRelative(path) ? "./" + path : path;
+ return ts.getRootLength(path) === 0 && !ts.pathIsRelative(path) ? "./" + path : path;
}
ts.ensurePathIsNonModuleName = ensurePathIsNonModuleName;
function getBaseFileName(path, extensions, ignoreCase) {
- path = normalizeSlashes(path);
- // if the path provided is itself the root, then it has not file name.
- var rootLength = getRootLength(path);
+ path = ts.normalizeSlashes(path);
+ var rootLength = ts.getRootLength(path);
if (rootLength === path.length)
return "";
- // return the trailing portion of the path starting after the last (non-terminal) directory
- // separator but not including any trailing directory separator.
path = removeTrailingDirectorySeparator(path);
- var name = path.slice(Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator) + 1));
+ var name = path.slice(Math.max(ts.getRootLength(path), path.lastIndexOf(ts.directorySeparator) + 1));
var extension = extensions !== undefined && ignoreCase !== undefined ? getAnyExtensionFromPath(name, extensions, ignoreCase) : undefined;
return extension ? name.slice(0, name.length - extension.length) : name;
}
ts.getBaseFileName = getBaseFileName;
- /**
- * Combines paths. If a path is absolute, it replaces any previous path.
- */
function combinePaths(path) {
var paths = [];
for (var _i = 1; _i < arguments.length; _i++) {
paths[_i - 1] = arguments[_i];
}
if (path)
- path = normalizeSlashes(path);
+ path = ts.normalizeSlashes(path);
for (var _a = 0, paths_1 = paths; _a < paths_1.length; _a++) {
var relativePath = paths_1[_a];
if (!relativePath)
continue;
- relativePath = normalizeSlashes(relativePath);
- if (!path || getRootLength(relativePath) !== 0) {
+ relativePath = ts.normalizeSlashes(relativePath);
+ if (!path || ts.getRootLength(relativePath) !== 0) {
path = relativePath;
}
else {
@@ -14278,28 +12671,21 @@ var ts;
return path;
}
ts.combinePaths = combinePaths;
- /**
- * Combines and resolves paths. If a path is absolute, it replaces any previous path. Any
- * `.` and `..` path components are resolved.
- */
function resolvePath(path) {
var paths = [];
for (var _i = 1; _i < arguments.length; _i++) {
paths[_i - 1] = arguments[_i];
}
- var combined = ts.some(paths) ? combinePaths.apply(void 0, [path].concat(paths)) : normalizeSlashes(path);
- var normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(combined)));
+ var combined = ts.some(paths) ? combinePaths.apply(void 0, [path].concat(paths)) : ts.normalizeSlashes(path);
+ var normalized = ts.getPathFromPathComponents(ts.reducePathComponents(ts.getPathComponents(combined)));
return normalized && hasTrailingDirectorySeparator(combined) ? ensureTrailingDirectorySeparator(normalized) : normalized;
}
ts.resolvePath = resolvePath;
- /**
- * Determines whether a path has a trailing separator (`/` or `\\`).
- */
function hasTrailingDirectorySeparator(path) {
if (path.length === 0)
return false;
var ch = path.charCodeAt(path.length - 1);
- return ch === 47 /* slash */ || ch === 92 /* backslash */;
+ return ch === 47 || ch === 92;
}
ts.hasTrailingDirectorySeparator = hasTrailingDirectorySeparator;
function removeTrailingDirectorySeparator(path) {
@@ -14318,33 +12704,27 @@ var ts;
ts.ensureTrailingDirectorySeparator = ensureTrailingDirectorySeparator;
function comparePathsWorker(a, b, componentComparer) {
if (a === b)
- return 0 /* EqualTo */;
+ return 0;
if (a === undefined)
- return -1 /* LessThan */;
+ return -1;
if (b === undefined)
- return 1 /* GreaterThan */;
- var aComponents = reducePathComponents(getPathComponents(a));
- var bComponents = reducePathComponents(getPathComponents(b));
+ return 1;
+ var aComponents = ts.reducePathComponents(ts.getPathComponents(a));
+ var bComponents = ts.reducePathComponents(ts.getPathComponents(b));
var sharedLength = Math.min(aComponents.length, bComponents.length);
for (var i = 0; i < sharedLength; i++) {
var stringComparer = i === 0 ? ts.compareStringsCaseInsensitive : componentComparer;
var result = stringComparer(aComponents[i], bComponents[i]);
- if (result !== 0 /* EqualTo */) {
+ if (result !== 0) {
return result;
}
}
return ts.compareValues(aComponents.length, bComponents.length);
}
- /**
- * Performs a case-sensitive comparison of two paths.
- */
function comparePathsCaseSensitive(a, b) {
return comparePathsWorker(a, b, ts.compareStringsCaseSensitive);
}
ts.comparePathsCaseSensitive = comparePathsCaseSensitive;
- /**
- * Performs a case-insensitive comparison of two paths.
- */
function comparePathsCaseInsensitive(a, b) {
return comparePathsWorker(a, b, ts.compareStringsCaseInsensitive);
}
@@ -14372,8 +12752,8 @@ var ts;
return false;
if (parent === child)
return true;
- var parentComponents = reducePathComponents(getPathComponents(parent));
- var childComponents = reducePathComponents(getPathComponents(child));
+ var parentComponents = ts.reducePathComponents(ts.getPathComponents(parent));
+ var childComponents = ts.reducePathComponents(ts.getPathComponents(child));
if (childComponents.length < parentComponents.length) {
return false;
}
@@ -14392,19 +12772,16 @@ var ts;
if (a === undefined)
return undefined;
switch (a.charCodeAt(0)) {
- case 47 /* slash */:
- case 92 /* backslash */:
+ case 47:
+ case 92:
return a.slice(1);
default:
return undefined;
}
}
ts.tryRemoveDirectoryPrefix = tryRemoveDirectoryPrefix;
- // Reserved characters, forces escaping of any non-word (or digit), non-whitespace character.
- // It may be inefficient (we could just match (/[-[\]{}()*+?.,\\^$|#\s]/g), but this is future
- // proof.
var reservedCharacterPattern = /[^\w\s\/]/g;
- var wildcardCharCodes = [42 /* asterisk */, 63 /* question */];
+ var wildcardCharCodes = [42, 63];
function hasExtension(fileName) {
return ts.stringContains(getBaseFileName(fileName), ".");
}
@@ -14412,26 +12789,12 @@ var ts;
ts.commonPackageFolders = ["node_modules", "bower_components", "jspm_packages"];
var implicitExcludePathRegexPattern = "(?!(" + ts.commonPackageFolders.join("|") + ")(/|$))";
var filesMatcher = {
- /**
- * Matches any single directory segment unless it is the last segment and a .min.js file
- * Breakdown:
- * [^./] # matches everything up to the first . character (excluding directory separators)
- * (\\.(?!min\\.js$))? # matches . characters but not if they are part of the .min.js file extension
- */
singleAsteriskRegexFragment: "([^./]|(\\.(?!min\\.js$))?)*",
- /**
- * Regex for the ** wildcard. Matches any number of subdirectories. When used for including
- * files or directories, does not match subdirectories that start with a . character
- */
doubleAsteriskRegexFragment: "(/" + implicitExcludePathRegexPattern + "[^/.][^/]*)*?",
replaceWildcardCharacter: function (match) { return replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment); }
};
var directoriesMatcher = {
singleAsteriskRegexFragment: "[^/]*",
- /**
- * Regex for the ** wildcard. Matches any number of subdirectories. When used for including
- * files or directories, does not match subdirectories that start with a . character
- */
doubleAsteriskRegexFragment: "(/" + implicitExcludePathRegexPattern + "[^/.][^/]*)*?",
replaceWildcardCharacter: function (match) { return replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment); }
};
@@ -14451,7 +12814,6 @@ var ts;
return undefined;
}
var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|");
- // If excluding, match "foo/bar/baz...", but if including, only allow "foo".
var terminator = usage === "exclude" ? "($|/)" : "$";
return "^(" + pattern + ")" + terminator;
}
@@ -14464,10 +12826,6 @@ var ts;
return spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]);
});
}
- /**
- * 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) {
return !/[.*?]/.test(lastPathComponent);
}
@@ -14476,13 +12834,11 @@ var ts;
var singleAsteriskRegexFragment = _a.singleAsteriskRegexFragment, doubleAsteriskRegexFragment = _a.doubleAsteriskRegexFragment, replaceWildcardCharacter = _a.replaceWildcardCharacter;
var subpattern = "";
var hasWrittenComponent = false;
- var components = getNormalizedPathComponents(spec, basePath);
+ var components = ts.getNormalizedPathComponents(spec, basePath);
var lastComponent = ts.last(components);
if (usage !== "exclude" && lastComponent === "**") {
return undefined;
}
- // getNormalizedPathComponents includes the separator for the root component.
- // We need to remove to create our regex correctly.
components[0] = removeTrailingDirectorySeparator(components[0]);
if (isImplicitGlob(lastComponent)) {
components.push("**", "*");
@@ -14503,24 +12859,15 @@ var ts;
}
if (usage !== "exclude") {
var componentPattern = "";
- // The * and ? wildcards should not match directories or files that start with . if they
- // appear first in a component. Dotted directories and files can be included explicitly
- // like so: **/.*/.*
- if (component.charCodeAt(0) === 42 /* asterisk */) {
+ if (component.charCodeAt(0) === 42) {
componentPattern += "([^./]" + singleAsteriskRegexFragment + ")?";
component = component.substr(1);
}
- else if (component.charCodeAt(0) === 63 /* question */) {
+ else if (component.charCodeAt(0) === 63) {
componentPattern += "[^./]";
component = component.substr(1);
}
componentPattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
- // Patterns should not include subfolders like node_modules unless they are
- // explicitly included as part of the path.
- //
- // As an optimization, if the component pattern is the same as the component,
- // then there definitely were no wildcard characters and we do not need to
- // add the exclusion pattern.
if (componentPattern !== component) {
subpattern += implicitExcludePathRegexPattern;
}
@@ -14541,10 +12888,9 @@ var ts;
function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {
return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;
}
- /** @param path directory of the tsconfig.json */
function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {
- path = normalizePath(path);
- currentDirectory = normalizePath(currentDirectory);
+ path = ts.normalizePath(path);
+ currentDirectory = ts.normalizePath(currentDirectory);
var absolutePath = combinePaths(currentDirectory, path);
return {
includeFilePatterns: ts.map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }),
@@ -14559,16 +12905,13 @@ var ts;
return new RegExp(pattern, useCaseSensitiveFileNames ? "" : "i");
}
ts.getRegexFromPattern = getRegexFromPattern;
- /** @param path directory of the tsconfig.json */
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries) {
- path = normalizePath(path);
- currentDirectory = normalizePath(currentDirectory);
+ path = ts.normalizePath(path);
+ currentDirectory = ts.normalizePath(currentDirectory);
var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return getRegexFromPattern(pattern, useCaseSensitiveFileNames); });
var includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames);
var excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames);
- // Associate an array of results with each include regex. This keeps results in order of the "include" order.
- // If there are no "includes", then just put everything in results[0].
var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]];
for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
var basePath = _a[_i];
@@ -14616,32 +12959,21 @@ var ts;
}
}
ts.matchFiles = matchFiles;
- /**
- * Computes the unique non-wildcard base paths amongst the provided include patterns.
- */
function getBasePaths(path, includes, useCaseSensitiveFileNames) {
- // Storage for our results in the form of literal paths (e.g. the paths as written by the user).
var basePaths = [path];
if (includes) {
- // Storage for literal base paths amongst the include patterns.
var includeBasePaths = [];
for (var _i = 0, includes_1 = includes; _i < includes_1.length; _i++) {
var include = includes_1[_i];
- // We also need to check the relative paths by converting them to absolute and normalizing
- // in case they escape the base path (e.g "..\somedirectory")
- var absolute = isRootedDiskPath(include) ? include : normalizePath(combinePaths(path, include));
- // Append the literal and canonical candidate base paths.
+ var absolute = ts.isRootedDiskPath(include) ? include : ts.normalizePath(combinePaths(path, include));
includeBasePaths.push(getIncludeBasePath(absolute));
}
- // Sort the offsets array using either the literal or canonical path representations.
includeBasePaths.sort(ts.getStringComparer(!useCaseSensitiveFileNames));
var _loop_2 = function (includeBasePath) {
if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {
basePaths.push(includeBasePath);
}
};
- // Iterate over each include base path and include unique base paths that are not a
- // subpath of an existing base path
for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) {
var includeBasePath = includeBasePaths_1[_a];
_loop_2(includeBasePath);
@@ -14652,60 +12984,49 @@ var ts;
function getIncludeBasePath(absolute) {
var wildcardOffset = ts.indexOfAnyCharCode(absolute, wildcardCharCodes);
if (wildcardOffset < 0) {
- // No "*" or "?" in the path
return !hasExtension(absolute)
? absolute
- : removeTrailingDirectorySeparator(getDirectoryPath(absolute));
+ : removeTrailingDirectorySeparator(ts.getDirectoryPath(absolute));
}
return absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset));
}
function ensureScriptKind(fileName, scriptKind) {
- // Using scriptKind as a condition handles both:
- // - 'scriptKind' is unspecified and thus it is `undefined`
- // - 'scriptKind' is set and it is `Unknown` (0)
- // If the 'scriptKind' is 'undefined' or 'Unknown' then we attempt
- // to get the ScriptKind from the file name. If it cannot be resolved
- // from the file name then the default 'TS' script kind is returned.
- return scriptKind || getScriptKindFromFileName(fileName) || 3 /* TS */;
+ return scriptKind || getScriptKindFromFileName(fileName) || 3;
}
ts.ensureScriptKind = ensureScriptKind;
function getScriptKindFromFileName(fileName) {
var ext = fileName.substr(fileName.lastIndexOf("."));
switch (ext.toLowerCase()) {
- case ".js" /* Js */:
- return 1 /* JS */;
- case ".jsx" /* Jsx */:
- return 2 /* JSX */;
- case ".ts" /* Ts */:
- return 3 /* TS */;
- case ".tsx" /* Tsx */:
- return 4 /* TSX */;
- case ".json" /* Json */:
- return 6 /* JSON */;
+ case ".js":
+ return 1;
+ case ".jsx":
+ return 2;
+ case ".ts":
+ return 3;
+ case ".tsx":
+ return 4;
+ case ".json":
+ return 6;
default:
- return 0 /* Unknown */;
+ return 0;
}
}
ts.getScriptKindFromFileName = getScriptKindFromFileName;
- /**
- * List of supported extensions in order of file resolution precedence.
- */
- ts.supportedTypeScriptExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */];
- /** Must have ".d.ts" first because if ".ts" goes first, that will be detected as the extension instead of ".d.ts". */
- ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
- ts.supportedJavascriptExtensions = [".js" /* Js */, ".jsx" /* Jsx */];
+ ts.supportedTypeScriptExtensions = [".ts", ".tsx", ".d.ts"];
+ ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"];
+ ts.supportedJavascriptExtensions = [".js", ".jsx"];
var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions);
function getSupportedExtensions(options, extraFileExtensions) {
var needJsExtensions = options && options.allowJs;
if (!extraFileExtensions || extraFileExtensions.length === 0) {
return needJsExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions;
}
- var extensions = (needJsExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).concat(ts.mapDefined(extraFileExtensions, function (x) { return x.scriptKind === 7 /* Deferred */ || needJsExtensions && isJavaScriptLike(x.scriptKind) ? x.extension : undefined; }));
+ var extensions = (needJsExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).concat(ts.mapDefined(extraFileExtensions, function (x) { return x.scriptKind === 7 || needJsExtensions && isJavaScriptLike(x.scriptKind) ? x.extension : undefined; }));
return ts.deduplicate(extensions, ts.equateStringsCaseSensitive, ts.compareStringsCaseSensitive);
}
ts.getSupportedExtensions = getSupportedExtensions;
function isJavaScriptLike(scriptKind) {
- return scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */;
+ return scriptKind === 1 || scriptKind === 2;
}
function hasJavaScriptFileExtension(fileName) {
return ts.some(ts.supportedJavascriptExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); });
@@ -14728,11 +13049,6 @@ var ts;
return false;
}
ts.isSupportedSourceFileName = isSupportedSourceFileName;
- /**
- * Extension boundaries by priority. Lower numbers indicate higher priorities, and are
- * aligned to the offset of the highest priority extension in the
- * allSupportedExtensions array.
- */
var ExtensionPriority;
(function (ExtensionPriority) {
ExtensionPriority[ExtensionPriority["TypeScriptFiles"] = 0] = "TypeScriptFiles";
@@ -14746,39 +13062,31 @@ var ts;
return adjustExtensionPriority(i, supportedExtensions);
}
}
- // If its not in the list of supported extensions, this is likely a
- // TypeScript file with a non-ts extension
- return 0 /* Highest */;
+ return 0;
}
ts.getExtensionPriority = getExtensionPriority;
- /**
- * Adjusts an extension priority to be the highest priority within the same range.
- */
function adjustExtensionPriority(extensionPriority, supportedExtensions) {
- if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) {
- return 0 /* TypeScriptFiles */;
+ if (extensionPriority < 2) {
+ return 0;
}
else if (extensionPriority < supportedExtensions.length) {
- return 2 /* DeclarationAndJavaScriptFiles */;
+ return 2;
}
else {
return supportedExtensions.length;
}
}
ts.adjustExtensionPriority = adjustExtensionPriority;
- /**
- * Gets the next lowest extension priority for a given priority.
- */
function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) {
- if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) {
- return 2 /* DeclarationAndJavaScriptFiles */;
+ if (extensionPriority < 2) {
+ return 2;
}
else {
return supportedExtensions.length;
}
}
ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority;
- var extensionsToRemove = [".d.ts" /* Dts */, ".ts" /* Ts */, ".js" /* Js */, ".tsx" /* Tsx */, ".jsx" /* Jsx */, ".json" /* Json */];
+ var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx", ".json"];
function removeFileExtension(path) {
for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) {
var ext = extensionsToRemove_1[_i];
@@ -14799,7 +13107,7 @@ var ts;
}
ts.removeExtension = removeExtension;
function changeExtension(path, newExtension) {
- return changeAnyExtension(path, newExtension, extensionsToRemove, /*ignoreCase*/ false);
+ return changeAnyExtension(path, newExtension, extensionsToRemove, false);
}
ts.changeExtension = changeExtension;
function changeAnyExtension(path, ext, extensions, ignoreCase) {
@@ -14831,8 +13139,7 @@ var ts;
Debug.showSyntaxKind = showSyntaxKind;
})(Debug = ts.Debug || (ts.Debug = {}));
function tryParsePattern(pattern) {
- // This should be verified outside of here and a proper error thrown.
- Debug.assert(hasZeroOrOneAsteriskCharacter(pattern));
+ Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
var indexOfStar = pattern.indexOf("*");
return indexOfStar === -1 ? undefined : {
prefix: pattern.substr(0, indexOfStar),
@@ -14841,24 +13148,17 @@ var ts;
}
ts.tryParsePattern = tryParsePattern;
function positionIsSynthesized(pos) {
- // This is a fast way of testing the following conditions:
- // pos === undefined || pos === null || isNaN(pos) || pos < 0;
return !(pos >= 0);
}
ts.positionIsSynthesized = positionIsSynthesized;
- /** True if an extension is one of the supported TypeScript extensions. */
function extensionIsTypeScript(ext) {
- return ext === ".ts" /* Ts */ || ext === ".tsx" /* Tsx */ || ext === ".d.ts" /* Dts */;
+ return ext === ".ts" || ext === ".tsx" || ext === ".d.ts";
}
ts.extensionIsTypeScript = extensionIsTypeScript;
function resolutionExtensionIsTypeScriptOrJson(ext) {
- return extensionIsTypeScript(ext) || ext === ".json" /* Json */;
+ return extensionIsTypeScript(ext) || ext === ".json";
}
ts.resolutionExtensionIsTypeScriptOrJson = resolutionExtensionIsTypeScriptOrJson;
- /**
- * Gets the extension from a path.
- * Path must have a valid extension.
- */
function extensionFromPath(path) {
var ext = tryGetExtensionFromPath(path);
return ext !== undefined ? ext : Debug.fail("File " + path + " has unknown extension.");
@@ -14869,14 +13169,14 @@ var ts;
}
ts.isAnySupportedFileExtension = isAnySupportedFileExtension;
function tryGetExtensionFromPath(path) {
- return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (e) { return ts.fileExtensionIs(path, e); }) || ts.find(ts.supportedJavascriptExtensions, function (e) { return ts.fileExtensionIs(path, e); });
+ return ts.find(extensionsToRemove, function (e) { return ts.fileExtensionIs(path, e); });
}
ts.tryGetExtensionFromPath = tryGetExtensionFromPath;
function getAnyExtensionFromPathWorker(path, extensions, stringEqualityComparer) {
if (typeof extensions === "string")
extensions = [extensions];
- for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) {
- var extension = extensions_1[_i];
+ for (var _i = 0, extensions_2 = extensions; _i < extensions_2.length; _i++) {
+ var extension = extensions_2[_i];
if (!ts.startsWith(extension, "."))
extension = "." + extension;
if (path.length >= extension.length && path.charAt(path.length - extension.length) === ".") {
@@ -14889,8 +13189,6 @@ var ts;
return "";
}
function getAnyExtensionFromPath(path, extensions, ignoreCase) {
- // Retrieves any string from the final "." onwards from a base file name.
- // Unlike extensionFromPath, which throws an exception on unrecognized extensions.
if (extensions) {
return getAnyExtensionFromPathWorker(path, extensions, ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive);
}
@@ -14910,11 +13208,6 @@ var ts;
files: ts.emptyArray,
directories: ts.emptyArray
};
- /**
- * 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, candidate) {
var patterns = [];
for (var _i = 0, patternStrings_1 = patternStrings; _i < patternStrings_1.length; _i++) {
@@ -14924,7 +13217,6 @@ var ts;
patterns.push(pattern);
}
else if (patternString === candidate) {
- // pattern was matched as is - no need to search further
return patternString;
}
}
@@ -14943,17 +13235,15 @@ var ts;
SignatureFlags[SignatureFlags["IgnoreMissingOpenBrace"] = 16] = "IgnoreMissingOpenBrace";
SignatureFlags[SignatureFlags["JSDoc"] = 32] = "JSDoc";
})(SignatureFlags || (SignatureFlags = {}));
- // tslint:disable variable-name
var NodeConstructor;
var TokenConstructor;
var IdentifierConstructor;
var SourceFileConstructor;
- // tslint:enable variable-name
function createNode(kind, pos, end) {
- if (kind === 274 /* SourceFile */) {
+ if (kind === 274) {
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
}
- else if (kind === 71 /* Identifier */) {
+ else if (kind === 71) {
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
}
else if (!ts.isNodeKind(kind)) {
@@ -14981,49 +13271,35 @@ var ts;
}
}
}
- /*@internal*/
function isJSDocLikeText(text, start) {
- return text.charCodeAt(start + 1) === 42 /* asterisk */ &&
- text.charCodeAt(start + 2) === 42 /* asterisk */ &&
- text.charCodeAt(start + 3) !== 47 /* slash */;
+ return text.charCodeAt(start + 1) === 42 &&
+ text.charCodeAt(start + 2) === 42 &&
+ text.charCodeAt(start + 3) !== 47;
}
ts.isJSDocLikeText = isJSDocLikeText;
- /**
- * 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, cbNode, cbNodes) {
- if (!node || node.kind <= 145 /* LastToken */) {
+ if (!node || node.kind <= 145) {
return;
}
switch (node.kind) {
- case 146 /* QualifiedName */:
+ case 146:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.right);
- case 148 /* TypeParameter */:
+ case 148:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.constraint) ||
visitNode(cbNode, node.default) ||
visitNode(cbNode, node.expression);
- case 271 /* ShorthandPropertyAssignment */:
+ case 271:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.equalsToken) ||
visitNode(cbNode, node.objectAssignmentInitializer);
- case 272 /* SpreadAssignment */:
+ case 272:
return visitNode(cbNode, node.expression);
- case 149 /* Parameter */:
+ case 149:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
@@ -15031,7 +13307,7 @@ var ts;
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 152 /* PropertyDeclaration */:
+ case 152:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -15039,51 +13315,51 @@ var ts;
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 151 /* PropertySignature */:
+ case 151:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 270 /* PropertyAssignment */:
+ case 270:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.initializer);
- case 232 /* VariableDeclaration */:
+ case 232:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 182 /* BindingElement */:
+ case 182:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 163 /* FunctionType */:
- case 164 /* ConstructorType */:
- case 158 /* CallSignature */:
- case 159 /* ConstructSignature */:
- case 160 /* IndexSignature */:
+ case 163:
+ case 164:
+ case 158:
+ case 159:
+ case 160:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 154 /* MethodDeclaration */:
- case 153 /* MethodSignature */:
- case 155 /* Constructor */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
- case 192 /* FunctionExpression */:
- case 234 /* FunctionDeclaration */:
- case 193 /* ArrowFunction */:
+ case 154:
+ case 153:
+ case 155:
+ case 156:
+ case 157:
+ case 192:
+ case 234:
+ case 193:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.asteriskToken) ||
@@ -15094,304 +13370,304 @@ var ts;
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.equalsGreaterThanToken) ||
visitNode(cbNode, node.body);
- case 162 /* TypeReference */:
+ case 162:
return visitNode(cbNode, node.typeName) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 161 /* TypePredicate */:
+ case 161:
return visitNode(cbNode, node.parameterName) ||
visitNode(cbNode, node.type);
- case 165 /* TypeQuery */:
+ case 165:
return visitNode(cbNode, node.exprName);
- case 166 /* TypeLiteral */:
+ case 166:
return visitNodes(cbNode, cbNodes, node.members);
- case 167 /* ArrayType */:
+ case 167:
return visitNode(cbNode, node.elementType);
- case 168 /* TupleType */:
+ case 168:
return visitNodes(cbNode, cbNodes, node.elementTypes);
- case 169 /* UnionType */:
- case 170 /* IntersectionType */:
+ case 169:
+ case 170:
return visitNodes(cbNode, cbNodes, node.types);
- case 171 /* ConditionalType */:
+ case 171:
return visitNode(cbNode, node.checkType) ||
visitNode(cbNode, node.extendsType) ||
visitNode(cbNode, node.trueType) ||
visitNode(cbNode, node.falseType);
- case 172 /* InferType */:
+ case 172:
return visitNode(cbNode, node.typeParameter);
- case 179 /* ImportType */:
+ case 179:
return visitNode(cbNode, node.argument) ||
visitNode(cbNode, node.qualifier) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 173 /* ParenthesizedType */:
- case 175 /* TypeOperator */:
+ case 173:
+ case 175:
return visitNode(cbNode, node.type);
- case 176 /* IndexedAccessType */:
+ case 176:
return visitNode(cbNode, node.objectType) ||
visitNode(cbNode, node.indexType);
- case 177 /* MappedType */:
+ case 177:
return visitNode(cbNode, node.readonlyToken) ||
visitNode(cbNode, node.typeParameter) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type);
- case 178 /* LiteralType */:
+ case 178:
return visitNode(cbNode, node.literal);
- case 180 /* ObjectBindingPattern */:
- case 181 /* ArrayBindingPattern */:
+ case 180:
+ case 181:
return visitNodes(cbNode, cbNodes, node.elements);
- case 183 /* ArrayLiteralExpression */:
+ case 183:
return visitNodes(cbNode, cbNodes, node.elements);
- case 184 /* ObjectLiteralExpression */:
+ case 184:
return visitNodes(cbNode, cbNodes, node.properties);
- case 185 /* PropertyAccessExpression */:
+ case 185:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.name);
- case 186 /* ElementAccessExpression */:
+ case 186:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.argumentExpression);
- case 187 /* CallExpression */:
- case 188 /* NewExpression */:
+ case 187:
+ case 188:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNodes(cbNode, cbNodes, node.arguments);
- case 189 /* TaggedTemplateExpression */:
+ case 189:
return visitNode(cbNode, node.tag) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.template);
- case 190 /* TypeAssertionExpression */:
+ case 190:
return visitNode(cbNode, node.type) ||
visitNode(cbNode, node.expression);
- case 191 /* ParenthesizedExpression */:
+ case 191:
return visitNode(cbNode, node.expression);
- case 194 /* DeleteExpression */:
+ case 194:
return visitNode(cbNode, node.expression);
- case 195 /* TypeOfExpression */:
+ case 195:
return visitNode(cbNode, node.expression);
- case 196 /* VoidExpression */:
+ case 196:
return visitNode(cbNode, node.expression);
- case 198 /* PrefixUnaryExpression */:
+ case 198:
return visitNode(cbNode, node.operand);
- case 203 /* YieldExpression */:
+ case 203:
return visitNode(cbNode, node.asteriskToken) ||
visitNode(cbNode, node.expression);
- case 197 /* AwaitExpression */:
+ case 197:
return visitNode(cbNode, node.expression);
- case 199 /* PostfixUnaryExpression */:
+ case 199:
return visitNode(cbNode, node.operand);
- case 200 /* BinaryExpression */:
+ case 200:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.operatorToken) ||
visitNode(cbNode, node.right);
- case 208 /* AsExpression */:
+ case 208:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.type);
- case 209 /* NonNullExpression */:
+ case 209:
return visitNode(cbNode, node.expression);
- case 210 /* MetaProperty */:
+ case 210:
return visitNode(cbNode, node.name);
- case 201 /* ConditionalExpression */:
+ case 201:
return visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.whenTrue) ||
visitNode(cbNode, node.colonToken) ||
visitNode(cbNode, node.whenFalse);
- case 204 /* SpreadElement */:
+ case 204:
return visitNode(cbNode, node.expression);
- case 213 /* Block */:
- case 240 /* ModuleBlock */:
+ case 213:
+ case 240:
return visitNodes(cbNode, cbNodes, node.statements);
- case 274 /* SourceFile */:
+ case 274:
return visitNodes(cbNode, cbNodes, node.statements) ||
visitNode(cbNode, node.endOfFileToken);
- case 214 /* VariableStatement */:
+ case 214:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.declarationList);
- case 233 /* VariableDeclarationList */:
+ case 233:
return visitNodes(cbNode, cbNodes, node.declarations);
- case 216 /* ExpressionStatement */:
+ case 216:
return visitNode(cbNode, node.expression);
- case 217 /* IfStatement */:
+ case 217:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.thenStatement) ||
visitNode(cbNode, node.elseStatement);
- case 218 /* DoStatement */:
+ case 218:
return visitNode(cbNode, node.statement) ||
visitNode(cbNode, node.expression);
- case 219 /* WhileStatement */:
+ case 219:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 220 /* ForStatement */:
+ case 220:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.incrementor) ||
visitNode(cbNode, node.statement);
- case 221 /* ForInStatement */:
+ case 221:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 222 /* ForOfStatement */:
+ case 222:
return visitNode(cbNode, node.awaitModifier) ||
visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 223 /* ContinueStatement */:
- case 224 /* BreakStatement */:
+ case 223:
+ case 224:
return visitNode(cbNode, node.label);
- case 225 /* ReturnStatement */:
+ case 225:
return visitNode(cbNode, node.expression);
- case 226 /* WithStatement */:
+ case 226:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 227 /* SwitchStatement */:
+ case 227:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.caseBlock);
- case 241 /* CaseBlock */:
+ case 241:
return visitNodes(cbNode, cbNodes, node.clauses);
- case 266 /* CaseClause */:
+ case 266:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.statements);
- case 267 /* DefaultClause */:
+ case 267:
return visitNodes(cbNode, cbNodes, node.statements);
- case 228 /* LabeledStatement */:
+ case 228:
return visitNode(cbNode, node.label) ||
visitNode(cbNode, node.statement);
- case 229 /* ThrowStatement */:
+ case 229:
return visitNode(cbNode, node.expression);
- case 230 /* TryStatement */:
+ case 230:
return visitNode(cbNode, node.tryBlock) ||
visitNode(cbNode, node.catchClause) ||
visitNode(cbNode, node.finallyBlock);
- case 269 /* CatchClause */:
+ case 269:
return visitNode(cbNode, node.variableDeclaration) ||
visitNode(cbNode, node.block);
- case 150 /* Decorator */:
+ case 150:
return visitNode(cbNode, node.expression);
- case 235 /* ClassDeclaration */:
- case 205 /* ClassExpression */:
+ case 235:
+ case 205:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 236 /* InterfaceDeclaration */:
+ case 236:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 237 /* TypeAliasDeclaration */:
+ case 237:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNode(cbNode, node.type);
- case 238 /* EnumDeclaration */:
+ case 238:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.members);
- case 273 /* EnumMember */:
+ case 273:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 239 /* ModuleDeclaration */:
+ case 239:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.body);
- case 243 /* ImportEqualsDeclaration */:
+ case 243:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.moduleReference);
- case 244 /* ImportDeclaration */:
+ case 244:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.importClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 245 /* ImportClause */:
+ case 245:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.namedBindings);
- case 242 /* NamespaceExportDeclaration */:
+ case 242:
return visitNode(cbNode, node.name);
- case 246 /* NamespaceImport */:
+ case 246:
return visitNode(cbNode, node.name);
- case 247 /* NamedImports */:
- case 251 /* NamedExports */:
+ case 247:
+ case 251:
return visitNodes(cbNode, cbNodes, node.elements);
- case 250 /* ExportDeclaration */:
+ case 250:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.exportClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 248 /* ImportSpecifier */:
- case 252 /* ExportSpecifier */:
+ case 248:
+ case 252:
return visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name);
- case 249 /* ExportAssignment */:
+ case 249:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.expression);
- case 202 /* TemplateExpression */:
+ case 202:
return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans);
- case 211 /* TemplateSpan */:
+ case 211:
return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
- case 147 /* ComputedPropertyName */:
+ case 147:
return visitNode(cbNode, node.expression);
- case 268 /* HeritageClause */:
+ case 268:
return visitNodes(cbNode, cbNodes, node.types);
- case 207 /* ExpressionWithTypeArguments */:
+ case 207:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 254 /* ExternalModuleReference */:
+ case 254:
return visitNode(cbNode, node.expression);
- case 253 /* MissingDeclaration */:
+ case 253:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 302 /* CommaListExpression */:
+ case 303:
return visitNodes(cbNode, cbNodes, node.elements);
- case 255 /* JsxElement */:
+ case 255:
return visitNode(cbNode, node.openingElement) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingElement);
- case 259 /* JsxFragment */:
+ case 259:
return visitNode(cbNode, node.openingFragment) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingFragment);
- case 256 /* JsxSelfClosingElement */:
- case 257 /* JsxOpeningElement */:
+ case 256:
+ case 257:
return visitNode(cbNode, node.tagName) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.attributes);
- case 263 /* JsxAttributes */:
+ case 263:
return visitNodes(cbNode, cbNodes, node.properties);
- case 262 /* JsxAttribute */:
+ case 262:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 264 /* JsxSpreadAttribute */:
+ case 264:
return visitNode(cbNode, node.expression);
- case 265 /* JsxExpression */:
+ case 265:
return visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.expression);
- case 258 /* JsxClosingElement */:
+ case 258:
return visitNode(cbNode, node.tagName);
- case 278 /* JSDocTypeExpression */:
+ case 278:
return visitNode(cbNode, node.type);
- case 282 /* JSDocNonNullableType */:
+ case 282:
return visitNode(cbNode, node.type);
- case 281 /* JSDocNullableType */:
+ case 281:
return visitNode(cbNode, node.type);
- case 283 /* JSDocOptionalType */:
+ case 283:
return visitNode(cbNode, node.type);
- case 284 /* JSDocFunctionType */:
+ case 284:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 285 /* JSDocVariadicType */:
+ case 285:
return visitNode(cbNode, node.type);
- case 286 /* JSDocComment */:
+ case 286:
return visitNodes(cbNode, cbNodes, node.tags);
- case 293 /* JSDocParameterTag */:
- case 298 /* JSDocPropertyTag */:
+ case 293:
+ case 299:
if (node.isNameFirst) {
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression);
@@ -15400,17 +13676,17 @@ var ts;
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name);
}
- case 294 /* JSDocReturnTag */:
+ case 294:
return visitNode(cbNode, node.typeExpression);
- case 295 /* JSDocTypeTag */:
+ case 296:
return visitNode(cbNode, node.typeExpression);
- case 290 /* JSDocAugmentsTag */:
+ case 290:
return visitNode(cbNode, node.class);
- case 296 /* JSDocTemplateTag */:
+ case 297:
return visitNodes(cbNode, cbNodes, node.typeParameters);
- case 297 /* JSDocTypedefTag */:
+ case 298:
if (node.typeExpression &&
- node.typeExpression.kind === 278 /* JSDocTypeExpression */) {
+ node.typeExpression.kind === 278) {
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName);
}
@@ -15418,16 +13694,18 @@ var ts;
return visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
}
- case 292 /* JSDocCallbackTag */:
+ case 292:
return visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 288 /* JSDocSignature */:
+ case 295:
+ return visitNode(cbNode, node.typeExpression);
+ case 288:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 287 /* JSDocTypeLiteral */:
+ case 287:
if (node.jsDocPropertyTags) {
for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) {
var tag = _a[_i];
@@ -15435,7 +13713,7 @@ var ts;
}
}
return;
- case 301 /* PartiallyEmittedExpression */:
+ case 302:
return visitNode(cbNode, node.expression);
}
}
@@ -15444,11 +13722,11 @@ var ts;
if (setParentNodes === void 0) { setParentNodes = false; }
ts.performance.mark("beforeParse");
var result;
- if (languageVersion === 100 /* JSON */) {
- result = Parser.parseJsonText(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes);
+ if (languageVersion === 100) {
+ result = Parser.parseJsonText(fileName, sourceText, languageVersion, undefined, setParentNodes);
}
else {
- result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind);
+ result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, scriptKind);
}
ts.performance.mark("afterParse");
ts.performance.measure("Parse", "beforeParse", "afterParse");
@@ -15459,71 +13737,41 @@ var ts;
return Parser.parseIsolatedEntityName(text, languageVersion);
}
ts.parseIsolatedEntityName = parseIsolatedEntityName;
- /**
- * Parse json text into SyntaxTree and return node and parse errors if any
- * @param fileName
- * @param sourceText
- */
function parseJsonText(fileName, sourceText) {
return Parser.parseJsonText(fileName, sourceText);
}
ts.parseJsonText = parseJsonText;
- // See also `isExternalOrCommonJsModule` in utilities.ts
function isExternalModule(file) {
return file.externalModuleIndicator !== undefined;
}
ts.isExternalModule = isExternalModule;
- // Produces a new SourceFile for the 'newText' provided. The 'textChangeRange' parameter
- // indicates what changed between the 'text' that this SourceFile has and the 'newText'.
- // The SourceFile will be created with the compiler attempting to reuse as many nodes from
- // this file as possible.
- //
- // Note: this function mutates nodes from this SourceFile. That means any existing nodes
- // from this SourceFile that are being held onto may change as a result (including
- // becoming detached from any SourceFile). It is recommended that this SourceFile not
- // be used once 'update' is called on it.
function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {
if (aggressiveChecks === void 0) { aggressiveChecks = false; }
var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
- // Because new source file node is created, it may not have the flag PossiblyContainDynamicImport. This is the case if there is no new edit to add dynamic import.
- // We will manually port the flag to the new source file.
- newSourceFile.flags |= (sourceFile.flags & 1572864 /* PermanentlySetIncrementalFlags */);
+ newSourceFile.flags |= (sourceFile.flags & 1572864);
return newSourceFile;
}
ts.updateSourceFile = updateSourceFile;
- /* @internal */
function parseIsolatedJSDocComment(content, start, length) {
var result = Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length);
if (result && result.jsDoc) {
- // because the jsDocComment was parsed out of the source file, it might
- // not be covered by the fixupParentReferences.
Parser.fixupParentReferences(result.jsDoc);
}
return result;
}
ts.parseIsolatedJSDocComment = parseIsolatedJSDocComment;
- /* @internal */
- // Exposed only for testing.
function parseJSDocTypeExpressionForTests(content, start, length) {
return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length);
}
ts.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
- // Implement the parser as a singleton module. We do this for perf reasons because creating
- // parser instances can actually be expensive enough to impact us on projects with many source
- // files.
var Parser;
(function (Parser) {
- // Share a single scanner across all calls to parse a source file. This helps speed things
- // up by avoiding the cost of creating/compiling scanners over and over again.
- var scanner = ts.createScanner(6 /* Latest */, /*skipTrivia*/ true);
- var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */;
- // capture constructors in 'initializeState' to avoid null checks
- // tslint:disable variable-name
+ var scanner = ts.createScanner(6, true);
+ var disallowInAndDecoratorContext = 2048 | 8192;
var NodeConstructor;
var TokenConstructor;
var IdentifierConstructor;
var SourceFileConstructor;
- // tslint:enable variable-name
var sourceFile;
var parseDiagnostics;
var syntaxCursor;
@@ -15533,87 +13781,14 @@ var ts;
var identifiers;
var identifierCount;
var parsingContext;
- // Flags that dictate what parsing context we're in. For example:
- // Whether or not we are in strict parsing mode. All that changes in strict parsing mode is
- // that some tokens that would be considered identifiers may be considered keywords.
- //
- // When adding more parser context flags, consider which is the more common case that the
- // flag will be in. This should be the 'false' state for that flag. The reason for this is
- // that we don't store data in our nodes unless the value is in the *non-default* state. So,
- // for example, more often than code 'allows-in' (or doesn't 'disallow-in'). We opt for
- // 'disallow-in' set to 'false'. Otherwise, if we had 'allowsIn' set to 'true', then almost
- // all nodes would need extra state on them to store this info.
- //
- // Note: 'allowIn' and 'allowYield' track 1:1 with the [in] and [yield] concepts in the ES6
- // grammar specification.
- //
- // An important thing about these context concepts. By default they are effectively inherited
- // while parsing through every grammar production. i.e. if you don't change them, then when
- // you parse a sub-production, it will have the same context values as the parent production.
- // This is great most of the time. After all, consider all the 'expression' grammar productions
- // and how nearly all of them pass along the 'in' and 'yield' context values:
- //
- // EqualityExpression[In, Yield] :
- // RelationalExpression[?In, ?Yield]
- // EqualityExpression[?In, ?Yield] == RelationalExpression[?In, ?Yield]
- // EqualityExpression[?In, ?Yield] != RelationalExpression[?In, ?Yield]
- // EqualityExpression[?In, ?Yield] === RelationalExpression[?In, ?Yield]
- // EqualityExpression[?In, ?Yield] !== RelationalExpression[?In, ?Yield]
- //
- // Where you have to be careful is then understanding what the points are in the grammar
- // where the values are *not* passed along. For example:
- //
- // SingleNameBinding[Yield,GeneratorParameter]
- // [+GeneratorParameter]BindingIdentifier[Yield] Initializer[In]opt
- // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt
- //
- // Here this is saying that if the GeneratorParameter context flag is set, that we should
- // explicitly set the 'yield' context flag to false before calling into the BindingIdentifier
- // and we should explicitly unset the 'yield' context flag before calling into the Initializer.
- // production. Conversely, if the GeneratorParameter context flag is not set, then we
- // should leave the 'yield' context flag alone.
- //
- // Getting this all correct is tricky and requires careful reading of the grammar to
- // understand when these values should be changed versus when they should be inherited.
- //
- // Note: it should not be necessary to save/restore these flags during speculative/lookahead
- // parsing. These context flags are naturally stored and restored through normal recursive
- // descent parsing and unwinding.
var contextFlags;
- // Whether or not we've had a parse error since creating the last AST node. If we have
- // encountered an error, it will be stored on the next AST node we create. Parse errors
- // can be broken down into three categories:
- //
- // 1) An error that occurred during scanning. For example, an unterminated literal, or a
- // character that was completely not understood.
- //
- // 2) A token was expected, but was not present. This type of error is commonly produced
- // by the 'parseExpected' function.
- //
- // 3) A token was present that no parsing function was able to consume. This type of error
- // only occurs in the 'abortParsingListOrMoveToNextToken' function when the parser
- // decides to skip the token.
- //
- // In all of these cases, we want to mark the next node as having had an error before it.
- // With this mark, we can know in incremental settings if this node can be reused, or if
- // we have to reparse it. If we don't keep this information around, we may just reuse the
- // node. in that event we would then not produce the same errors as we did before, causing
- // significant confusion problems.
- //
- // Note: it is necessary that this value be saved/restored during speculative/lookahead
- // parsing. During lookahead parsing, we will often create a node. That node will have
- // this value attached, and then this value will be set back to 'false'. If we decide to
- // rewind, we must get back to the same value we had prior to the lookahead.
- //
- // Note: any errors at the end of the file that do not precede a regular node, should get
- // attached to the EOF token.
var parseErrorBeforeNextFinishedNode = false;
function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) {
if (setParentNodes === void 0) { setParentNodes = false; }
scriptKind = ts.ensureScriptKind(fileName, scriptKind);
- if (scriptKind === 6 /* JSON */) {
+ if (scriptKind === 6) {
var result_1 = parseJsonText(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes);
- ts.convertToObjectWorker(result_1, result_1.parseDiagnostics, /*returnValue*/ false, /*knownRootOptions*/ undefined, /*jsonConversionNotifier*/ undefined);
+ ts.convertToObjectWorker(result_1, result_1.parseDiagnostics, false, undefined, undefined);
result_1.typeReferenceDirectives = ts.emptyArray;
result_1.amdDependencies = ts.emptyArray;
return result_1;
@@ -15625,62 +13800,57 @@ var ts;
}
Parser.parseSourceFile = parseSourceFile;
function parseIsolatedEntityName(content, languageVersion) {
- // Choice of `isDeclarationFile` should be arbitrary
- initializeState(content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */);
- // Prime the scanner.
+ initializeState(content, languageVersion, undefined, 1);
nextToken();
- var entityName = parseEntityName(/*allowReservedWords*/ true);
- var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
+ var entityName = parseEntityName(true);
+ var isInvalid = token() === 1 && !parseDiagnostics.length;
clearState();
return isInvalid ? entityName : undefined;
}
Parser.parseIsolatedEntityName = parseIsolatedEntityName;
function parseJsonText(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes) {
- if (languageVersion === void 0) { languageVersion = 2 /* ES2015 */; }
- initializeState(sourceText, languageVersion, syntaxCursor, 6 /* JSON */);
- // Set source file so that errors will be reported with this file name
- sourceFile = createSourceFile(fileName, 2 /* ES2015 */, 6 /* JSON */, /*isDeclaration*/ false);
+ if (languageVersion === void 0) { languageVersion = 2; }
+ initializeState(sourceText, languageVersion, syntaxCursor, 6);
+ sourceFile = createSourceFile(fileName, 2, 6, false);
sourceFile.flags = contextFlags;
- // Prime the scanner.
nextToken();
var pos = getNodePos();
- if (token() === 1 /* EndOfFileToken */) {
+ if (token() === 1) {
sourceFile.statements = createNodeArray([], pos, pos);
sourceFile.endOfFileToken = parseTokenNode();
}
else {
- var statement = createNode(216 /* ExpressionStatement */);
+ var statement = createNode(216);
switch (token()) {
- case 21 /* OpenBracketToken */:
+ case 21:
statement.expression = parseArrayLiteralExpression();
break;
- case 101 /* TrueKeyword */:
- case 86 /* FalseKeyword */:
- case 95 /* NullKeyword */:
+ case 101:
+ case 86:
+ case 95:
statement.expression = parseTokenNode();
break;
- case 38 /* MinusToken */:
- if (lookAhead(function () { return nextToken() === 8 /* NumericLiteral */ && nextToken() !== 56 /* ColonToken */; })) {
+ case 38:
+ if (lookAhead(function () { return nextToken() === 8 && nextToken() !== 56; })) {
statement.expression = parsePrefixUnaryExpression();
}
else {
statement.expression = parseObjectLiteralExpression();
}
break;
- case 8 /* NumericLiteral */:
- case 9 /* StringLiteral */:
- if (lookAhead(function () { return nextToken() !== 56 /* ColonToken */; })) {
+ case 8:
+ case 9:
+ if (lookAhead(function () { return nextToken() !== 56; })) {
statement.expression = parseLiteralNode();
break;
}
- // falls through
default:
statement.expression = parseObjectLiteralExpression();
break;
}
finishNode(statement);
sourceFile.statements = createNodeArray([statement], pos);
- sourceFile.endOfFileToken = parseExpectedToken(1 /* EndOfFileToken */, ts.Diagnostics.Unexpected_token);
+ sourceFile.endOfFileToken = parseExpectedToken(1, ts.Diagnostics.Unexpected_token);
}
if (setParentNodes) {
fixupParentReferences(sourceFile);
@@ -15692,8 +13862,7 @@ var ts;
}
Parser.parseJsonText = parseJsonText;
function getLanguageVariant(scriptKind) {
- // .tsx and .jsx files are treated as jsx language variant.
- return scriptKind === 4 /* TSX */ || scriptKind === 2 /* JSX */ || scriptKind === 1 /* JS */ || scriptKind === 6 /* JSON */ ? 1 /* JSX */ : 0 /* Standard */;
+ return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 || scriptKind === 6 ? 1 : 0;
}
function initializeState(_sourceText, languageVersion, _syntaxCursor, scriptKind) {
NodeConstructor = ts.objectAllocator.getNodeConstructor();
@@ -15708,29 +13877,26 @@ var ts;
identifierCount = 0;
nodeCount = 0;
switch (scriptKind) {
- case 1 /* JS */:
- case 2 /* JSX */:
- contextFlags = 65536 /* JavaScriptFile */;
+ case 1:
+ case 2:
+ contextFlags = 65536;
break;
- case 6 /* JSON */:
- contextFlags = 65536 /* JavaScriptFile */ | 16777216 /* JsonFile */;
+ case 6:
+ contextFlags = 65536 | 16777216;
break;
default:
- contextFlags = 0 /* None */;
+ contextFlags = 0;
break;
}
parseErrorBeforeNextFinishedNode = false;
- // Initialize and prime the scanner before parsing the source elements.
scanner.setText(sourceText);
scanner.setOnError(scanError);
scanner.setScriptTarget(languageVersion);
scanner.setLanguageVariant(getLanguageVariant(scriptKind));
}
function clearState() {
- // Clear out the text the scanner is pointing at, so it doesn't keep anything alive unnecessarily.
scanner.setText("");
scanner.setOnError(undefined);
- // Clear any data. We don't want to accidentally hold onto it for too long.
parseDiagnostics = undefined;
sourceFile = undefined;
identifiers = undefined;
@@ -15740,17 +13906,15 @@ var ts;
function parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind) {
var isDeclarationFile = isDeclarationFileName(fileName);
if (isDeclarationFile) {
- contextFlags |= 4194304 /* Ambient */;
+ contextFlags |= 4194304;
}
sourceFile = createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile);
sourceFile.flags = contextFlags;
- // Prime the scanner.
nextToken();
- // A member of ReadonlyArray isn't assignable to a member of T[] (and prevents a direct cast) - but this is where we set up those members so they can be readonly in the future
processCommentPragmas(sourceFile, sourceText);
processPragmasIntoFields(sourceFile, reportPragmaDiagnostic);
- sourceFile.statements = parseList(0 /* SourceElements */, parseStatement);
- ts.Debug.assert(token() === 1 /* EndOfFileToken */);
+ sourceFile.statements = parseList(0, parseStatement);
+ ts.Debug.assert(token() === 1);
sourceFile.endOfFileToken = addJSDocComment(parseTokenNode());
setExternalModuleIndicator(sourceFile);
sourceFile.nodeCount = nodeCount;
@@ -15776,17 +13940,10 @@ var ts;
return node;
}
function fixupParentReferences(rootNode) {
- // normally parent references are set during binding. However, for clients that only need
- // a syntax tree, and no semantic features, then the binding process is an unnecessary
- // overhead. This functions allows us to set all the parents, without all the expense of
- // binding.
var parent = rootNode;
forEachChild(rootNode, visitNode);
return;
function visitNode(n) {
- // walk down setting parents that differ from the parent we think it should be. This
- // allows us to quickly bail out of setting parents for subtrees during incremental
- // parsing
if (n.parent !== parent) {
n.parent = parent;
var saveParent = parent;
@@ -15806,9 +13963,7 @@ var ts;
}
Parser.fixupParentReferences = fixupParentReferences;
function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) {
- // code from createNode is inlined here so createNode won't have to deal with special case of creating source files
- // this is quite rare comparing to other nodes and createNode should be as fast as possible
- var sourceFile = new SourceFileConstructor(274 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
+ var sourceFile = new SourceFileConstructor(274, 0, sourceText.length);
nodeCount++;
sourceFile.text = sourceText;
sourceFile.bindDiagnostics = [];
@@ -15829,102 +13984,81 @@ var ts;
}
}
function setDisallowInContext(val) {
- setContextFlag(val, 2048 /* DisallowInContext */);
+ setContextFlag(val, 2048);
}
function setYieldContext(val) {
- setContextFlag(val, 4096 /* YieldContext */);
+ setContextFlag(val, 4096);
}
function setDecoratorContext(val) {
- setContextFlag(val, 8192 /* DecoratorContext */);
+ setContextFlag(val, 8192);
}
function setAwaitContext(val) {
- setContextFlag(val, 16384 /* AwaitContext */);
+ setContextFlag(val, 16384);
}
function doOutsideOfContext(context, func) {
- // contextFlagsToClear will contain only the context flags that are
- // currently set that we need to temporarily clear
- // We don't just blindly reset to the previous flags to ensure
- // that we do not mutate cached flags for the incremental
- // parser (ThisNodeHasError, ThisNodeOrAnySubNodesHasError, and
- // HasAggregatedChildData).
var contextFlagsToClear = context & contextFlags;
if (contextFlagsToClear) {
- // clear the requested context flags
- setContextFlag(/*val*/ false, contextFlagsToClear);
+ setContextFlag(false, contextFlagsToClear);
var result = func();
- // restore the context flags we just cleared
- setContextFlag(/*val*/ true, contextFlagsToClear);
+ setContextFlag(true, contextFlagsToClear);
return result;
}
- // no need to do anything special as we are not in any of the requested contexts
return func();
}
function doInsideOfContext(context, func) {
- // contextFlagsToSet will contain only the context flags that
- // are not currently set that we need to temporarily enable.
- // We don't just blindly reset to the previous flags to ensure
- // that we do not mutate cached flags for the incremental
- // parser (ThisNodeHasError, ThisNodeOrAnySubNodesHasError, and
- // HasAggregatedChildData).
var contextFlagsToSet = context & ~contextFlags;
if (contextFlagsToSet) {
- // set the requested context flags
- setContextFlag(/*val*/ true, contextFlagsToSet);
+ setContextFlag(true, contextFlagsToSet);
var result = func();
- // reset the context flags we just set
- setContextFlag(/*val*/ false, contextFlagsToSet);
+ setContextFlag(false, contextFlagsToSet);
return result;
}
- // no need to do anything special as we are already in all of the requested contexts
return func();
}
function allowInAnd(func) {
- return doOutsideOfContext(2048 /* DisallowInContext */, func);
+ return doOutsideOfContext(2048, func);
}
function disallowInAnd(func) {
- return doInsideOfContext(2048 /* DisallowInContext */, func);
+ return doInsideOfContext(2048, func);
}
function doInYieldContext(func) {
- return doInsideOfContext(4096 /* YieldContext */, func);
+ return doInsideOfContext(4096, func);
}
function doInDecoratorContext(func) {
- return doInsideOfContext(8192 /* DecoratorContext */, func);
+ return doInsideOfContext(8192, func);
}
function doInAwaitContext(func) {
- return doInsideOfContext(16384 /* AwaitContext */, func);
+ return doInsideOfContext(16384, func);
}
function doOutsideOfAwaitContext(func) {
- return doOutsideOfContext(16384 /* AwaitContext */, func);
+ return doOutsideOfContext(16384, func);
}
function doInYieldAndAwaitContext(func) {
- return doInsideOfContext(4096 /* YieldContext */ | 16384 /* AwaitContext */, func);
+ return doInsideOfContext(4096 | 16384, func);
}
function inContext(flags) {
return (contextFlags & flags) !== 0;
}
function inYieldContext() {
- return inContext(4096 /* YieldContext */);
+ return inContext(4096);
}
function inDisallowInContext() {
- return inContext(2048 /* DisallowInContext */);
+ return inContext(2048);
}
function inDecoratorContext() {
- return inContext(8192 /* DecoratorContext */);
+ return inContext(8192);
}
function inAwaitContext() {
- return inContext(16384 /* AwaitContext */);
+ return inContext(16384);
}
function parseErrorAtCurrentToken(message, arg0) {
parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
}
function parseErrorAtPosition(start, length, message, arg0) {
- // Don't report another error if it would just be at the same position as the last error.
var lastError = ts.lastOrUndefined(parseDiagnostics);
if (!lastError || start !== lastError.start) {
parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0));
}
- // Mark that we've encountered an error. We'll set an appropriate bit on the next
- // node we finish so that it can't be reused incrementally.
parseErrorBeforeNextFinishedNode = true;
}
function parseErrorAt(start, end, message, arg0) {
@@ -15939,12 +14073,6 @@ var ts;
function getNodePos() {
return scanner.getStartPos();
}
- // Use this function to access the current token instead of reading the currentToken
- // variable. Since function results aren't narrowed in control flow analysis, this ensures
- // that the type checker doesn't make wrong assumptions about the type of the current
- // token (e.g. a call to nextToken() changes the current token but the checker doesn't
- // reason about this side effect). Mainstream VMs inline simple functions like this, so
- // there is no performance penalty.
function token() {
return currentToken;
}
@@ -15970,25 +14098,14 @@ var ts;
return currentToken = scanner.scanJsxAttributeValue();
}
function speculationHelper(callback, isLookAhead) {
- // Keep track of the state we'll need to rollback to if lookahead fails (or if the
- // caller asked us to always reset our state).
var saveToken = currentToken;
var saveParseDiagnosticsLength = parseDiagnostics.length;
var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
- // Note: it is not actually necessary to save/restore the context flags here. That's
- // because the saving/restoring of these flags happens naturally through the recursive
- // descent nature of our parser. However, we still store this here just so we can
- // assert that invariant holds.
var saveContextFlags = contextFlags;
- // If we're only looking ahead, then tell the scanner to only lookahead as well.
- // Otherwise, if we're actually speculatively parsing, then tell the scanner to do the
- // same.
var result = isLookAhead
? scanner.lookAhead(callback)
: scanner.tryScan(callback);
ts.Debug.assert(saveContextFlags === contextFlags);
- // If our callback returned something 'falsy' or we're just looking ahead,
- // then unconditionally restore us to where we were.
if (!result || isLookAhead) {
currentToken = saveToken;
parseDiagnostics.length = saveParseDiagnosticsLength;
@@ -15996,37 +14113,23 @@ var ts;
}
return result;
}
- /** Invokes the provided callback then unconditionally restores the parser to the state it
- * was in immediately prior to invoking the callback. The result of invoking the callback
- * is returned from this function.
- */
function lookAhead(callback) {
- return speculationHelper(callback, /*isLookAhead*/ true);
+ return speculationHelper(callback, true);
}
- /** Invokes the provided callback. If the callback returns something falsy, then it restores
- * the parser to the state it was in immediately prior to invoking the callback. If the
- * callback returns something truthy, then the parser state is not rolled back. The result
- * of invoking the callback is returned from this function.
- */
function tryParse(callback) {
- return speculationHelper(callback, /*isLookAhead*/ false);
+ return speculationHelper(callback, false);
}
- // Ignore strict mode flag because we will report an error in type checker instead.
function isIdentifier() {
- if (token() === 71 /* Identifier */) {
+ if (token() === 71) {
return true;
}
- // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is
- // considered a keyword and is not an identifier.
- if (token() === 116 /* YieldKeyword */ && inYieldContext()) {
+ if (token() === 116 && inYieldContext()) {
return false;
}
- // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is
- // considered a keyword and is not an identifier.
- if (token() === 121 /* AwaitKeyword */ && inAwaitContext()) {
+ if (token() === 121 && inAwaitContext()) {
return false;
}
- return token() > 107 /* LastReservedWord */;
+ return token() > 107;
}
function parseExpected(kind, diagnosticMessage, shouldAdvance) {
if (shouldAdvance === void 0) { shouldAdvance = true; }
@@ -16036,7 +14139,6 @@ var ts;
}
return true;
}
- // Report specific message if provided with one. Otherwise, report generic fallback message.
if (diagnosticMessage) {
parseErrorAtCurrentToken(diagnosticMessage);
}
@@ -16060,7 +14162,7 @@ var ts;
}
function parseExpectedToken(t, diagnosticMessage, arg0) {
return parseOptionalToken(t) ||
- createMissingNode(t, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics._0_expected, arg0 || ts.tokenToString(t));
+ createMissingNode(t, false, diagnosticMessage || ts.Diagnostics._0_expected, arg0 || ts.tokenToString(t));
}
function parseTokenNode() {
var node = createNode(token());
@@ -16068,43 +14170,37 @@ var ts;
return finishNode(node);
}
function canParseSemicolon() {
- // If there's a real semicolon, then we can always parse it out.
- if (token() === 25 /* SemicolonToken */) {
+ if (token() === 25) {
return true;
}
- // We can parse out an optional semicolon in ASI cases in the following cases.
- return token() === 18 /* CloseBraceToken */ || token() === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak();
+ return token() === 18 || token() === 1 || scanner.hasPrecedingLineBreak();
}
function parseSemicolon() {
if (canParseSemicolon()) {
- if (token() === 25 /* SemicolonToken */) {
- // consume the semicolon if it was explicitly provided.
+ if (token() === 25) {
nextToken();
}
return true;
}
else {
- return parseExpected(25 /* SemicolonToken */);
+ return parseExpected(25);
}
}
function createNode(kind, pos) {
nodeCount++;
var p = pos >= 0 ? pos : scanner.getStartPos();
- return ts.isNodeKind(kind) || kind === 0 /* Unknown */ ? new NodeConstructor(kind, p, p) :
- kind === 71 /* Identifier */ ? new IdentifierConstructor(kind, p, p) :
+ return ts.isNodeKind(kind) || kind === 0 ? new NodeConstructor(kind, p, p) :
+ kind === 71 ? new IdentifierConstructor(kind, p, p) :
new TokenConstructor(kind, p, p);
}
function createNodeWithJSDoc(kind, pos) {
var node = createNode(kind, pos);
- if (scanner.getTokenFlags() & 2 /* PrecedingJSDocComment */) {
+ if (scanner.getTokenFlags() & 2) {
addJSDocComment(node);
}
return node;
}
function createNodeArray(elements, pos, end) {
- // Since the element list of a node array is typically created by starting with an empty array and
- // repeatedly calling push(), the list may not have the optimal memory layout. We invoke slice() for
- // small arrays (1 to 4 elements) to give the VM a chance to allocate an optimal representation.
var length = elements.length;
var array = (length >= 1 && length <= 4 ? elements.slice() : elements);
array.pos = pos;
@@ -16116,12 +14212,9 @@ var ts;
if (contextFlags) {
node.flags |= contextFlags;
}
- // Keep track on the node if we encountered an error while parsing it. If we did, then
- // we cannot reuse the node incrementally. Once we've marked this node, clear out the
- // flag so that we don't mark any subsequent nodes.
if (parseErrorBeforeNextFinishedNode) {
parseErrorBeforeNextFinishedNode = false;
- node.flags |= 32768 /* ThisNodeHasError */;
+ node.flags |= 32768;
}
return node;
}
@@ -16133,7 +14226,7 @@ var ts;
parseErrorAtCurrentToken(diagnosticMessage, arg0);
}
var result = createNode(kind);
- if (kind === 71 /* Identifier */) {
+ if (kind === 71) {
result.escapedText = "";
}
else if (ts.isLiteralKind(kind) || ts.isTemplateLiteralKind(kind)) {
@@ -16148,24 +14241,19 @@ var ts;
}
return identifier;
}
- // An identifier that starts with two underscores has an extra underscore character prepended to it to avoid issues
- // with magic property names like '__proto__'. The 'identifiers' object is used to share a single string instance for
- // each identifier in order to reduce memory consumption.
function createIdentifier(isIdentifier, diagnosticMessage) {
identifierCount++;
if (isIdentifier) {
- var node = createNode(71 /* Identifier */);
- // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker
- if (token() !== 71 /* Identifier */) {
+ var node = createNode(71);
+ if (token() !== 71) {
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
nextToken();
return finishNode(node);
}
- // Only for end of file because the error gets reported incorrectly on embedded script tags.
- var reportAtCurrentPosition = token() === 1 /* EndOfFileToken */;
- return createMissingNode(71 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
+ var reportAtCurrentPosition = token() === 1;
+ return createMissingNode(71, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
}
function parseIdentifier(diagnosticMessage) {
return createIdentifier(isIdentifier(), diagnosticMessage);
@@ -16175,34 +14263,28 @@ var ts;
}
function isLiteralPropertyName() {
return ts.tokenIsIdentifierOrKeyword(token()) ||
- token() === 9 /* StringLiteral */ ||
- token() === 8 /* NumericLiteral */;
+ token() === 9 ||
+ token() === 8;
}
function parsePropertyNameWorker(allowComputedPropertyNames) {
- if (token() === 9 /* StringLiteral */ || token() === 8 /* NumericLiteral */) {
+ if (token() === 9 || token() === 8) {
var node = parseLiteralNode();
node.text = internIdentifier(node.text);
return node;
}
- if (allowComputedPropertyNames && token() === 21 /* OpenBracketToken */) {
+ if (allowComputedPropertyNames && token() === 21) {
return parseComputedPropertyName();
}
return parseIdentifierName();
}
function parsePropertyName() {
- return parsePropertyNameWorker(/*allowComputedPropertyNames*/ true);
+ return parsePropertyNameWorker(true);
}
function parseComputedPropertyName() {
- // PropertyName [Yield]:
- // LiteralPropertyName
- // ComputedPropertyName[?Yield]
- var node = createNode(147 /* ComputedPropertyName */);
- parseExpected(21 /* OpenBracketToken */);
- // We parse any expression (including a comma expression). But the grammar
- // says that only an assignment expression is allowed, so the grammar checker
- // will error if it sees a comma expression.
+ var node = createNode(147);
+ parseExpected(21);
node.expression = allowInAnd(parseExpression);
- parseExpected(22 /* CloseBracketToken */);
+ parseExpected(22);
return finishNode(node);
}
function parseContextualModifier(t) {
@@ -16217,20 +14299,19 @@ var ts;
}
function nextTokenCanFollowModifier() {
switch (token()) {
- case 76 /* ConstKeyword */:
- // 'const' is only a modifier if followed by 'enum'.
- return nextToken() === 83 /* EnumKeyword */;
- case 84 /* ExportKeyword */:
+ case 76:
+ return nextToken() === 83;
+ case 84:
nextToken();
- if (token() === 79 /* DefaultKeyword */) {
+ if (token() === 79) {
return lookAhead(nextTokenCanFollowDefaultKeyword);
}
- return token() !== 39 /* AsteriskToken */ && token() !== 118 /* AsKeyword */ && token() !== 17 /* OpenBraceToken */ && canFollowModifier();
- case 79 /* DefaultKeyword */:
+ return token() !== 39 && token() !== 118 && token() !== 17 && canFollowModifier();
+ case 79:
return nextTokenCanFollowDefaultKeyword();
- case 115 /* StaticKeyword */:
- case 125 /* GetKeyword */:
- case 136 /* SetKeyword */:
+ case 115:
+ case 125:
+ case 136:
nextToken();
return canFollowModifier();
default:
@@ -16241,112 +14322,86 @@ var ts;
return ts.isModifierKind(token()) && tryParse(nextTokenCanFollowModifier);
}
function canFollowModifier() {
- return token() === 21 /* OpenBracketToken */
- || token() === 17 /* OpenBraceToken */
- || token() === 39 /* AsteriskToken */
- || token() === 24 /* DotDotDotToken */
+ return token() === 21
+ || token() === 17
+ || token() === 39
+ || token() === 24
|| isLiteralPropertyName();
}
function nextTokenCanFollowDefaultKeyword() {
nextToken();
- return token() === 75 /* ClassKeyword */ || token() === 89 /* FunctionKeyword */ ||
- token() === 109 /* InterfaceKeyword */ ||
- (token() === 117 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
- (token() === 120 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
+ return token() === 75 || token() === 89 ||
+ token() === 109 ||
+ (token() === 117 && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
+ (token() === 120 && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
}
- // True if positioned at the start of a list element
function isListElement(parsingContext, inErrorRecovery) {
var node = currentNode(parsingContext);
if (node) {
return true;
}
switch (parsingContext) {
- case 0 /* SourceElements */:
- case 1 /* BlockStatements */:
- case 3 /* SwitchClauseStatements */:
- // If we're in error recovery, then we don't want to treat ';' as an empty statement.
- // The problem is that ';' can show up in far too many contexts, and if we see one
- // and assume it's a statement, then we may bail out inappropriately from whatever
- // we're parsing. For example, if we have a semicolon in the middle of a class, then
- // we really don't want to assume the class is over and we're on a statement in the
- // outer module. We just want to consume and move on.
- return !(token() === 25 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement();
- case 2 /* SwitchClauses */:
- return token() === 73 /* CaseKeyword */ || token() === 79 /* DefaultKeyword */;
- case 4 /* TypeMembers */:
+ case 0:
+ case 1:
+ case 3:
+ return !(token() === 25 && inErrorRecovery) && isStartOfStatement();
+ case 2:
+ return token() === 73 || token() === 79;
+ case 4:
return lookAhead(isTypeMemberStart);
- case 5 /* ClassMembers */:
- // We allow semicolons as class elements (as specified by ES6) as long as we're
- // not in error recovery. If we're in error recovery, we don't want an errant
- // semicolon to be treated as a class member (since they're almost always used
- // for statements.
- return lookAhead(isClassMemberStart) || (token() === 25 /* SemicolonToken */ && !inErrorRecovery);
- case 6 /* EnumMembers */:
- // Include open bracket computed properties. This technically also lets in indexers,
- // which would be a candidate for improved error reporting.
- return token() === 21 /* OpenBracketToken */ || isLiteralPropertyName();
- case 12 /* ObjectLiteralMembers */:
- return token() === 21 /* OpenBracketToken */ || token() === 39 /* AsteriskToken */ || token() === 24 /* DotDotDotToken */ || isLiteralPropertyName();
- case 17 /* RestProperties */:
+ case 5:
+ return lookAhead(isClassMemberStart) || (token() === 25 && !inErrorRecovery);
+ case 6:
+ return token() === 21 || isLiteralPropertyName();
+ case 12:
+ return token() === 21 || token() === 39 || token() === 24 || isLiteralPropertyName();
+ case 17:
return isLiteralPropertyName();
- case 9 /* ObjectBindingElements */:
- return token() === 21 /* OpenBracketToken */ || token() === 24 /* DotDotDotToken */ || isLiteralPropertyName();
- case 7 /* HeritageClauseElement */:
- // If we see `{ ... }` then only consume it as an expression if it is followed by `,` or `{`
- // That way we won't consume the body of a class in its heritage clause.
- if (token() === 17 /* OpenBraceToken */) {
+ case 9:
+ return token() === 21 || token() === 24 || isLiteralPropertyName();
+ case 7:
+ if (token() === 17) {
return lookAhead(isValidHeritageClauseObjectLiteral);
}
if (!inErrorRecovery) {
return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword();
}
else {
- // If we're in error recovery we tighten up what we're willing to match.
- // That way we don't treat something like "this" as a valid heritage clause
- // element during recovery.
return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword();
}
- case 8 /* VariableDeclarations */:
+ case 8:
return isIdentifierOrPattern();
- case 10 /* ArrayBindingElements */:
- return token() === 26 /* CommaToken */ || token() === 24 /* DotDotDotToken */ || isIdentifierOrPattern();
- case 18 /* TypeParameters */:
+ case 10:
+ return token() === 26 || token() === 24 || isIdentifierOrPattern();
+ case 18:
return isIdentifier();
- case 15 /* ArrayLiteralMembers */:
- if (token() === 26 /* CommaToken */) {
+ case 15:
+ if (token() === 26) {
return true;
}
- // falls through
- case 11 /* ArgumentExpressions */:
- return token() === 24 /* DotDotDotToken */ || isStartOfExpression();
- case 16 /* Parameters */:
+ case 11:
+ return token() === 24 || isStartOfExpression();
+ case 16:
return isStartOfParameter();
- case 19 /* TypeArguments */:
- case 20 /* TupleElementTypes */:
- return token() === 26 /* CommaToken */ || isStartOfType();
- case 21 /* HeritageClauses */:
+ case 19:
+ case 20:
+ return token() === 26 || isStartOfType();
+ case 21:
return isHeritageClause();
- case 22 /* ImportOrExportSpecifiers */:
+ case 22:
return ts.tokenIsIdentifierOrKeyword(token());
- case 13 /* JsxAttributes */:
- return ts.tokenIsIdentifierOrKeyword(token()) || token() === 17 /* OpenBraceToken */;
- case 14 /* JsxChildren */:
+ case 13:
+ return ts.tokenIsIdentifierOrKeyword(token()) || token() === 17;
+ case 14:
return true;
}
return ts.Debug.fail("Non-exhaustive case in 'isListElement'.");
}
function isValidHeritageClauseObjectLiteral() {
- ts.Debug.assert(token() === 17 /* OpenBraceToken */);
- if (nextToken() === 18 /* CloseBraceToken */) {
- // if we see "extends {}" then only treat the {} as what we're extending (and not
- // the class body) if we have:
- //
- // extends {} {
- // extends {},
- // extends {} extends
- // extends {} implements
+ ts.Debug.assert(token() === 17);
+ if (nextToken() === 18) {
var next = nextToken();
- return next === 26 /* CommaToken */ || next === 17 /* OpenBraceToken */ || next === 85 /* ExtendsKeyword */ || next === 108 /* ImplementsKeyword */;
+ return next === 26 || next === 17 || next === 85 || next === 108;
}
return true;
}
@@ -16363,8 +14418,8 @@ var ts;
return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token());
}
function isHeritageClauseExtendsOrImplementsKeyword() {
- if (token() === 108 /* ImplementsKeyword */ ||
- token() === 85 /* ExtendsKeyword */) {
+ if (token() === 108 ||
+ token() === 85) {
return lookAhead(nextTokenIsStartOfExpression);
}
return false;
@@ -16377,95 +14432,78 @@ var ts;
nextToken();
return isStartOfType();
}
- // True if positioned at a list terminator
function isListTerminator(kind) {
- if (token() === 1 /* EndOfFileToken */) {
- // Being at the end of the file ends all lists.
+ if (token() === 1) {
return true;
}
switch (kind) {
- case 1 /* BlockStatements */:
- case 2 /* SwitchClauses */:
- case 4 /* TypeMembers */:
- case 5 /* ClassMembers */:
- case 6 /* EnumMembers */:
- case 12 /* ObjectLiteralMembers */:
- case 9 /* ObjectBindingElements */:
- case 22 /* ImportOrExportSpecifiers */:
- return token() === 18 /* CloseBraceToken */;
- case 3 /* SwitchClauseStatements */:
- return token() === 18 /* CloseBraceToken */ || token() === 73 /* CaseKeyword */ || token() === 79 /* DefaultKeyword */;
- case 7 /* HeritageClauseElement */:
- return token() === 17 /* OpenBraceToken */ || token() === 85 /* ExtendsKeyword */ || token() === 108 /* ImplementsKeyword */;
- case 8 /* VariableDeclarations */:
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ case 6:
+ case 12:
+ case 9:
+ case 22:
+ return token() === 18;
+ case 3:
+ return token() === 18 || token() === 73 || token() === 79;
+ case 7:
+ return token() === 17 || token() === 85 || token() === 108;
+ case 8:
return isVariableDeclaratorListTerminator();
- case 18 /* TypeParameters */:
- // Tokens other than '>' are here for better error recovery
- return token() === 29 /* GreaterThanToken */ || token() === 19 /* OpenParenToken */ || token() === 17 /* OpenBraceToken */ || token() === 85 /* ExtendsKeyword */ || token() === 108 /* ImplementsKeyword */;
- case 11 /* ArgumentExpressions */:
- // Tokens other than ')' are here for better error recovery
- return token() === 20 /* CloseParenToken */ || token() === 25 /* SemicolonToken */;
- case 15 /* ArrayLiteralMembers */:
- case 20 /* TupleElementTypes */:
- case 10 /* ArrayBindingElements */:
- return token() === 22 /* CloseBracketToken */;
- case 16 /* Parameters */:
- case 17 /* RestProperties */:
- // Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery
- return token() === 20 /* CloseParenToken */ || token() === 22 /* CloseBracketToken */ /*|| token === SyntaxKind.OpenBraceToken*/;
- case 19 /* TypeArguments */:
- // All other tokens should cause the type-argument to terminate except comma token
- return token() !== 26 /* CommaToken */;
- case 21 /* HeritageClauses */:
- return token() === 17 /* OpenBraceToken */ || token() === 18 /* CloseBraceToken */;
- case 13 /* JsxAttributes */:
- return token() === 29 /* GreaterThanToken */ || token() === 41 /* SlashToken */;
- case 14 /* JsxChildren */:
- return token() === 27 /* LessThanToken */ && lookAhead(nextTokenIsSlash);
+ case 18:
+ return token() === 29 || token() === 19 || token() === 17 || token() === 85 || token() === 108;
+ case 11:
+ return token() === 20 || token() === 25;
+ case 15:
+ case 20:
+ case 10:
+ return token() === 22;
+ case 16:
+ case 17:
+ return token() === 20 || token() === 22;
+ case 19:
+ return token() !== 26;
+ case 21:
+ return token() === 17 || token() === 18;
+ case 13:
+ return token() === 29 || token() === 41;
+ case 14:
+ return token() === 27 && lookAhead(nextTokenIsSlash);
default:
return false;
}
}
function isVariableDeclaratorListTerminator() {
- // If we can consume a semicolon (either explicitly, or with ASI), then consider us done
- // with parsing the list of variable declarators.
if (canParseSemicolon()) {
return true;
}
- // in the case where we're parsing the variable declarator of a 'for-in' statement, we
- // are done if we see an 'in' keyword in front of us. Same with for-of
if (isInOrOfKeyword(token())) {
return true;
}
- // ERROR RECOVERY TWEAK:
- // For better error recovery, if we see an '=>' then we just stop immediately. We've got an
- // arrow function here and it's going to be very unlikely that we'll resynchronize and get
- // another variable declaration.
- if (token() === 36 /* EqualsGreaterThanToken */) {
+ if (token() === 36) {
return true;
}
- // Keep trying to parse out variable declarators.
return false;
}
- // True if positioned at element or terminator of the current list or any enclosing list
function isInSomeParsingContext() {
- for (var kind = 0; kind < 23 /* Count */; kind++) {
+ for (var kind = 0; kind < 23; kind++) {
if (parsingContext & (1 << kind)) {
- if (isListElement(kind, /*inErrorRecovery*/ true) || isListTerminator(kind)) {
+ if (isListElement(kind, true) || isListTerminator(kind)) {
return true;
}
}
}
return false;
}
- // Parses a list of elements
function parseList(kind, parseElement) {
var saveParsingContext = parsingContext;
parsingContext |= 1 << kind;
var list = [];
var listPos = getNodePos();
while (!isListTerminator(kind)) {
- if (isListElement(kind, /*inErrorRecovery*/ false)) {
+ if (isListElement(kind, false)) {
var element = parseListElement(kind, parseElement);
list.push(element);
continue;
@@ -16485,145 +14523,85 @@ var ts;
return parseElement();
}
function currentNode(parsingContext) {
- // If there is an outstanding parse error that we've encountered, but not attached to
- // some node, then we cannot get a node from the old source tree. This is because we
- // want to mark the next node we encounter as being unusable.
- //
- // Note: This may be too conservative. Perhaps we could reuse the node and set the bit
- // on it (or its leftmost child) as having the error. For now though, being conservative
- // is nice and likely won't ever affect perf.
if (parseErrorBeforeNextFinishedNode) {
return undefined;
}
if (!syntaxCursor) {
- // if we don't have a cursor, we could never return a node from the old tree.
return undefined;
}
var node = syntaxCursor.currentNode(scanner.getStartPos());
- // Can't reuse a missing node.
if (ts.nodeIsMissing(node)) {
return undefined;
}
- // Can't reuse a node that intersected the change range.
if (node.intersectsChange) {
return undefined;
}
- // Can't reuse a node that contains a parse error. This is necessary so that we
- // produce the same set of errors again.
if (ts.containsParseError(node)) {
return undefined;
}
- // We can only reuse a node if it was parsed under the same strict mode that we're
- // currently in. i.e. if we originally parsed a node in non-strict mode, but then
- // the user added 'using strict' at the top of the file, then we can't use that node
- // again as the presence of strict mode may cause us to parse the tokens in the file
- // differently.
- //
- // Note: we *can* reuse tokens when the strict mode changes. That's because tokens
- // are unaffected by strict mode. It's just the parser will decide what to do with it
- // differently depending on what mode it is in.
- //
- // This also applies to all our other context flags as well.
- var nodeContextFlags = node.flags & 12679168 /* ContextFlags */;
+ var nodeContextFlags = node.flags & 12679168;
if (nodeContextFlags !== contextFlags) {
return undefined;
}
- // Ok, we have a node that looks like it could be reused. Now verify that it is valid
- // in the current list parsing context that we're currently at.
if (!canReuseNode(node, parsingContext)) {
return undefined;
}
if (node.jsDocCache) {
- // jsDocCache may include tags from parent nodes, which might have been modified.
node.jsDocCache = undefined;
}
return node;
}
function consumeNode(node) {
- // Move the scanner so it is after the node we just consumed.
scanner.setTextPos(node.end);
nextToken();
return node;
}
function canReuseNode(node, parsingContext) {
switch (parsingContext) {
- case 5 /* ClassMembers */:
+ case 5:
return isReusableClassMember(node);
- case 2 /* SwitchClauses */:
+ case 2:
return isReusableSwitchClause(node);
- case 0 /* SourceElements */:
- case 1 /* BlockStatements */:
- case 3 /* SwitchClauseStatements */:
+ case 0:
+ case 1:
+ case 3:
return isReusableStatement(node);
- case 6 /* EnumMembers */:
+ case 6:
return isReusableEnumMember(node);
- case 4 /* TypeMembers */:
+ case 4:
return isReusableTypeMember(node);
- case 8 /* VariableDeclarations */:
+ case 8:
return isReusableVariableDeclaration(node);
- case 16 /* Parameters */:
+ case 16:
return isReusableParameter(node);
- case 17 /* RestProperties */:
+ case 17:
return false;
- // Any other lists we do not care about reusing nodes in. But feel free to add if
- // you can do so safely. Danger areas involve nodes that may involve speculative
- // parsing. If speculative parsing is involved with the node, then the range the
- // parser reached while looking ahead might be in the edited range (see the example
- // in canReuseVariableDeclaratorNode for a good case of this).
- case 21 /* HeritageClauses */:
- // This would probably be safe to reuse. There is no speculative parsing with
- // heritage clauses.
- case 18 /* TypeParameters */:
- // This would probably be safe to reuse. There is no speculative parsing with
- // type parameters. Note that that's because type *parameters* only occur in
- // unambiguous *type* contexts. While type *arguments* occur in very ambiguous
- // *expression* contexts.
- case 20 /* TupleElementTypes */:
- // This would probably be safe to reuse. There is no speculative parsing with
- // tuple types.
- // Technically, type argument list types are probably safe to reuse. While
- // speculative parsing is involved with them (since type argument lists are only
- // produced from speculative parsing a < as a type argument list), we only have
- // the types because speculative parsing succeeded. Thus, the lookahead never
- // went past the end of the list and rewound.
- case 19 /* TypeArguments */:
- // Note: these are almost certainly not safe to ever reuse. Expressions commonly
- // need a large amount of lookahead, and we should not reuse them as they may
- // have actually intersected the edit.
- case 11 /* ArgumentExpressions */:
- // This is not safe to reuse for the same reason as the 'AssignmentExpression'
- // cases. i.e. a property assignment may end with an expression, and thus might
- // have lookahead far beyond it's old node.
- case 12 /* ObjectLiteralMembers */:
- // This is probably not safe to reuse. There can be speculative parsing with
- // type names in a heritage clause. There can be generic names in the type
- // name list, and there can be left hand side expressions (which can have type
- // arguments.)
- case 7 /* HeritageClauseElement */:
- // Perhaps safe to reuse, but it's unlikely we'd see more than a dozen attributes
- // on any given element. Same for children.
- case 13 /* JsxAttributes */:
- case 14 /* JsxChildren */:
+ case 21:
+ case 18:
+ case 20:
+ case 19:
+ case 11:
+ case 12:
+ case 7:
+ case 13:
+ case 14:
}
return false;
}
function isReusableClassMember(node) {
if (node) {
switch (node.kind) {
- case 155 /* Constructor */:
- case 160 /* IndexSignature */:
- case 156 /* GetAccessor */:
- case 157 /* SetAccessor */:
- case 152 /* PropertyDeclaration */:
- case 212 /* SemicolonClassElement */:
+ case 155:
+ case 160:
+ case 156:
+ case 157:
+ case 152:
+ case 212:
return true;
- case 154 /* MethodDeclaration */:
- // Method declarations are not necessarily reusable. An object-literal
- // may have a method calls "constructor(...)" and we must reparse that
- // into an actual .ConstructorDeclaration.
+ case 154:
var methodDeclaration = node;
- var nameIsConstructor = methodDeclaration.name.kind === 71 /* Identifier */ &&
- methodDeclaration.name.originalKeywordKind === 123 /* ConstructorKeyword */;
+ var nameIsConstructor = methodDeclaration.name.kind === 71 &&
+ methodDeclaration.name.originalKeywordKind === 123;
return !nameIsConstructor;
}
}
@@ -16632,8 +14610,8 @@ var ts;
function isReusableSwitchClause(node) {
if (node) {
switch (node.kind) {
- case 266 /* CaseClause */:
- case 267 /* DefaultClause */:
+ case 266:
+ case 267:
return true;
}
}
@@ -16642,86 +14620,70 @@ var ts;
function isReusableStatement(node) {
if (node) {
switch (node.kind) {
- case 234 /* FunctionDeclaration */:
- case 214 /* VariableStatement */:
- case 213 /* Block */:
- case 217 /* IfStatement */:
- case 216 /* ExpressionStatement */:
- case 229 /* ThrowStatement */:
- case 225 /* ReturnStatement */:
- case 227 /* SwitchStatement */:
- case 224 /* BreakStatement */:
- case 223 /* ContinueStatement */:
- case 221 /* ForInStatement */:
- case 222 /* ForOfStatement */:
- case 220 /* ForStatement */:
- case 219 /* WhileStatement */:
- case 226 /* WithStatement */:
- case 215 /* EmptyStatement */:
- case 230 /* TryStatement */:
- case 228 /* LabeledStatement */:
- case 218 /* DoStatement */:
- case 231 /* DebuggerStatement */:
- case 244 /* ImportDeclaration */:
- case 243 /* ImportEqualsDeclaration */:
- case 250 /* ExportDeclaration */:
- case 249 /* ExportAssignment */:
- case 239 /* ModuleDeclaration */:
- case 235 /* ClassDeclaration */:
- case 236 /* InterfaceDeclaration */:
- case 238 /* EnumDeclaration */:
- case 237 /* TypeAliasDeclaration */:
+ case 234:
+ case 214:
+ case 213:
+ case 217:
+ case 216:
+ case 229:
+ case 225:
+ case 227:
+ case 224:
+ case 223:
+ case 221:
+ case 222:
+ case 220:
+ case 219:
+ case 226:
+ case 215:
+ case 230:
+ case 228:
+ case 218:
+ case 231:
+ case 244:
+ case 243:
+ case 250:
+ case 249:
+ case 239:
+ case 235:
+ case 236:
+ case 238:
+ case 237:
return true;
}
}
return false;
}
function isReusableEnumMember(node) {
- return node.kind === 273 /* EnumMember */;
+ return node.kind === 273;
}
function isReusableTypeMember(node) {
if (node) {
switch (node.kind) {
- case 159 /* ConstructSignature */:
- case 153 /* MethodSignature */:
- case 160 /* IndexSignature */:
- case 151 /* PropertySignature */:
- case 158 /* CallSignature */:
+ case 159:
+ case 153:
+ case 160:
+ case 151:
+ case 158:
return true;
}
}
return false;
}
function isReusableVariableDeclaration(node) {
- if (node.kind !== 232 /* VariableDeclaration */) {
+ if (node.kind !== 232) {
return false;
}
- // Very subtle incremental parsing bug. Consider the following code:
- //
- // let v = new List < A, B
- //
- // This is actually legal code. It's a list of variable declarators "v = new List()
- //
- // then we have a problem. "v = new List= 0) {
- // Always preserve a trailing comma by marking it on the NodeArray
result.hasTrailingComma = true;
}
return result;
@@ -16832,9 +14775,8 @@ var ts;
function parseEntityName(allowReservedWords, diagnosticMessage) {
var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
var dotPos = scanner.getStartPos();
- while (parseOptional(23 /* DotToken */)) {
- if (token() === 27 /* LessThanToken */) {
- // the entity is part of a JSDoc-style generic, so record the trailing dot for later error reporting
+ while (parseOptional(23)) {
+ if (token() === 27) {
entity.jsdocDotPos = dotPos;
break;
}
@@ -16844,64 +14786,42 @@ var ts;
return entity;
}
function createQualifiedName(entity, name) {
- var node = createNode(146 /* QualifiedName */, entity.pos);
+ var node = createNode(146, entity.pos);
node.left = entity;
node.right = name;
return finishNode(node);
}
function parseRightSideOfDot(allowIdentifierNames) {
- // Technically a keyword is valid here as all identifiers and keywords are identifier names.
- // However, often we'll encounter this in error situations when the identifier or keyword
- // is actually starting another valid construct.
- //
- // So, we check for the following specific case:
- //
- // name.
- // identifierOrKeyword identifierNameOrKeyword
- //
- // Note: the newlines are important here. For example, if that above code
- // were rewritten into:
- //
- // name.identifierOrKeyword
- // identifierNameOrKeyword
- //
- // Then we would consider it valid. That's because ASI would take effect and
- // the code would be implicitly: "name.identifierOrKeyword; identifierNameOrKeyword".
- // In the first case though, ASI will not take effect because there is not a
- // line terminator after the identifier or keyword.
if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token())) {
var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
if (matchesPattern) {
- // Report that we need an identifier. However, report it right after the dot,
- // and not on the next token. This is because the next token might actually
- // be an identifier and the error would be quite confusing.
- return createMissingNode(71 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected);
+ return createMissingNode(71, true, ts.Diagnostics.Identifier_expected);
}
}
return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
}
function parseTemplateExpression() {
- var template = createNode(202 /* TemplateExpression */);
+ var template = createNode(202);
template.head = parseTemplateHead();
- ts.Debug.assert(template.head.kind === 14 /* TemplateHead */, "Template head has wrong token kind");
+ ts.Debug.assert(template.head.kind === 14, "Template head has wrong token kind");
var list = [];
var listPos = getNodePos();
do {
list.push(parseTemplateSpan());
- } while (ts.last(list).literal.kind === 15 /* TemplateMiddle */);
+ } while (ts.last(list).literal.kind === 15);
template.templateSpans = createNodeArray(list, listPos);
return finishNode(template);
}
function parseTemplateSpan() {
- var span = createNode(211 /* TemplateSpan */);
+ var span = createNode(211);
span.expression = allowInAnd(parseExpression);
var literal;
- if (token() === 18 /* CloseBraceToken */) {
+ if (token() === 18) {
reScanTemplateToken();
literal = parseTemplateMiddleOrTemplateTail();
}
else {
- literal = parseExpectedToken(16 /* TemplateTail */, ts.Diagnostics._0_expected, ts.tokenToString(18 /* CloseBraceToken */));
+ literal = parseExpectedToken(16, ts.Diagnostics._0_expected, ts.tokenToString(18));
}
span.literal = literal;
return finishNode(span);
@@ -16911,12 +14831,12 @@ var ts;
}
function parseTemplateHead() {
var fragment = parseLiteralLikeNode(token());
- ts.Debug.assert(fragment.kind === 14 /* TemplateHead */, "Template head has wrong token kind");
+ ts.Debug.assert(fragment.kind === 14, "Template head has wrong token kind");
return fragment;
}
function parseTemplateMiddleOrTemplateTail() {
var fragment = parseLiteralLikeNode(token());
- ts.Debug.assert(fragment.kind === 15 /* TemplateMiddle */ || fragment.kind === 16 /* TemplateTail */, "Template fragment has wrong token kind");
+ ts.Debug.assert(fragment.kind === 15 || fragment.kind === 16, "Template fragment has wrong token kind");
return fragment;
}
function parseLiteralLikeNode(kind) {
@@ -16929,40 +14849,31 @@ var ts;
if (scanner.isUnterminated()) {
node.isUnterminated = true;
}
- // Octal literals are not allowed in strict mode or ES5
- // Note that theoretically the following condition would hold true literals like 009,
- // which is not octal.But because of how the scanner separates the tokens, we would
- // never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
- // We also do not need to check for negatives because any prefix operator would be part of a
- // parent unary expression.
- if (node.kind === 8 /* NumericLiteral */) {
- node.numericLiteralFlags = scanner.getTokenFlags() & 1008 /* NumericLiteralFlags */;
+ if (node.kind === 8) {
+ node.numericLiteralFlags = scanner.getTokenFlags() & 1008;
}
nextToken();
finishNode(node);
return node;
}
- // TYPES
function parseTypeReference() {
- var node = createNode(162 /* TypeReference */);
- node.typeName = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
- if (!scanner.hasPrecedingLineBreak() && token() === 27 /* LessThanToken */) {
- node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 27 /* LessThanToken */, 29 /* GreaterThanToken */);
+ var node = createNode(162);
+ node.typeName = parseEntityName(true, ts.Diagnostics.Type_expected);
+ if (!scanner.hasPrecedingLineBreak() && token() === 27) {
+ node.typeArguments = parseBracketedList(19, parseType, 27, 29);
}
return finishNode(node);
}
- // If true, we should abort parsing an error function.
function typeHasArrowFunctionBlockingParseError(node) {
switch (node.kind) {
- case 162 /* TypeReference */:
+ case 162:
return ts.nodeIsMissing(node.typeName);
- case 163 /* FunctionType */:
- case 164 /* ConstructorType */: {
+ case 163:
+ case 164: {
var _a = node, parameters = _a.parameters, type = _a.type;
- // parameters.pos === parameters.end only if we used parseMissingList, else should contain at least `()`
return parameters.pos === parameters.end || typeHasArrowFunctionBlockingParseError(type);
}
- case 173 /* ParenthesizedType */:
+ case 173:
return typeHasArrowFunctionBlockingParseError(node.type);
default:
return false;
@@ -16970,20 +14881,20 @@ var ts;
}
function parseThisTypePredicate(lhs) {
nextToken();
- var node = createNode(161 /* TypePredicate */, lhs.pos);
+ var node = createNode(161, lhs.pos);
node.parameterName = lhs;
node.type = parseType();
return finishNode(node);
}
function parseThisTypeNode() {
- var node = createNode(174 /* ThisType */);
+ var node = createNode(174);
nextToken();
return finishNode(node);
}
function parseJSDocAllType(postFixEquals) {
- var result = createNode(279 /* JSDocAllType */);
+ var result = createNode(279);
if (postFixEquals) {
- return createJSDocPostfixType(283 /* JSDocOptionalType */, result);
+ return createJSDocPostfixType(283, result);
}
else {
nextToken();
@@ -16991,162 +14902,127 @@ var ts;
return finishNode(result);
}
function parseJSDocNonNullableType() {
- var result = createNode(282 /* JSDocNonNullableType */);
+ var result = createNode(282);
nextToken();
result.type = parseNonArrayType();
return finishNode(result);
}
function parseJSDocUnknownOrNullableType() {
var pos = scanner.getStartPos();
- // skip the ?
nextToken();
- // Need to lookahead to decide if this is a nullable or unknown type.
- // Here are cases where we'll pick the unknown type:
- //
- // Foo(?,
- // { a: ? }
- // Foo(?)
- // Foo>
- // Foo(?=
- // (?|
- if (token() === 26 /* CommaToken */ ||
- token() === 18 /* CloseBraceToken */ ||
- token() === 20 /* CloseParenToken */ ||
- token() === 29 /* GreaterThanToken */ ||
- token() === 58 /* EqualsToken */ ||
- token() === 49 /* BarToken */) {
- var result = createNode(280 /* JSDocUnknownType */, pos);
+ if (token() === 26 ||
+ token() === 18 ||
+ token() === 20 ||
+ token() === 29 ||
+ token() === 58 ||
+ token() === 49) {
+ var result = createNode(280, pos);
return finishNode(result);
}
else {
- var result = createNode(281 /* JSDocNullableType */, pos);
+ var result = createNode(281, pos);
result.type = parseType();
return finishNode(result);
}
}
function parseJSDocFunctionType() {
if (lookAhead(nextTokenIsOpenParen)) {
- var result = createNodeWithJSDoc(284 /* JSDocFunctionType */);
+ var result = createNodeWithJSDoc(284);
nextToken();
- fillSignature(56 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result);
+ fillSignature(56, 4 | 32, result);
return finishNode(result);
}
- var node = createNode(162 /* TypeReference */);
+ var node = createNode(162);
node.typeName = parseIdentifierName();
return finishNode(node);
}
function parseJSDocParameter() {
- var parameter = createNode(149 /* Parameter */);
- if (token() === 99 /* ThisKeyword */ || token() === 94 /* NewKeyword */) {
+ var parameter = createNode(149);
+ if (token() === 99 || token() === 94) {
parameter.name = parseIdentifierName();
- parseExpected(56 /* ColonToken */);
+ parseExpected(56);
}
parameter.type = parseJSDocType();
return finishNode(parameter);
}
function parseJSDocType() {
- var dotdotdot = parseOptionalToken(24 /* DotDotDotToken */);
+ var dotdotdot = parseOptionalToken(24);
var type = parseType();
if (dotdotdot) {
- var variadic = createNode(285 /* JSDocVariadicType */, dotdotdot.pos);
+ var variadic = createNode(285, dotdotdot.pos);
variadic.type = type;
type = finishNode(variadic);
}
- if (token() === 58 /* EqualsToken */) {
- return createJSDocPostfixType(283 /* JSDocOptionalType */, type);
+ if (token() === 58) {
+ return createJSDocPostfixType(283, type);
}
return type;
}
function parseTypeQuery() {
- var node = createNode(165 /* TypeQuery */);
- parseExpected(103 /* TypeOfKeyword */);
- node.exprName = parseEntityName(/*allowReservedWords*/ true);
+ var node = createNode(165);
+ parseExpected(103);
+ node.exprName = parseEntityName(true);
return finishNode(node);
}
function parseTypeParameter() {
- var node = createNode(148 /* TypeParameter */);
+ var node = createNode(148);
node.name = parseIdentifier();
- if (parseOptional(85 /* ExtendsKeyword */)) {
- // It's not uncommon for people to write improper constraints to a generic. If the
- // user writes a constraint that is an expression and not an actual type, then parse
- // it out as an expression (so we can recover well), but report that a type is needed
- // instead.
+ if (parseOptional(85)) {
if (isStartOfType() || !isStartOfExpression()) {
node.constraint = parseType();
}
else {
- // It was not a type, and it looked like an expression. Parse out an expression
- // here so we recover well. Note: it is important that we call parseUnaryExpression
- // and not parseExpression here. If the user has:
- //
- //
- //
- // We do *not* want to consume the `>` as we're consuming the expression for "".
node.expression = parseUnaryExpressionOrHigher();
}
}
- if (parseOptional(58 /* EqualsToken */)) {
+ if (parseOptional(58)) {
node.default = parseType();
}
return finishNode(node);
}
function parseTypeParameters() {
- if (token() === 27 /* LessThanToken */) {
- return parseBracketedList(18 /* TypeParameters */, parseTypeParameter, 27 /* LessThanToken */, 29 /* GreaterThanToken */);
+ if (token() === 27) {
+ return parseBracketedList(18, parseTypeParameter, 27, 29);
}
}
function parseParameterType() {
- if (parseOptional(56 /* ColonToken */)) {
+ if (parseOptional(56)) {
return parseType();
}
return undefined;
}
function isStartOfParameter() {
- return token() === 24 /* DotDotDotToken */ ||
+ return token() === 24 ||
isIdentifierOrPattern() ||
ts.isModifierKind(token()) ||
- token() === 57 /* AtToken */ ||
- isStartOfType(/*inStartOfParameter*/ true);
+ token() === 57 ||
+ isStartOfType(true);
}
function parseParameter() {
- var node = createNodeWithJSDoc(149 /* Parameter */);
- if (token() === 99 /* ThisKeyword */) {
- node.name = createIdentifier(/*isIdentifier*/ true);
+ var node = createNodeWithJSDoc(149);
+ if (token() === 99) {
+ node.name = createIdentifier(true);
node.type = parseParameterType();
return finishNode(node);
}
node.decorators = parseDecorators();
node.modifiers = parseModifiers();
- node.dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */);
- // FormalParameter [Yield,Await]:
- // BindingElement[?Yield,?Await]
+ node.dotDotDotToken = parseOptionalToken(24);
node.name = parseIdentifierOrPattern();
if (ts.getFullWidth(node.name) === 0 && !ts.hasModifiers(node) && ts.isModifierKind(token())) {
- // in cases like
- // 'use strict'
- // function foo(static)
- // isParameter('static') === true, because of isModifier('static')
- // however 'static' is not a legal identifier in a strict mode.
- // so result of this function will be ParameterDeclaration (flags = 0, name = missing, type = undefined, initializer = undefined)
- // and current token will not change => parsing of the enclosing parameter list will last till the end of time (or OOM)
- // to avoid this we'll advance cursor to the next token.
nextToken();
}
- node.questionToken = parseOptionalToken(55 /* QuestionToken */);
+ node.questionToken = parseOptionalToken(55);
node.type = parseParameterType();
node.initializer = parseInitializer();
return finishNode(node);
}
- /**
- * Note: If returnToken is EqualsGreaterThanToken, `signature.type` will always be defined.
- * @returns If return type parsing succeeds
- */
function fillSignature(returnToken, flags, signature) {
- if (!(flags & 32 /* JSDoc */)) {
+ if (!(flags & 32)) {
signature.typeParameters = parseTypeParameters();
}
var parametersParsedSuccessfully = parseParameterList(signature, flags);
- if (shouldParseReturnType(returnToken, !!(flags & 4 /* Type */))) {
+ if (shouldParseReturnType(returnToken, !!(flags & 4))) {
signature.type = parseTypeOrTypePredicate();
if (typeHasArrowFunctionBlockingParseError(signature.type))
return false;
@@ -17154,89 +15030,55 @@ var ts;
return parametersParsedSuccessfully;
}
function shouldParseReturnType(returnToken, isType) {
- if (returnToken === 36 /* EqualsGreaterThanToken */) {
+ if (returnToken === 36) {
parseExpected(returnToken);
return true;
}
- else if (parseOptional(56 /* ColonToken */)) {
+ else if (parseOptional(56)) {
return true;
}
- else if (isType && token() === 36 /* EqualsGreaterThanToken */) {
- // This is easy to get backward, especially in type contexts, so parse the type anyway
- parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(56 /* ColonToken */));
+ else if (isType && token() === 36) {
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(56));
nextToken();
return true;
}
return false;
}
- // Returns true on success.
function parseParameterList(signature, flags) {
- // FormalParameters [Yield,Await]: (modified)
- // [empty]
- // FormalParameterList[?Yield,Await]
- //
- // FormalParameter[Yield,Await]: (modified)
- // BindingElement[?Yield,Await]
- //
- // BindingElement [Yield,Await]: (modified)
- // SingleNameBinding[?Yield,?Await]
- // BindingPattern[?Yield,?Await]Initializer [In, ?Yield,?Await] opt
- //
- // SingleNameBinding [Yield,Await]:
- // BindingIdentifier[?Yield,?Await]Initializer [In, ?Yield,?Await] opt
- if (!parseExpected(19 /* OpenParenToken */)) {
+ if (!parseExpected(19)) {
signature.parameters = createMissingList();
return false;
}
var savedYieldContext = inYieldContext();
var savedAwaitContext = inAwaitContext();
- setYieldContext(!!(flags & 1 /* Yield */));
- setAwaitContext(!!(flags & 2 /* Await */));
- signature.parameters = parseDelimitedList(16 /* Parameters */, flags & 32 /* JSDoc */ ? parseJSDocParameter : parseParameter);
+ setYieldContext(!!(flags & 1));
+ setAwaitContext(!!(flags & 2));
+ signature.parameters = parseDelimitedList(16, flags & 32 ? parseJSDocParameter : parseParameter);
setYieldContext(savedYieldContext);
setAwaitContext(savedAwaitContext);
- return parseExpected(20 /* CloseParenToken */);
+ return parseExpected(20);
}
function parseTypeMemberSemicolon() {
- // We allow type members to be separated by commas or (possibly ASI) semicolons.
- // First check if it was a comma. If so, we're done with the member.
- if (parseOptional(26 /* CommaToken */)) {
+ if (parseOptional(26)) {
return;
}
- // Didn't have a comma. We must have a (possible ASI) semicolon.
parseSemicolon();
}
function parseSignatureMember(kind) {
var node = createNodeWithJSDoc(kind);
- if (kind === 159 /* ConstructSignature */) {
- parseExpected(94 /* NewKeyword */);
+ if (kind === 159) {
+ parseExpected(94);
}
- fillSignature(56 /* ColonToken */, 4 /* Type */, node);
+ fillSignature(56, 4, node);
parseTypeMemberSemicolon();
return finishNode(node);
}
function isIndexSignature() {
- return token() === 21 /* OpenBracketToken */ && lookAhead(isUnambiguouslyIndexSignature);
+ return token() === 21 && lookAhead(isUnambiguouslyIndexSignature);
}
function isUnambiguouslyIndexSignature() {
- // The only allowed sequence is:
- //
- // [id:
- //
- // However, for error recovery, we also check the following cases:
- //
- // [...
- // [id,
- // [id?,
- // [id?:
- // [id?]
- // [public id
- // [private id
- // [protected id
- // []
- //
nextToken();
- if (token() === 24 /* DotDotDotToken */ || token() === 22 /* CloseBracketToken */) {
+ if (token() === 24 || token() === 22) {
return true;
}
if (ts.isModifierKind(token())) {
@@ -17249,48 +15091,35 @@ var ts;
return false;
}
else {
- // Skip the identifier
nextToken();
}
- // A colon signifies a well formed indexer
- // A comma should be a badly formed indexer because comma expressions are not allowed
- // in computed properties.
- if (token() === 56 /* ColonToken */ || token() === 26 /* CommaToken */) {
+ if (token() === 56 || token() === 26) {
return true;
}
- // Question mark could be an indexer with an optional property,
- // or it could be a conditional expression in a computed property.
- if (token() !== 55 /* QuestionToken */) {
+ if (token() !== 55) {
return false;
}
- // If any of the following tokens are after the question mark, it cannot
- // be a conditional expression, so treat it as an indexer.
nextToken();
- return token() === 56 /* ColonToken */ || token() === 26 /* CommaToken */ || token() === 22 /* CloseBracketToken */;
+ return token() === 56 || token() === 26 || token() === 22;
}
function parseIndexSignatureDeclaration(node) {
- node.kind = 160 /* IndexSignature */;
- node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 21 /* OpenBracketToken */, 22 /* CloseBracketToken */);
+ node.kind = 160;
+ node.parameters = parseBracketedList(16, parseParameter, 21, 22);
node.type = parseTypeAnnotation();
parseTypeMemberSemicolon();
return finishNode(node);
}
function parsePropertyOrMethodSignature(node) {
node.name = parsePropertyName();
- node.questionToken = parseOptionalToken(55 /* QuestionToken */);
- if (token() === 19 /* OpenParenToken */ || token() === 27 /* LessThanToken */) {
- node.kind = 153 /* MethodSignature */;
- // Method signatures don't exist in expression contexts. So they have neither
- // [Yield] nor [Await]
- fillSignature(56 /* ColonToken */, 4 /* Type */, node);
+ node.questionToken = parseOptionalToken(55);
+ if (token() === 19 || token() === 27) {
+ node.kind = 153;
+ fillSignature(56, 4, node);
}
else {
- node.kind = 151 /* PropertySignature */;
+ node.kind = 151;
node.type = parseTypeAnnotation();
- if (token() === 58 /* EqualsToken */) {
- // Although type literal properties cannot not have initializers, we attempt
- // to parse an initializer so we can report in the checker that an interface
- // property or type literal property cannot have an initializer.
+ if (token() === 58) {
node.initializer = parseInitializer();
}
}
@@ -17298,45 +15127,39 @@ var ts;
return finishNode(node);
}
function isTypeMemberStart() {
- // Return true if we have the start of a signature member
- if (token() === 19 /* OpenParenToken */ || token() === 27 /* LessThanToken */) {
+ if (token() === 19 || token() === 27) {
return true;
}
var idToken = false;
- // Eat up all modifiers, but hold on to the last one in case it is actually an identifier
while (ts.isModifierKind(token())) {
idToken = true;
nextToken();
}
- // Index signatures and computed property names are type members
- if (token() === 21 /* OpenBracketToken */) {
+ if (token() === 21) {
return true;
}
- // Try to get the first property-like token following all modifiers
if (isLiteralPropertyName()) {
idToken = true;
nextToken();
}
- // If we were able to get any potential identifier, check that it is
- // the start of a member declaration
if (idToken) {
- return token() === 19 /* OpenParenToken */ ||
- token() === 27 /* LessThanToken */ ||
- token() === 55 /* QuestionToken */ ||
- token() === 56 /* ColonToken */ ||
- token() === 26 /* CommaToken */ ||
+ return token() === 19 ||
+ token() === 27 ||
+ token() === 55 ||
+ token() === 56 ||
+ token() === 26 ||
canParseSemicolon();
}
return false;
}
function parseTypeMember() {
- if (token() === 19 /* OpenParenToken */ || token() === 27 /* LessThanToken */) {
- return parseSignatureMember(158 /* CallSignature */);
+ if (token() === 19 || token() === 27) {
+ return parseSignatureMember(158);
}
- if (token() === 94 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) {
- return parseSignatureMember(159 /* ConstructSignature */);
+ if (token() === 94 && lookAhead(nextTokenIsOpenParenOrLessThan)) {
+ return parseSignatureMember(159);
}
- var node = createNodeWithJSDoc(0 /* Unknown */);
+ var node = createNodeWithJSDoc(0);
node.modifiers = parseModifiers();
if (isIndexSignature()) {
return parseIndexSignatureDeclaration(node);
@@ -17345,30 +15168,30 @@ var ts;
}
function nextTokenIsOpenParenOrLessThan() {
nextToken();
- return token() === 19 /* OpenParenToken */ || token() === 27 /* LessThanToken */;
+ return token() === 19 || token() === 27;
}
function nextTokenIsDot() {
- return nextToken() === 23 /* DotToken */;
+ return nextToken() === 23;
}
function nextTokenIsOpenParenOrLessThanOrDot() {
switch (nextToken()) {
- case 19 /* OpenParenToken */:
- case 27 /* LessThanToken */:
- case 23 /* DotToken */:
+ case 19:
+ case 27:
+ case 23:
return true;
}
return false;
}
function parseTypeLiteral() {
- var node = createNode(166 /* TypeLiteral */);
+ var node = createNode(166);
node.members = parseObjectTypeMembers();
return finishNode(node);
}
function parseObjectTypeMembers() {
var members;
- if (parseExpected(17 /* OpenBraceToken */)) {
- members = parseList(4 /* TypeMembers */, parseTypeMember);
- parseExpected(18 /* CloseBraceToken */);
+ if (parseExpected(17)) {
+ members = parseList(4, parseTypeMember);
+ parseExpected(18);
}
else {
members = createMissingList();
@@ -17377,76 +15200,76 @@ var ts;
}
function isStartOfMappedType() {
nextToken();
- if (token() === 37 /* PlusToken */ || token() === 38 /* MinusToken */) {
- return nextToken() === 132 /* ReadonlyKeyword */;
+ if (token() === 37 || token() === 38) {
+ return nextToken() === 132;
}
- if (token() === 132 /* ReadonlyKeyword */) {
+ if (token() === 132) {
nextToken();
}
- return token() === 21 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 92 /* InKeyword */;
+ return token() === 21 && nextTokenIsIdentifier() && nextToken() === 92;
}
function parseMappedTypeParameter() {
- var node = createNode(148 /* TypeParameter */);
+ var node = createNode(148);
node.name = parseIdentifier();
- parseExpected(92 /* InKeyword */);
+ parseExpected(92);
node.constraint = parseType();
return finishNode(node);
}
function parseMappedType() {
- var node = createNode(177 /* MappedType */);
- parseExpected(17 /* OpenBraceToken */);
- if (token() === 132 /* ReadonlyKeyword */ || token() === 37 /* PlusToken */ || token() === 38 /* MinusToken */) {
+ var node = createNode(177);
+ parseExpected(17);
+ if (token() === 132 || token() === 37 || token() === 38) {
node.readonlyToken = parseTokenNode();
- if (node.readonlyToken.kind !== 132 /* ReadonlyKeyword */) {
- parseExpectedToken(132 /* ReadonlyKeyword */);
+ if (node.readonlyToken.kind !== 132) {
+ parseExpectedToken(132);
}
}
- parseExpected(21 /* OpenBracketToken */);
+ parseExpected(21);
node.typeParameter = parseMappedTypeParameter();
- parseExpected(22 /* CloseBracketToken */);
- if (token() === 55 /* QuestionToken */ || token() === 37 /* PlusToken */ || token() === 38 /* MinusToken */) {
+ parseExpected(22);
+ if (token() === 55 || token() === 37 || token() === 38) {
node.questionToken = parseTokenNode();
- if (node.questionToken.kind !== 55 /* QuestionToken */) {
- parseExpectedToken(55 /* QuestionToken */);
+ if (node.questionToken.kind !== 55) {
+ parseExpectedToken(55);
}
}
node.type = parseTypeAnnotation();
parseSemicolon();
- parseExpected(18 /* CloseBraceToken */);
+ parseExpected(18);
return finishNode(node);
}
function parseTupleType() {
- var node = createNode(168 /* TupleType */);
- node.elementTypes = parseBracketedList(20 /* TupleElementTypes */, parseType, 21 /* OpenBracketToken */, 22 /* CloseBracketToken */);
+ var node = createNode(168);
+ node.elementTypes = parseBracketedList(20, parseType, 21, 22);
return finishNode(node);
}
function parseParenthesizedType() {
- var node = createNode(173 /* ParenthesizedType */);
- parseExpected(19 /* OpenParenToken */);
+ var node = createNode(173);
+ parseExpected(19);
node.type = parseType();
- parseExpected(20 /* CloseParenToken */);
+ parseExpected(20);
return finishNode(node);
}
function parseFunctionOrConstructorType() {
var pos = getNodePos();
- var kind = parseOptional(94 /* NewKeyword */) ? 164 /* ConstructorType */ : 163 /* FunctionType */;
+ var kind = parseOptional(94) ? 164 : 163;
var node = createNodeWithJSDoc(kind, pos);
- fillSignature(36 /* EqualsGreaterThanToken */, 4 /* Type */, node);
+ fillSignature(36, 4, node);
return finishNode(node);
}
function parseKeywordAndNoDot() {
var node = parseTokenNode();
- return token() === 23 /* DotToken */ ? undefined : node;
+ return token() === 23 ? undefined : node;
}
function parseLiteralTypeNode(negative) {
- var node = createNode(178 /* LiteralType */);
+ var node = createNode(178);
var unaryMinusExpression;
if (negative) {
- unaryMinusExpression = createNode(198 /* PrefixUnaryExpression */);
- unaryMinusExpression.operator = 38 /* MinusToken */;
+ unaryMinusExpression = createNode(198);
+ unaryMinusExpression.operator = 38;
nextToken();
}
- var expression = token() === 101 /* TrueKeyword */ || token() === 86 /* FalseKeyword */
+ var expression = token() === 101 || token() === 86
? parseTokenNode()
: parseLiteralLikeNode(token());
if (negative) {
@@ -17459,79 +15282,78 @@ var ts;
}
function isStartOfTypeOfImportType() {
nextToken();
- return token() === 91 /* ImportKeyword */;
+ return token() === 91;
}
function parseImportType() {
- sourceFile.flags |= 524288 /* PossiblyContainsDynamicImport */;
- var node = createNode(179 /* ImportType */);
- if (parseOptional(103 /* TypeOfKeyword */)) {
+ sourceFile.flags |= 524288;
+ var node = createNode(179);
+ if (parseOptional(103)) {
node.isTypeOf = true;
}
- parseExpected(91 /* ImportKeyword */);
- parseExpected(19 /* OpenParenToken */);
+ parseExpected(91);
+ parseExpected(19);
node.argument = parseType();
- parseExpected(20 /* CloseParenToken */);
- if (parseOptional(23 /* DotToken */)) {
- node.qualifier = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
+ parseExpected(20);
+ if (parseOptional(23)) {
+ node.qualifier = parseEntityName(true, ts.Diagnostics.Type_expected);
}
node.typeArguments = tryParseTypeArguments();
return finishNode(node);
}
function nextTokenIsNumericLiteral() {
- return nextToken() === 8 /* NumericLiteral */;
+ return nextToken() === 8;
}
function parseNonArrayType() {
switch (token()) {
- case 119 /* AnyKeyword */:
- case 142 /* UnknownKeyword */:
- case 137 /* StringKeyword */:
- case 134 /* NumberKeyword */:
- case 138 /* SymbolKeyword */:
- case 122 /* BooleanKeyword */:
- case 140 /* UndefinedKeyword */:
- case 131 /* NeverKeyword */:
- case 135 /* ObjectKeyword */:
- // If these are followed by a dot, then parse these out as a dotted type reference instead.
+ case 119:
+ case 142:
+ case 137:
+ case 134:
+ case 138:
+ case 122:
+ case 140:
+ case 131:
+ case 135:
return tryParse(parseKeywordAndNoDot) || parseTypeReference();
- case 39 /* AsteriskToken */:
- return parseJSDocAllType(/*postfixEquals*/ false);
- case 61 /* AsteriskEqualsToken */:
- return parseJSDocAllType(/*postfixEquals*/ true);
- case 55 /* QuestionToken */:
+ case 39:
+ return parseJSDocAllType(false);
+ case 61:
+ return parseJSDocAllType(true);
+ case 55:
return parseJSDocUnknownOrNullableType();
- case 89 /* FunctionKeyword */:
+ case 89:
return parseJSDocFunctionType();
- case 51 /* ExclamationToken */:
+ case 51:
return parseJSDocNonNullableType();
- case 13 /* NoSubstitutionTemplateLiteral */:
- case 9 /* StringLiteral */:
- case 8 /* NumericLiteral */:
- case 101 /* TrueKeyword */:
- case 86 /* FalseKeyword */:
+ case 13:
+ case 9:
+ case 8:
+ case 101:
+ case 86:
return parseLiteralTypeNode();
- case 38 /* MinusToken */:
- return lookAhead(nextTokenIsNumericLiteral) ? parseLiteralTypeNode(/*negative*/ true) : parseTypeReference();
- case 105 /* VoidKeyword */:
- case 95 /* NullKeyword */:
+ case 38:
+ return lookAhead(nextTokenIsNumericLiteral) ? parseLiteralTypeNode(true) : parseTypeReference();
+ case 105:
+ case 95:
return parseTokenNode();
- case 99 /* ThisKeyword */: {
+ case 99: {
var thisKeyword = parseThisTypeNode();
- if (token() === 127 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 127 && !scanner.hasPrecedingLineBreak()) {
return parseThisTypePredicate(thisKeyword);
}
else {
return thisKeyword;
}
}
- case 103 /* TypeOfKeyword */:
+ case 103:
return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery();
- case 17 /* OpenBraceToken */:
+ case 17:
return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral();
- case 21 /* OpenBracketToken */:
+ case 21:
return parseTupleType();
- case 19 /* OpenParenToken */:
+ case 19:
return parseParenthesizedType();
- case 91 /* ImportKeyword */:
+ case 91:
return parseImportType();
default:
return parseTypeReference();
@@ -17539,42 +15361,40 @@ var ts;
}
function isStartOfType(inStartOfParameter) {
switch (token()) {
- case 119 /* AnyKeyword */:
- case 142 /* UnknownKeyword */:
- case 137 /* StringKeyword */:
- case 134 /* NumberKeyword */:
- case 122 /* BooleanKeyword */:
- case 138 /* SymbolKeyword */:
- case 141 /* UniqueKeyword */:
- case 105 /* VoidKeyword */:
- case 140 /* UndefinedKeyword */:
- case 95 /* NullKeyword */:
- case 99 /* ThisKeyword */:
- case 103 /* TypeOfKeyword */:
- case 131 /* NeverKeyword */:
- case 17 /* OpenBraceToken */:
- case 21 /* OpenBracketToken */:
- case 27 /* LessThanToken */:
- case 49 /* BarToken */:
- case 48 /* AmpersandToken */:
- case 94 /* NewKeyword */:
- case 9 /* StringLiteral */:
- case 8 /* NumericLiteral */:
- case 101 /* TrueKeyword */:
- case 86 /* FalseKeyword */:
- case 135 /* ObjectKeyword */:
- case 39 /* AsteriskToken */:
- case 55 /* QuestionToken */:
- case 51 /* ExclamationToken */:
- case 24 /* DotDotDotToken */:
- case 126 /* InferKeyword */:
- case 91 /* ImportKeyword */:
+ case 119:
+ case 142:
+ case 137:
+ case 134:
+ case 122:
+ case 138:
+ case 141:
+ case 105:
+ case 140:
+ case 95:
+ case 99:
+ case 103:
+ case 131:
+ case 17:
+ case 21:
+ case 27:
+ case 49:
+ case 48:
+ case 94:
+ case 9:
+ case 8:
+ case 101:
+ case 86:
+ case 135:
+ case 39:
+ case 55:
+ case 51:
+ case 24:
+ case 126:
+ case 91:
return true;
- case 38 /* MinusToken */:
+ case 38:
return !inStartOfParameter && lookAhead(nextTokenIsNumericLiteral);
- case 19 /* OpenParenToken */:
- // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier,
- // or something that starts a type. We don't want to consider things like '(1)' a type.
+ case 19:
return !inStartOfParameter && lookAhead(isStartOfParenthesizedOrFunctionType);
default:
return isIdentifier();
@@ -17582,35 +15402,34 @@ var ts;
}
function isStartOfParenthesizedOrFunctionType() {
nextToken();
- return token() === 20 /* CloseParenToken */ || isStartOfParameter() || isStartOfType();
+ return token() === 20 || isStartOfParameter() || isStartOfType();
}
function parsePostfixTypeOrHigher() {
var type = parseNonArrayType();
while (!scanner.hasPrecedingLineBreak()) {
switch (token()) {
- case 51 /* ExclamationToken */:
- type = createJSDocPostfixType(282 /* JSDocNonNullableType */, type);
+ case 51:
+ type = createJSDocPostfixType(282, type);
break;
- case 55 /* QuestionToken */:
- // If not in JSDoc and next token is start of a type we have a conditional type
- if (!(contextFlags & 2097152 /* JSDoc */) && lookAhead(nextTokenIsStartOfType)) {
+ case 55:
+ if (!(contextFlags & 2097152) && lookAhead(nextTokenIsStartOfType)) {
return type;
}
- type = createJSDocPostfixType(281 /* JSDocNullableType */, type);
+ type = createJSDocPostfixType(281, type);
break;
- case 21 /* OpenBracketToken */:
- parseExpected(21 /* OpenBracketToken */);
+ case 21:
+ parseExpected(21);
if (isStartOfType()) {
- var node = createNode(176 /* IndexedAccessType */, type.pos);
+ var node = createNode(176, type.pos);
node.objectType = type;
node.indexType = parseType();
- parseExpected(22 /* CloseBracketToken */);
+ parseExpected(22);
type = finishNode(node);
}
else {
- var node = createNode(167 /* ArrayType */, type.pos);
+ var node = createNode(167, type.pos);
node.elementType = type;
- parseExpected(22 /* CloseBracketToken */);
+ parseExpected(22);
type = finishNode(node);
}
break;
@@ -17627,16 +15446,16 @@ var ts;
return finishNode(postfix);
}
function parseTypeOperator(operator) {
- var node = createNode(175 /* TypeOperator */);
+ var node = createNode(175);
parseExpected(operator);
node.operator = operator;
node.type = parseTypeOperatorOrHigher();
return finishNode(node);
}
function parseInferType() {
- var node = createNode(172 /* InferType */);
- parseExpected(126 /* InferKeyword */);
- var typeParameter = createNode(148 /* TypeParameter */);
+ var node = createNode(172);
+ parseExpected(126);
+ var typeParameter = createNode(148);
typeParameter.name = parseIdentifier();
node.typeParameter = finishNode(typeParameter);
return finishNode(node);
@@ -17644,10 +15463,10 @@ var ts;
function parseTypeOperatorOrHigher() {
var operator = token();
switch (operator) {
- case 128 /* KeyOfKeyword */:
- case 141 /* UniqueKeyword */:
+ case 128:
+ case 141:
return parseTypeOperator(operator);
- case 126 /* InferKeyword */:
+ case 126:
return parseInferType();
}
return parsePostfixTypeOrHigher();
@@ -17667,28 +15486,26 @@ var ts;
return type;
}
function parseIntersectionTypeOrHigher() {
- return parseUnionOrIntersectionType(170 /* IntersectionType */, parseTypeOperatorOrHigher, 48 /* AmpersandToken */);
+ return parseUnionOrIntersectionType(170, parseTypeOperatorOrHigher, 48);
}
function parseUnionTypeOrHigher() {
- return parseUnionOrIntersectionType(169 /* UnionType */, parseIntersectionTypeOrHigher, 49 /* BarToken */);
+ return parseUnionOrIntersectionType(169, parseIntersectionTypeOrHigher, 49);
}
function isStartOfFunctionType() {
- if (token() === 27 /* LessThanToken */) {
+ if (token() === 27) {
return true;
}
- return token() === 19 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType);
+ return token() === 19 && lookAhead(isUnambiguouslyStartOfFunctionType);
}
function skipParameterStart() {
if (ts.isModifierKind(token())) {
- // Skip modifiers
parseModifiers();
}
- if (isIdentifier() || token() === 99 /* ThisKeyword */) {
+ if (isIdentifier() || token() === 99) {
nextToken();
return true;
}
- if (token() === 21 /* OpenBracketToken */ || token() === 17 /* OpenBraceToken */) {
- // Return true if we can parse an array or object binding pattern with no errors
+ if (token() === 21 || token() === 17) {
var previousErrorCount = parseDiagnostics.length;
parseIdentifierOrPattern();
return previousErrorCount === parseDiagnostics.length;
@@ -17697,26 +15514,17 @@ var ts;
}
function isUnambiguouslyStartOfFunctionType() {
nextToken();
- if (token() === 20 /* CloseParenToken */ || token() === 24 /* DotDotDotToken */) {
- // ( )
- // ( ...
+ if (token() === 20 || token() === 24) {
return true;
}
if (skipParameterStart()) {
- // We successfully skipped modifiers (if any) and an identifier or binding pattern,
- // now see if we have something that indicates a parameter declaration
- if (token() === 56 /* ColonToken */ || token() === 26 /* CommaToken */ ||
- token() === 55 /* QuestionToken */ || token() === 58 /* EqualsToken */) {
- // ( xxx :
- // ( xxx ,
- // ( xxx ?
- // ( xxx =
+ if (token() === 56 || token() === 26 ||
+ token() === 55 || token() === 58) {
return true;
}
- if (token() === 20 /* CloseParenToken */) {
+ if (token() === 20) {
nextToken();
- if (token() === 36 /* EqualsGreaterThanToken */) {
- // ( xxx ) =>
+ if (token() === 36) {
return true;
}
}
@@ -17727,7 +15535,7 @@ var ts;
var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
var type = parseType();
if (typePredicateVariable) {
- var node = createNode(161 /* TypePredicate */, typePredicateVariable.pos);
+ var node = createNode(161, typePredicateVariable.pos);
node.parameterName = typePredicateVariable;
node.type = type;
return finishNode(node);
@@ -17738,60 +15546,56 @@ var ts;
}
function parseTypePredicatePrefix() {
var id = parseIdentifier();
- if (token() === 127 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 127 && !scanner.hasPrecedingLineBreak()) {
nextToken();
return id;
}
}
function parseType() {
- // The rules about 'yield' only apply to actual code/expression contexts. They don't
- // apply to 'type' contexts. So we disable these parameters here before moving on.
- return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker);
+ return doOutsideOfContext(20480, parseTypeWorker);
}
function parseTypeWorker(noConditionalTypes) {
- if (isStartOfFunctionType() || token() === 94 /* NewKeyword */) {
+ if (isStartOfFunctionType() || token() === 94) {
return parseFunctionOrConstructorType();
}
var type = parseUnionTypeOrHigher();
- if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(85 /* ExtendsKeyword */)) {
- var node = createNode(171 /* ConditionalType */, type.pos);
+ if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(85)) {
+ var node = createNode(171, type.pos);
node.checkType = type;
- // The type following 'extends' is not permitted to be another conditional type
- node.extendsType = parseTypeWorker(/*noConditionalTypes*/ true);
- parseExpected(55 /* QuestionToken */);
+ node.extendsType = parseTypeWorker(true);
+ parseExpected(55);
node.trueType = parseTypeWorker();
- parseExpected(56 /* ColonToken */);
+ parseExpected(56);
node.falseType = parseTypeWorker();
return finishNode(node);
}
return type;
}
function parseTypeAnnotation() {
- return parseOptional(56 /* ColonToken */) ? parseType() : undefined;
+ return parseOptional(56) ? parseType() : undefined;
}
- // EXPRESSIONS
function isStartOfLeftHandSideExpression() {
switch (token()) {
- case 99 /* ThisKeyword */:
- case 97 /* SuperKeyword */:
- case 95 /* NullKeyword */:
- case 101 /* TrueKeyword */:
- case 86 /* FalseKeyword */:
- case 8 /* NumericLiteral */:
- case 9 /* StringLiteral */:
- case 13 /* NoSubstitutionTemplateLiteral */:
- case 14 /* TemplateHead */:
- case 19 /* OpenParenToken */:
- case 21 /* OpenBracketToken */:
- case 17 /* OpenBraceToken */:
- case 89 /* FunctionKeyword */:
- case 75 /* ClassKeyword */:
- case 94 /* NewKeyword */:
- case 41 /* SlashToken */:
- case 63 /* SlashEqualsToken */:
- case 71 /* Identifier */:
+ case 99:
+ case 97:
+ case 95:
+ case 101:
+ case 86:
+ case 8:
+ case 9:
+ case 13:
+ case 14:
+ case 19:
+ case 21:
+ case 17:
+ case 89:
+ case 75:
+ case 94:
+ case 41:
+ case 63:
+ case 71:
return true;
- case 91 /* ImportKeyword */:
+ case 91:
return lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
default:
return isIdentifier();
@@ -17802,27 +15606,20 @@ var ts;
return true;
}
switch (token()) {
- case 37 /* PlusToken */:
- case 38 /* MinusToken */:
- case 52 /* TildeToken */:
- case 51 /* ExclamationToken */:
- case 80 /* DeleteKeyword */:
- case 103 /* TypeOfKeyword */:
- case 105 /* VoidKeyword */:
- case 43 /* PlusPlusToken */:
- case 44 /* MinusMinusToken */:
- case 27 /* LessThanToken */:
- case 121 /* AwaitKeyword */:
- case 116 /* YieldKeyword */:
- // Yield/await always starts an expression. Either it is an identifier (in which case
- // it is definitely an expression). Or it's a keyword (either because we're in
- // a generator or async function, or in strict mode (or both)) and it started a yield or await expression.
+ case 37:
+ case 38:
+ case 52:
+ case 51:
+ case 80:
+ case 103:
+ case 105:
+ case 43:
+ case 44:
+ case 27:
+ case 121:
+ case 116:
return true;
default:
- // Error tolerance. If we see the start of some binary operator, we consider
- // that the start of an expression. That way we'll parse out a missing identifier,
- // give a good message about an identifier being missing, and then consume the
- // rest of the binary expression.
if (isBinaryOperator()) {
return true;
}
@@ -17830,114 +15627,52 @@ var ts;
}
}
function isStartOfExpressionStatement() {
- // As per the grammar, none of '{' or 'function' or 'class' can start an expression statement.
- return token() !== 17 /* OpenBraceToken */ &&
- token() !== 89 /* FunctionKeyword */ &&
- token() !== 75 /* ClassKeyword */ &&
- token() !== 57 /* AtToken */ &&
+ return token() !== 17 &&
+ token() !== 89 &&
+ token() !== 75 &&
+ token() !== 57 &&
isStartOfExpression();
}
function parseExpression() {
- // Expression[in]:
- // AssignmentExpression[in]
- // Expression[in] , AssignmentExpression[in]
- // clear the decorator context when parsing Expression, as it should be unambiguous when parsing a decorator
var saveDecoratorContext = inDecoratorContext();
if (saveDecoratorContext) {
- setDecoratorContext(/*val*/ false);
+ setDecoratorContext(false);
}
var expr = parseAssignmentExpressionOrHigher();
var operatorToken;
- while ((operatorToken = parseOptionalToken(26 /* CommaToken */))) {
+ while ((operatorToken = parseOptionalToken(26))) {
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher());
}
if (saveDecoratorContext) {
- setDecoratorContext(/*val*/ true);
+ setDecoratorContext(true);
}
return expr;
}
function parseInitializer() {
- return parseOptional(58 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
+ return parseOptional(58) ? parseAssignmentExpressionOrHigher() : undefined;
}
function parseAssignmentExpressionOrHigher() {
- // AssignmentExpression[in,yield]:
- // 1) ConditionalExpression[?in,?yield]
- // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
- // 3) LeftHandSideExpression AssignmentOperator AssignmentExpression[?in,?yield]
- // 4) ArrowFunctionExpression[?in,?yield]
- // 5) AsyncArrowFunctionExpression[in,yield,await]
- // 6) [+Yield] YieldExpression[?In]
- //
- // Note: for ease of implementation we treat productions '2' and '3' as the same thing.
- // (i.e. they're both BinaryExpressions with an assignment operator in it).
- // First, do the simple check if we have a YieldExpression (production '6').
if (isYieldExpression()) {
return parseYieldExpression();
}
- // Then, check if we have an arrow function (production '4' and '5') that starts with a parenthesized
- // parameter list or is an async arrow function.
- // AsyncArrowFunctionExpression:
- // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In]
- // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In]
- // Production (1) of AsyncArrowFunctionExpression is parsed in "tryParseAsyncSimpleArrowFunctionExpression".
- // And production (2) is parsed in "tryParseParenthesizedArrowFunctionExpression".
- //
- // If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
- // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
- // with AssignmentExpression if we see one.
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
if (arrowExpression) {
return arrowExpression;
}
- // Now try to see if we're in production '1', '2' or '3'. A conditional expression can
- // start with a LogicalOrExpression, while the assignment productions can only start with
- // LeftHandSideExpressions.
- //
- // So, first, we try to just parse out a BinaryExpression. If we get something that is a
- // LeftHandSide or higher, then we can try to parse out the assignment expression part.
- // Otherwise, we try to parse out the conditional expression bit. We want to allow any
- // binary expression here, so we pass in the 'lowest' precedence here so that it matches
- // and consumes anything.
- var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
- // To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized
- // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
- // identifier and the current token is an arrow.
- if (expr.kind === 71 /* Identifier */ && token() === 36 /* EqualsGreaterThanToken */) {
+ var expr = parseBinaryExpressionOrHigher(0);
+ if (expr.kind === 71 && token() === 36) {
return parseSimpleArrowFunctionExpression(expr);
}
- // Now see if we might be in cases '2' or '3'.
- // If the expression was a LHS expression, and we have an assignment operator, then
- // we're in '2' or '3'. Consume the assignment and return.
- //
- // Note: we call reScanGreaterToken so that we get an appropriately merged token
- // for cases like `> > =` becoming `>>=`
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher());
}
- // It wasn't an assignment or a lambda. This is a conditional expression:
return parseConditionalExpressionRest(expr);
}
function isYieldExpression() {
- if (token() === 116 /* YieldKeyword */) {
- // If we have a 'yield' keyword, and this is a context where yield expressions are
- // allowed, then definitely parse out a yield expression.
+ if (token() === 116) {
if (inYieldContext()) {
return true;
}
- // We're in a context where 'yield expr' is not allowed. However, if we can
- // definitely tell that the user was trying to parse a 'yield expr' and not
- // just a normal expr that start with a 'yield' identifier, then parse out
- // a 'yield expr'. We can then report an error later that they are only
- // allowed in generator expressions.
- //
- // for example, if we see 'yield(foo)', then we'll have to treat that as an
- // invocation expression of something called 'yield'. However, if we have
- // 'yield foo' then that is not legal as a normal expression, so we can
- // definitely recognize this as a yield expression.
- //
- // for now we just check if the next token is an identifier. More heuristics
- // can be added here later as necessary. We just need to make sure that we
- // don't accidentally consume something legal.
return lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine);
}
return false;
@@ -17947,302 +15682,213 @@ var ts;
return !scanner.hasPrecedingLineBreak() && isIdentifier();
}
function parseYieldExpression() {
- var node = createNode(203 /* YieldExpression */);
- // YieldExpression[In] :
- // yield
- // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield]
- // yield [no LineTerminator here] * [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield]
+ var node = createNode(203);
nextToken();
if (!scanner.hasPrecedingLineBreak() &&
- (token() === 39 /* AsteriskToken */ || isStartOfExpression())) {
- node.asteriskToken = parseOptionalToken(39 /* AsteriskToken */);
+ (token() === 39 || isStartOfExpression())) {
+ node.asteriskToken = parseOptionalToken(39);
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
else {
- // if the next token is not on the same line as yield. or we don't have an '*' or
- // the start of an expression, then this is just a simple "yield" expression.
return finishNode(node);
}
}
function parseSimpleArrowFunctionExpression(identifier, asyncModifier) {
- ts.Debug.assert(token() === 36 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
+ ts.Debug.assert(token() === 36, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
var node;
if (asyncModifier) {
- node = createNode(193 /* ArrowFunction */, asyncModifier.pos);
+ node = createNode(193, asyncModifier.pos);
node.modifiers = asyncModifier;
}
else {
- node = createNode(193 /* ArrowFunction */, identifier.pos);
+ node = createNode(193, identifier.pos);
}
- var parameter = createNode(149 /* Parameter */, identifier.pos);
+ var parameter = createNode(149, identifier.pos);
parameter.name = identifier;
finishNode(parameter);
node.parameters = createNodeArray([parameter], parameter.pos, parameter.end);
- node.equalsGreaterThanToken = parseExpectedToken(36 /* EqualsGreaterThanToken */);
- node.body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
+ node.equalsGreaterThanToken = parseExpectedToken(36);
+ node.body = parseArrowFunctionExpressionBody(!!asyncModifier);
return addJSDocComment(finishNode(node));
}
function tryParseParenthesizedArrowFunctionExpression() {
var triState = isParenthesizedArrowFunctionExpression();
- if (triState === 0 /* False */) {
- // It's definitely not a parenthesized arrow function expression.
+ if (triState === 0) {
return undefined;
}
- // If we definitely have an arrow function, then we can just parse one, not requiring a
- // following => or { token. Otherwise, we *might* have an arrow function. Try to parse
- // it out, but don't allow any ambiguity, and return 'undefined' if this could be an
- // expression instead.
- var arrowFunction = triState === 1 /* True */
- ? parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ true)
+ var arrowFunction = triState === 1
+ ? parseParenthesizedArrowFunctionExpressionHead(true)
: tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead);
if (!arrowFunction) {
- // Didn't appear to actually be a parenthesized arrow function. Just bail out.
return undefined;
}
- var isAsync = ts.hasModifier(arrowFunction, 256 /* Async */);
- // If we have an arrow, then try to parse the body. Even if not, try to parse if we
- // have an opening brace, just in case we're in an error state.
+ var isAsync = ts.hasModifier(arrowFunction, 256);
var lastToken = token();
- arrowFunction.equalsGreaterThanToken = parseExpectedToken(36 /* EqualsGreaterThanToken */);
- arrowFunction.body = (lastToken === 36 /* EqualsGreaterThanToken */ || lastToken === 17 /* OpenBraceToken */)
+ arrowFunction.equalsGreaterThanToken = parseExpectedToken(36);
+ arrowFunction.body = (lastToken === 36 || lastToken === 17)
? parseArrowFunctionExpressionBody(isAsync)
: parseIdentifier();
return finishNode(arrowFunction);
}
- // True -> We definitely expect a parenthesized arrow function here.
- // False -> There *cannot* be a parenthesized arrow function here.
- // Unknown -> There *might* be a parenthesized arrow function here.
- // Speculatively look ahead to be sure, and rollback if not.
function isParenthesizedArrowFunctionExpression() {
- if (token() === 19 /* OpenParenToken */ || token() === 27 /* LessThanToken */ || token() === 120 /* AsyncKeyword */) {
+ if (token() === 19 || token() === 27 || token() === 120) {
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
- if (token() === 36 /* EqualsGreaterThanToken */) {
- // ERROR RECOVERY TWEAK:
- // If we see a standalone => try to parse it as an arrow function expression as that's
- // likely what the user intended to write.
- return 1 /* True */;
+ if (token() === 36) {
+ return 1;
}
- // Definitely not a parenthesized arrow function.
- return 0 /* False */;
+ return 0;
}
function isParenthesizedArrowFunctionExpressionWorker() {
- if (token() === 120 /* AsyncKeyword */) {
+ if (token() === 120) {
nextToken();
if (scanner.hasPrecedingLineBreak()) {
- return 0 /* False */;
+ return 0;
}
- if (token() !== 19 /* OpenParenToken */ && token() !== 27 /* LessThanToken */) {
- return 0 /* False */;
+ if (token() !== 19 && token() !== 27) {
+ return 0;
}
}
var first = token();
var second = nextToken();
- if (first === 19 /* OpenParenToken */) {
- if (second === 20 /* CloseParenToken */) {
- // Simple cases: "() =>", "(): ", and "() {".
- // This is an arrow function with no parameters.
- // The last one is not actually an arrow function,
- // but this is probably what the user intended.
+ if (first === 19) {
+ if (second === 20) {
var third = nextToken();
switch (third) {
- case 36 /* EqualsGreaterThanToken */:
- case 56 /* ColonToken */:
- case 17 /* OpenBraceToken */:
- return 1 /* True */;
+ case 36:
+ case 56:
+ case 17:
+ return 1;
default:
- return 0 /* False */;
+ return 0;
}
}
- // If encounter "([" or "({", this could be the start of a binding pattern.
- // Examples:
- // ([ x ]) => { }
- // ({ x }) => { }
- // ([ x ])
- // ({ x })
- if (second === 21 /* OpenBracketToken */ || second === 17 /* OpenBraceToken */) {
- return 2 /* Unknown */;
+ if (second === 21 || second === 17) {
+ return 2;
}
- // Simple case: "(..."
- // This is an arrow function with a rest parameter.
- if (second === 24 /* DotDotDotToken */) {
- return 1 /* True */;
+ if (second === 24) {
+ return 1;
}
- // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This
- // isn't actually allowed, but we want to treat it as a lambda so we can provide
- // a good error message.
- if (ts.isModifierKind(second) && second !== 120 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
- return 1 /* True */;
+ if (ts.isModifierKind(second) && second !== 120 && lookAhead(nextTokenIsIdentifier)) {
+ return 1;
}
- // If we had "(" followed by something that's not an identifier,
- // then this definitely doesn't look like a lambda.
if (!isIdentifier()) {
- return 0 /* False */;
+ return 0;
}
switch (nextToken()) {
- case 56 /* ColonToken */:
- // If we have something like "(a:", then we must have a
- // type-annotated parameter in an arrow function expression.
- return 1 /* True */;
- case 55 /* QuestionToken */:
+ case 56:
+ return 1;
+ case 55:
nextToken();
- // If we have "(a?:" or "(a?," or "(a?=" or "(a?)" then it is definitely a lambda.
- if (token() === 56 /* ColonToken */ || token() === 26 /* CommaToken */ || token() === 58 /* EqualsToken */ || token() === 20 /* CloseParenToken */) {
- return 1 /* True */;
+ if (token() === 56 || token() === 26 || token() === 58 || token() === 20) {
+ return 1;
}
- // Otherwise it is definitely not a lambda.
- return 0 /* False */;
- case 26 /* CommaToken */:
- case 58 /* EqualsToken */:
- case 20 /* CloseParenToken */:
- // If we have "(a," or "(a=" or "(a)" this *could* be an arrow function
- return 2 /* Unknown */;
+ return 0;
+ case 26:
+ case 58:
+ case 20:
+ return 2;
}
- // It is definitely not an arrow function
- return 0 /* False */;
+ return 0;
}
else {
- ts.Debug.assert(first === 27 /* LessThanToken */);
- // If we have "<" not followed by an identifier,
- // then this definitely is not an arrow function.
+ ts.Debug.assert(first === 27);
if (!isIdentifier()) {
- return 0 /* False */;
+ return 0;
}
- // JSX overrides
- if (sourceFile.languageVariant === 1 /* JSX */) {
+ if (sourceFile.languageVariant === 1) {
var isArrowFunctionInJsx = lookAhead(function () {
var third = nextToken();
- if (third === 85 /* ExtendsKeyword */) {
+ if (third === 85) {
var fourth = nextToken();
switch (fourth) {
- case 58 /* EqualsToken */:
- case 29 /* GreaterThanToken */:
+ case 58:
+ case 29:
return false;
default:
return true;
}
}
- else if (third === 26 /* CommaToken */) {
+ else if (third === 26) {
return true;
}
return false;
});
if (isArrowFunctionInJsx) {
- return 1 /* True */;
+ return 1;
}
- return 0 /* False */;
+ return 0;
}
- // This *could* be a parenthesized arrow function.
- return 2 /* Unknown */;
+ return 2;
}
}
function parsePossibleParenthesizedArrowFunctionExpressionHead() {
- return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
+ return parseParenthesizedArrowFunctionExpressionHead(false);
}
function tryParseAsyncSimpleArrowFunctionExpression() {
- // We do a check here so that we won't be doing unnecessarily call to "lookAhead"
- if (token() === 120 /* AsyncKeyword */) {
- if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
+ if (token() === 120) {
+ if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1) {
var asyncModifier = parseModifiersForArrowFunction();
- var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
+ var expr = parseBinaryExpressionOrHigher(0);
return parseSimpleArrowFunctionExpression(expr, asyncModifier);
}
}
return undefined;
}
function isUnParenthesizedAsyncArrowFunctionWorker() {
- // AsyncArrowFunctionExpression:
- // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In]
- // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In]
- if (token() === 120 /* AsyncKeyword */) {
+ if (token() === 120) {
nextToken();
- // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function
- // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher"
- if (scanner.hasPrecedingLineBreak() || token() === 36 /* EqualsGreaterThanToken */) {
- return 0 /* False */;
+ if (scanner.hasPrecedingLineBreak() || token() === 36) {
+ return 0;
}
- // Check for un-parenthesized AsyncArrowFunction
- var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
- if (!scanner.hasPrecedingLineBreak() && expr.kind === 71 /* Identifier */ && token() === 36 /* EqualsGreaterThanToken */) {
- return 1 /* True */;
+ var expr = parseBinaryExpressionOrHigher(0);
+ if (!scanner.hasPrecedingLineBreak() && expr.kind === 71 && token() === 36) {
+ return 1;
}
}
- return 0 /* False */;
+ return 0;
}
function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {
- var node = createNodeWithJSDoc(193 /* ArrowFunction */);
+ var node = createNodeWithJSDoc(193);
node.modifiers = parseModifiersForArrowFunction();
- var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
- // Arrow functions are never generators.
- //
- // If we're speculatively parsing a signature for a parenthesized arrow function, then
- // we have to have a complete parameter list. Otherwise we might see something like
- // a => (b => c)
- // And think that "(b =>" was actually a parenthesized arrow function with a missing
- // close paren.
- if (!fillSignature(56 /* ColonToken */, isAsync, node) && !allowAmbiguity) {
+ var isAsync = ts.hasModifier(node, 256) ? 2 : 0;
+ if (!fillSignature(56, isAsync, node) && !allowAmbiguity) {
return undefined;
}
- // Parsing a signature isn't enough.
- // Parenthesized arrow signatures often look like other valid expressions.
- // For instance:
- // - "(x = 10)" is an assignment expression parsed as a signature with a default parameter value.
- // - "(x,y)" is a comma expression parsed as a signature with two parameters.
- // - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation.
- //
- // So we need just a bit of lookahead to ensure that it can only be a signature.
- if (!allowAmbiguity && token() !== 36 /* EqualsGreaterThanToken */ && token() !== 17 /* OpenBraceToken */) {
- // Returning undefined here will cause our caller to rewind to where we started from.
+ if (!allowAmbiguity && token() !== 36 && token() !== 17) {
return undefined;
}
return node;
}
function parseArrowFunctionExpressionBody(isAsync) {
- if (token() === 17 /* OpenBraceToken */) {
- return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
+ if (token() === 17) {
+ return parseFunctionBlock(isAsync ? 2 : 0);
}
- if (token() !== 25 /* SemicolonToken */ &&
- token() !== 89 /* FunctionKeyword */ &&
- token() !== 75 /* ClassKeyword */ &&
+ if (token() !== 25 &&
+ token() !== 89 &&
+ token() !== 75 &&
isStartOfStatement() &&
!isStartOfExpressionStatement()) {
- // Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations)
- //
- // Here we try to recover from a potential error situation in the case where the
- // user meant to supply a block. For example, if the user wrote:
- //
- // a =>
- // let v = 0;
- // }
- //
- // they may be missing an open brace. Check to see if that's the case so we can
- // try to recover better. If we don't do this, then the next close curly we see may end
- // up preemptively closing the containing construct.
- //
- // Note: even when 'IgnoreMissingOpenBrace' is passed, parseBody will still error.
- return parseFunctionBlock(16 /* IgnoreMissingOpenBrace */ | (isAsync ? 2 /* Await */ : 0 /* None */));
+ return parseFunctionBlock(16 | (isAsync ? 2 : 0));
}
return isAsync
? doInAwaitContext(parseAssignmentExpressionOrHigher)
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
}
function parseConditionalExpressionRest(leftOperand) {
- // Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
- var questionToken = parseOptionalToken(55 /* QuestionToken */);
+ var questionToken = parseOptionalToken(55);
if (!questionToken) {
return leftOperand;
}
- // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
- // we do not that for the 'whenFalse' part.
- var node = createNode(201 /* ConditionalExpression */, leftOperand.pos);
+ var node = createNode(201, leftOperand.pos);
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
- node.colonToken = parseExpectedToken(56 /* ColonToken */);
+ node.colonToken = parseExpectedToken(56);
node.whenFalse = ts.nodeIsPresent(node.colonToken)
? parseAssignmentExpressionOrHigher()
- : createMissingNode(71 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(56 /* ColonToken */));
+ : createMissingNode(71, false, ts.Diagnostics._0_expected, ts.tokenToString(56));
return finishNode(node);
}
function parseBinaryExpressionOrHigher(precedence) {
@@ -18250,50 +15896,22 @@ var ts;
return parseBinaryExpressionRest(precedence, leftOperand);
}
function isInOrOfKeyword(t) {
- return t === 92 /* InKeyword */ || t === 145 /* OfKeyword */;
+ return t === 92 || t === 145;
}
function parseBinaryExpressionRest(precedence, leftOperand) {
while (true) {
- // We either have a binary operator here, or we're finished. We call
- // reScanGreaterToken so that we merge token sequences like > and = into >=
reScanGreaterToken();
var newPrecedence = ts.getBinaryOperatorPrecedence(token());
- // Check the precedence to see if we should "take" this operator
- // - For left associative operator (all operator but **), consume the operator,
- // recursively call the function below, and parse binaryExpression as a rightOperand
- // of the caller if the new precedence of the operator is greater then or equal to the current precedence.
- // For example:
- // a - b - c;
- // ^token; leftOperand = b. Return b to the caller as a rightOperand
- // a * b - c
- // ^token; leftOperand = b. Return b to the caller as a rightOperand
- // a - b * c;
- // ^token; leftOperand = b. Return b * c to the caller as a rightOperand
- // - For right associative operator (**), consume the operator, recursively call the function
- // and parse binaryExpression as a rightOperand of the caller if the new precedence of
- // the operator is strictly grater than the current precedence
- // For example:
- // a ** b ** c;
- // ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand
- // a - b ** c;
- // ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand
- // a ** b - c
- // ^token; leftOperand = b. Return b to the caller as a rightOperand
- var consumeCurrentOperator = token() === 40 /* AsteriskAsteriskToken */ ?
+ var consumeCurrentOperator = token() === 40 ?
newPrecedence >= precedence :
newPrecedence > precedence;
if (!consumeCurrentOperator) {
break;
}
- if (token() === 92 /* InKeyword */ && inDisallowInContext()) {
+ if (token() === 92 && inDisallowInContext()) {
break;
}
- if (token() === 118 /* AsKeyword */) {
- // Make sure we *do* perform ASI for constructs like this:
- // var x = foo
- // as (Bar)
- // This should be parsed as an initialized variable, followed
- // by a function call to 'as' with the argument 'Bar'
+ if (token() === 118) {
if (scanner.hasPrecedingLineBreak()) {
break;
}
@@ -18309,105 +15927,77 @@ var ts;
return leftOperand;
}
function isBinaryOperator() {
- if (inDisallowInContext() && token() === 92 /* InKeyword */) {
+ if (inDisallowInContext() && token() === 92) {
return false;
}
return ts.getBinaryOperatorPrecedence(token()) > 0;
}
function makeBinaryExpression(left, operatorToken, right) {
- var node = createNode(200 /* BinaryExpression */, left.pos);
+ var node = createNode(200, left.pos);
node.left = left;
node.operatorToken = operatorToken;
node.right = right;
return finishNode(node);
}
function makeAsExpression(left, right) {
- var node = createNode(208 /* AsExpression */, left.pos);
+ var node = createNode(208, left.pos);
node.expression = left;
node.type = right;
return finishNode(node);
}
function parsePrefixUnaryExpression() {
- var node = createNode(198 /* PrefixUnaryExpression */);
+ var node = createNode(198);
node.operator = token();
nextToken();
node.operand = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseDeleteExpression() {
- var node = createNode(194 /* DeleteExpression */);
+ var node = createNode(194);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseTypeOfExpression() {
- var node = createNode(195 /* TypeOfExpression */);
+ var node = createNode(195);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseVoidExpression() {
- var node = createNode(196 /* VoidExpression */);
+ var node = createNode(196);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function isAwaitExpression() {
- if (token() === 121 /* AwaitKeyword */) {
+ if (token() === 121) {
if (inAwaitContext()) {
return true;
}
- // here we are using similar heuristics as 'isYieldExpression'
return lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine);
}
return false;
}
function parseAwaitExpression() {
- var node = createNode(197 /* AwaitExpression */);
+ var node = createNode(197);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
- /**
- * Parse ES7 exponential expression and await expression
- *
- * ES7 ExponentiationExpression:
- * 1) UnaryExpression[?Yield]
- * 2) UpdateExpression[?Yield] ** ExponentiationExpression[?Yield]
- *
- */
function parseUnaryExpressionOrHigher() {
- /**
- * ES7 UpdateExpression:
- * 1) LeftHandSideExpression[?Yield]
- * 2) LeftHandSideExpression[?Yield][no LineTerminator here]++
- * 3) LeftHandSideExpression[?Yield][no LineTerminator here]--
- * 4) ++UnaryExpression[?Yield]
- * 5) --UnaryExpression[?Yield]
- */
if (isUpdateExpression()) {
var updateExpression = parseUpdateExpression();
- return token() === 40 /* AsteriskAsteriskToken */ ?
+ return token() === 40 ?
parseBinaryExpressionRest(ts.getBinaryOperatorPrecedence(token()), updateExpression) :
updateExpression;
}
- /**
- * ES7 UnaryExpression:
- * 1) UpdateExpression[?yield]
- * 2) delete UpdateExpression[?yield]
- * 3) void UpdateExpression[?yield]
- * 4) typeof UpdateExpression[?yield]
- * 5) + UpdateExpression[?yield]
- * 6) - UpdateExpression[?yield]
- * 7) ~ UpdateExpression[?yield]
- * 8) ! UpdateExpression[?yield]
- */
var unaryOperator = token();
var simpleUnaryExpression = parseSimpleUnaryExpression();
- if (token() === 40 /* AsteriskAsteriskToken */) {
+ if (token() === 40) {
var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);
var end = simpleUnaryExpression.end;
- if (simpleUnaryExpression.kind === 190 /* TypeAssertionExpression */) {
+ if (simpleUnaryExpression.kind === 190) {
parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
}
else {
@@ -18416,108 +16006,63 @@ var ts;
}
return simpleUnaryExpression;
}
- /**
- * Parse ES7 simple-unary expression or higher:
- *
- * ES7 UnaryExpression:
- * 1) UpdateExpression[?yield]
- * 2) delete UnaryExpression[?yield]
- * 3) void UnaryExpression[?yield]
- * 4) typeof UnaryExpression[?yield]
- * 5) + UnaryExpression[?yield]
- * 6) - UnaryExpression[?yield]
- * 7) ~ UnaryExpression[?yield]
- * 8) ! UnaryExpression[?yield]
- * 9) [+Await] await UnaryExpression[?yield]
- */
function parseSimpleUnaryExpression() {
switch (token()) {
- case 37 /* PlusToken */:
- case 38 /* MinusToken */:
- case 52 /* TildeToken */:
- case 51 /* ExclamationToken */:
+ case 37:
+ case 38:
+ case 52:
+ case 51:
return parsePrefixUnaryExpression();
- case 80 /* DeleteKeyword */:
+ case 80:
return parseDeleteExpression();
- case 103 /* TypeOfKeyword */:
+ case 103:
return parseTypeOfExpression();
- case 105 /* VoidKeyword */:
+ case 105:
return parseVoidExpression();
- case 27 /* LessThanToken */:
- // This is modified UnaryExpression grammar in TypeScript
- // UnaryExpression (modified):
- // < type > UnaryExpression
+ case 27:
return parseTypeAssertion();
- case 121 /* AwaitKeyword */:
+ case 121:
if (isAwaitExpression()) {
return parseAwaitExpression();
}
- // falls through
default:
return parseUpdateExpression();
}
}
- /**
- * Check if the current token can possibly be an ES7 increment expression.
- *
- * ES7 UpdateExpression:
- * LeftHandSideExpression[?Yield]
- * LeftHandSideExpression[?Yield][no LineTerminator here]++
- * LeftHandSideExpression[?Yield][no LineTerminator here]--
- * ++LeftHandSideExpression[?Yield]
- * --LeftHandSideExpression[?Yield]
- */
function isUpdateExpression() {
- // This function is called inside parseUnaryExpression to decide
- // whether to call parseSimpleUnaryExpression or call parseUpdateExpression directly
switch (token()) {
- case 37 /* PlusToken */:
- case 38 /* MinusToken */:
- case 52 /* TildeToken */:
- case 51 /* ExclamationToken */:
- case 80 /* DeleteKeyword */:
- case 103 /* TypeOfKeyword */:
- case 105 /* VoidKeyword */:
- case 121 /* AwaitKeyword */:
+ case 37:
+ case 38:
+ case 52:
+ case 51:
+ case 80:
+ case 103:
+ case 105:
+ case 121:
return false;
- case 27 /* LessThanToken */:
- // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression
- if (sourceFile.languageVariant !== 1 /* JSX */) {
+ case 27:
+ if (sourceFile.languageVariant !== 1) {
return false;
}
- // We are in JSX context and the token is part of JSXElement.
- // falls through
default:
return true;
}
}
- /**
- * Parse ES7 UpdateExpression. UpdateExpression is used instead of ES6's PostFixExpression.
- *
- * ES7 UpdateExpression[yield]:
- * 1) LeftHandSideExpression[?yield]
- * 2) LeftHandSideExpression[?yield] [[no LineTerminator here]]++
- * 3) LeftHandSideExpression[?yield] [[no LineTerminator here]]--
- * 4) ++LeftHandSideExpression[?yield]
- * 5) --LeftHandSideExpression[?yield]
- * In TypeScript (2), (3) are parsed as PostfixUnaryExpression. (4), (5) are parsed as PrefixUnaryExpression
- */
function parseUpdateExpression() {
- if (token() === 43 /* PlusPlusToken */ || token() === 44 /* MinusMinusToken */) {
- var node = createNode(198 /* PrefixUnaryExpression */);
+ if (token() === 43 || token() === 44) {
+ var node = createNode(198);
node.operator = token();
nextToken();
node.operand = parseLeftHandSideExpressionOrHigher();
return finishNode(node);
}
- else if (sourceFile.languageVariant === 1 /* JSX */ && token() === 27 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) {
- // JSXElement is part of primaryExpression
- return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true);
+ else if (sourceFile.languageVariant === 1 && token() === 27 && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) {
+ return parseJsxElementOrSelfClosingElementOrFragment(true);
}
var expression = parseLeftHandSideExpressionOrHigher();
ts.Debug.assert(ts.isLeftHandSideExpression(expression));
- if ((token() === 43 /* PlusPlusToken */ || token() === 44 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) {
- var node = createNode(199 /* PostfixUnaryExpression */, expression.pos);
+ if ((token() === 43 || token() === 44) && !scanner.hasPrecedingLineBreak()) {
+ var node = createNode(199, expression.pos);
node.operand = expression;
node.operator = token();
nextToken();
@@ -18526,139 +16071,51 @@ var ts;
return expression;
}
function parseLeftHandSideExpressionOrHigher() {
- // Original Ecma:
- // LeftHandSideExpression: See 11.2
- // NewExpression
- // CallExpression
- //
- // Our simplification:
- //
- // LeftHandSideExpression: See 11.2
- // MemberExpression
- // CallExpression
- //
- // See comment in parseMemberExpressionOrHigher on how we replaced NewExpression with
- // MemberExpression to make our lives easier.
- //
- // to best understand the below code, it's important to see how CallExpression expands
- // out into its own productions:
- //
- // CallExpression:
- // MemberExpression Arguments
- // CallExpression Arguments
- // CallExpression[Expression]
- // CallExpression.IdentifierName
- // import (AssignmentExpression)
- // super Arguments
- // super.IdentifierName
- //
- // Because of the recursion in these calls, we need to bottom out first. There are three
- // bottom out states we can run into: 1) We see 'super' which must start either of
- // the last two CallExpression productions. 2) We see 'import' which must start import call.
- // 3)we have a MemberExpression which either completes the LeftHandSideExpression,
- // or starts the beginning of the first four CallExpression productions.
var expression;
- if (token() === 91 /* ImportKeyword */) {
+ if (token() === 91) {
if (lookAhead(nextTokenIsOpenParenOrLessThan)) {
- // We don't want to eagerly consume all import keyword as import call expression so we look ahead to find "("
- // For example:
- // var foo3 = require("subfolder
- // import * as foo1 from "module-from-node
- // We want this import to be a statement rather than import call expression
- sourceFile.flags |= 524288 /* PossiblyContainsDynamicImport */;
+ sourceFile.flags |= 524288;
expression = parseTokenNode();
}
else if (lookAhead(nextTokenIsDot)) {
- // This is an 'import.*' metaproperty (i.e. 'import.meta')
var fullStart = scanner.getStartPos();
- nextToken(); // advance past the 'import'
- nextToken(); // advance past the dot
- var node = createNode(210 /* MetaProperty */, fullStart);
- node.keywordToken = 91 /* ImportKeyword */;
+ nextToken();
+ nextToken();
+ var node = createNode(210, fullStart);
+ node.keywordToken = 91;
node.name = parseIdentifierName();
expression = finishNode(node);
- sourceFile.flags |= 1048576 /* PossiblyContainsImportMeta */;
+ sourceFile.flags |= 1048576;
}
else {
expression = parseMemberExpressionOrHigher();
}
}
else {
- expression = token() === 97 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher();
+ expression = token() === 97 ? parseSuperExpression() : parseMemberExpressionOrHigher();
}
- // Now, we *may* be complete. However, we might have consumed the start of a
- // CallExpression. As such, we need to consume the rest of it here to be complete.
return parseCallExpressionRest(expression);
}
function parseMemberExpressionOrHigher() {
- // Note: to make our lives simpler, we decompose the NewExpression productions and
- // place ObjectCreationExpression and FunctionExpression into PrimaryExpression.
- // like so:
- //
- // PrimaryExpression : See 11.1
- // this
- // Identifier
- // Literal
- // ArrayLiteral
- // ObjectLiteral
- // (Expression)
- // FunctionExpression
- // new MemberExpression Arguments?
- //
- // MemberExpression : See 11.2
- // PrimaryExpression
- // MemberExpression[Expression]
- // MemberExpression.IdentifierName
- //
- // CallExpression : See 11.2
- // MemberExpression
- // CallExpression Arguments
- // CallExpression[Expression]
- // CallExpression.IdentifierName
- //
- // Technically this is ambiguous. i.e. CallExpression defines:
- //
- // CallExpression:
- // CallExpression Arguments
- //
- // If you see: "new Foo()"
- //
- // Then that could be treated as a single ObjectCreationExpression, or it could be
- // treated as the invocation of "new Foo". We disambiguate that in code (to match
- // the original grammar) by making sure that if we see an ObjectCreationExpression
- // we always consume arguments if they are there. So we treat "new Foo()" as an
- // object creation only, and not at all as an invocation. Another way to think
- // about this is that for every "new" that we see, we will consume an argument list if
- // it is there as part of the *associated* object creation node. Any additional
- // argument lists we see, will become invocation expressions.
- //
- // Because there are no other places in the grammar now that refer to FunctionExpression
- // or ObjectCreationExpression, it is safe to push down into the PrimaryExpression
- // production.
- //
- // Because CallExpression and MemberExpression are left recursive, we need to bottom out
- // of the recursion immediately. So we parse out a primary expression to start with.
var expression = parsePrimaryExpression();
return parseMemberExpressionRest(expression);
}
function parseSuperExpression() {
var expression = parseTokenNode();
- if (token() === 19 /* OpenParenToken */ || token() === 23 /* DotToken */ || token() === 21 /* OpenBracketToken */) {
+ if (token() === 19 || token() === 23 || token() === 21) {
return expression;
}
- // If we have seen "super" it must be followed by '(' or '.'.
- // If it wasn't then just try to parse out a '.' and report an error.
- var node = createNode(185 /* PropertyAccessExpression */, expression.pos);
+ var node = createNode(185, expression.pos);
node.expression = expression;
- parseExpectedToken(23 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
- node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
+ parseExpectedToken(23, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
+ node.name = parseRightSideOfDot(true);
return finishNode(node);
}
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) {
var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
var result;
- if (opening.kind === 257 /* JsxOpeningElement */) {
- var node = createNode(255 /* JsxElement */, opening.pos);
+ if (opening.kind === 257) {
+ var node = createNode(255, opening.pos);
node.openingElement = opening;
node.children = parseJsxChildren(node.openingElement);
node.closingElement = parseJsxClosingElement(inExpressionContext);
@@ -18667,34 +16124,26 @@ var ts;
}
result = finishNode(node);
}
- else if (opening.kind === 260 /* JsxOpeningFragment */) {
- var node = createNode(259 /* JsxFragment */, opening.pos);
+ else if (opening.kind === 260) {
+ var node = createNode(259, opening.pos);
node.openingFragment = opening;
node.children = parseJsxChildren(node.openingFragment);
node.closingFragment = parseJsxClosingFragment(inExpressionContext);
result = finishNode(node);
}
else {
- ts.Debug.assert(opening.kind === 256 /* JsxSelfClosingElement */);
- // Nothing else to do for self-closing elements
+ ts.Debug.assert(opening.kind === 256);
result = opening;
}
- // If the user writes the invalid code '' in an expression context (i.e. not wrapped in
- // an enclosing tag), we'll naively try to parse ^ this as a 'less than' operator and the remainder of the tag
- // as garbage, which will cause the formatter to badly mangle the JSX. Perform a speculative parse of a JSX
- // element if we see a < token so that we can wrap it in a synthetic binary expression so the formatter
- // does less damage and we can report a better error.
- // Since JSX elements are invalid < operands anyway, this lookahead parse will only occur in error scenarios
- // of one sort or another.
- if (inExpressionContext && token() === 27 /* LessThanToken */) {
- var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); });
+ if (inExpressionContext && token() === 27) {
+ var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(true); });
if (invalidElement) {
parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
- var badNode = createNode(200 /* BinaryExpression */, result.pos);
+ var badNode = createNode(200, result.pos);
badNode.end = invalidElement.end;
badNode.left = result;
badNode.right = invalidElement;
- badNode.operatorToken = createMissingNode(26 /* CommaToken */, /*reportAtCurrentPosition*/ false, /*diagnosticMessage*/ undefined); // TODO: GH#18217
+ badNode.operatorToken = createMissingNode(26, false, undefined);
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
return badNode;
}
@@ -18702,16 +16151,14 @@ var ts;
return result;
}
function parseJsxText() {
- var node = createNode(10 /* JsxText */);
- node.containsOnlyWhiteSpaces = currentToken === 11 /* JsxTextAllWhiteSpaces */;
+ var node = createNode(10);
+ node.containsOnlyWhiteSpaces = currentToken === 11;
currentToken = scanner.scanJsxToken();
return finishNode(node);
}
function parseJsxChild(openingTag, token) {
switch (token) {
- case 1 /* EndOfFileToken */:
- // If we hit EOF, issue the error at the tag that lacks the closing element
- // rather than at the end of the file (which is useless)
+ case 1:
if (ts.isJsxOpeningFragment(openingTag)) {
parseErrorAtRange(openingTag, ts.Diagnostics.JSX_fragment_has_no_corresponding_closing_tag);
}
@@ -18719,16 +16166,16 @@ var ts;
parseErrorAtRange(openingTag.tagName, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTag.tagName));
}
return undefined;
- case 28 /* LessThanSlashToken */:
- case 7 /* ConflictMarkerTrivia */:
+ case 28:
+ case 7:
return undefined;
- case 10 /* JsxText */:
- case 11 /* JsxTextAllWhiteSpaces */:
+ case 10:
+ case 11:
return parseJsxText();
- case 17 /* OpenBraceToken */:
- return parseJsxExpression(/*inExpressionContext*/ false);
- case 27 /* LessThanToken */:
- return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ false);
+ case 17:
+ return parseJsxExpression(false);
+ case 27:
+ return parseJsxElementOrSelfClosingElementOrFragment(false);
default:
return ts.Debug.assertNever(token);
}
@@ -18737,7 +16184,7 @@ var ts;
var list = [];
var listPos = getNodePos();
var saveParsingContext = parsingContext;
- parsingContext |= 1 << 14 /* JsxChildren */;
+ parsingContext |= 1 << 14;
while (true) {
var child = parseJsxChild(openingTag, currentToken = scanner.reScanJsxToken());
if (!child)
@@ -18748,16 +16195,15 @@ var ts;
return createNodeArray(list, listPos);
}
function parseJsxAttributes() {
- var jsxAttributes = createNode(263 /* JsxAttributes */);
- jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute);
+ var jsxAttributes = createNode(263);
+ jsxAttributes.properties = parseList(13, parseJsxAttribute);
return finishNode(jsxAttributes);
}
function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) {
var fullStart = scanner.getStartPos();
- parseExpected(27 /* LessThanToken */);
- if (token() === 29 /* GreaterThanToken */) {
- // See below for explanation of scanJsxText
- var node_1 = createNode(260 /* JsxOpeningFragment */, fullStart);
+ parseExpected(27);
+ if (token() === 29) {
+ var node_1 = createNode(260, fullStart);
scanJsxText();
return finishNode(node_1);
}
@@ -18765,23 +16211,20 @@ var ts;
var typeArguments = tryParseTypeArguments();
var attributes = parseJsxAttributes();
var node;
- if (token() === 29 /* GreaterThanToken */) {
- // Closing tag, so scan the immediately-following text with the JSX scanning instead
- // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate
- // scanning errors
- node = createNode(257 /* JsxOpeningElement */, fullStart);
+ if (token() === 29) {
+ node = createNode(257, fullStart);
scanJsxText();
}
else {
- parseExpected(41 /* SlashToken */);
+ parseExpected(41);
if (inExpressionContext) {
- parseExpected(29 /* GreaterThanToken */);
+ parseExpected(29);
}
else {
- parseExpected(29 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false);
+ parseExpected(29, undefined, false);
scanJsxText();
}
- node = createNode(256 /* JsxSelfClosingElement */, fullStart);
+ node = createNode(256, fullStart);
}
node.tagName = tagName;
node.typeArguments = typeArguments;
@@ -18790,125 +16233,119 @@ var ts;
}
function parseJsxElementName() {
scanJsxIdentifier();
- // JsxElement can have name in the form of
- // propertyAccessExpression
- // primaryExpression in the form of an identifier and "this" keyword
- // We can't just simply use parseLeftHandSideExpressionOrHigher because then we will start consider class,function etc as a keyword
- // We only want to consider "this" as a primaryExpression
- var expression = token() === 99 /* ThisKeyword */ ?
+ var expression = token() === 99 ?
parseTokenNode() : parseIdentifierName();
- while (parseOptional(23 /* DotToken */)) {
- var propertyAccess = createNode(185 /* PropertyAccessExpression */, expression.pos);
+ while (parseOptional(23)) {
+ var propertyAccess = createNode(185, expression.pos);
propertyAccess.expression = expression;
- propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
+ propertyAccess.name = parseRightSideOfDot(true);
expression = finishNode(propertyAccess);
}
return expression;
}
function parseJsxExpression(inExpressionContext) {
- var node = createNode(265 /* JsxExpression */);
- if (!parseExpected(17 /* OpenBraceToken */)) {
+ var node = createNode(265);
+ if (!parseExpected(17)) {
return undefined;
}
- if (token() !== 18 /* CloseBraceToken */) {
- node.dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */);
+ if (token() !== 18) {
+ node.dotDotDotToken = parseOptionalToken(24);
node.expression = parseAssignmentExpressionOrHigher();
}
if (inExpressionContext) {
- parseExpected(18 /* CloseBraceToken */);
+ parseExpected(18);
}
else {
- parseExpected(18 /* CloseBraceToken */, /*message*/ undefined, /*shouldAdvance*/ false);
+ parseExpected(18, undefined, false);
scanJsxText();
}
return finishNode(node);
}
function parseJsxAttribute() {
- if (token() === 17 /* OpenBraceToken */) {
+ if (token() === 17) {
return parseJsxSpreadAttribute();
}
scanJsxIdentifier();
- var node = createNode(262 /* JsxAttribute */);
+ var node = createNode(262);
node.name = parseIdentifierName();
- if (token() === 58 /* EqualsToken */) {
+ if (token() === 58) {
switch (scanJsxAttributeValue()) {
- case 9 /* StringLiteral */:
+ case 9:
node.initializer = parseLiteralNode();
break;
default:
- node.initializer = parseJsxExpression(/*inExpressionContext*/ true);
+ node.initializer = parseJsxExpression(true);
break;
}
}
return finishNode(node);
}
function parseJsxSpreadAttribute() {
- var node = createNode(264 /* JsxSpreadAttribute */);
- parseExpected(17 /* OpenBraceToken */);
- parseExpected(24 /* DotDotDotToken */);
+ var node = createNode(264);
+ parseExpected(17);
+ parseExpected(24);
node.expression = parseExpression();
- parseExpected(18 /* CloseBraceToken */);
+ parseExpected(18);
return finishNode(node);
}
function parseJsxClosingElement(inExpressionContext) {
- var node = createNode(258 /* JsxClosingElement */);
- parseExpected(28 /* LessThanSlashToken */);
+ var node = createNode(258);
+ parseExpected(28);
node.tagName = parseJsxElementName();
if (inExpressionContext) {
- parseExpected(29 /* GreaterThanToken */);
+ parseExpected(29);
}
else {
- parseExpected(29 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false);
+ parseExpected(29, undefined, false);
scanJsxText();
}
return finishNode(node);
}
function parseJsxClosingFragment(inExpressionContext) {
- var node = createNode(261 /* JsxClosingFragment */);
- parseExpected(28 /* LessThanSlashToken */);
+ var node = createNode(261);
+ parseExpected(28);
if (ts.tokenIsIdentifierOrKeyword(token())) {
parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
}
if (inExpressionContext) {
- parseExpected(29 /* GreaterThanToken */);
+ parseExpected(29);
}
else {
- parseExpected(29 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false);
+ parseExpected(29, undefined, false);
scanJsxText();
}
return finishNode(node);
}
function parseTypeAssertion() {
- var node = createNode(190 /* TypeAssertionExpression */);
- parseExpected(27 /* LessThanToken */);
+ var node = createNode(190);
+ parseExpected(27);
node.type = parseType();
- parseExpected(29 /* GreaterThanToken */);
+ parseExpected(29);
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseMemberExpressionRest(expression) {
while (true) {
- var dotToken = parseOptionalToken(23 /* DotToken */);
+ var dotToken = parseOptionalToken(23);
if (dotToken) {
- var propertyAccess = createNode(185 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(185, expression.pos);
propertyAccess.expression = expression;
- propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
+ propertyAccess.name = parseRightSideOfDot(true);
expression = finishNode(propertyAccess);
continue;
}
- if (token() === 51 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 51 && !scanner.hasPrecedingLineBreak()) {
nextToken();
- var nonNullExpression = createNode(209 /* NonNullExpression */, expression.pos);
+ var nonNullExpression = createNode(209, expression.pos);
nonNullExpression.expression = expression;
expression = finishNode(nonNullExpression);
continue;
}
- // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
- if (!inDecoratorContext() && parseOptional(21 /* OpenBracketToken */)) {
- var indexedAccess = createNode(186 /* ElementAccessExpression */, expression.pos);
+ if (!inDecoratorContext() && parseOptional(21)) {
+ var indexedAccess = createNode(186, expression.pos);
indexedAccess.expression = expression;
- if (token() === 22 /* CloseBracketToken */) {
- indexedAccess.argumentExpression = createMissingNode(71 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
+ if (token() === 22) {
+ indexedAccess.argumentExpression = createMissingNode(71, true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
}
else {
var argument = allowInAnd(parseExpression);
@@ -18917,25 +16354,25 @@ var ts;
}
indexedAccess.argumentExpression = argument;
}
- parseExpected(22 /* CloseBracketToken */);
+ parseExpected(22);
expression = finishNode(indexedAccess);
continue;
}
if (isTemplateStartOfTaggedTemplate()) {
- expression = parseTaggedTemplateRest(expression, /*typeArguments*/ undefined);
+ expression = parseTaggedTemplateRest(expression, undefined);
continue;
}
return expression;
}
}
function isTemplateStartOfTaggedTemplate() {
- return token() === 13 /* NoSubstitutionTemplateLiteral */ || token() === 14 /* TemplateHead */;
+ return token() === 13 || token() === 14;
}
function parseTaggedTemplateRest(tag, typeArguments) {
- var tagExpression = createNode(189 /* TaggedTemplateExpression */, tag.pos);
+ var tagExpression = createNode(189, tag.pos);
tagExpression.tag = tag;
tagExpression.typeArguments = typeArguments;
- tagExpression.template = token() === 13 /* NoSubstitutionTemplateLiteral */
+ tagExpression.template = token() === 13
? parseLiteralNode()
: parseTemplateExpression();
return finishNode(tagExpression);
@@ -18943,11 +16380,7 @@ var ts;
function parseCallExpressionRest(expression) {
while (true) {
expression = parseMemberExpressionRest(expression);
- if (token() === 27 /* LessThanToken */) {
- // See if this is the start of a generic invocation. If so, consume it and
- // keep checking for postfix expressions. Otherwise, it's just a '<' that's
- // part of an arithmetic expression. Break out so we consume it higher in the
- // stack.
+ if (token() === 27) {
var typeArguments = tryParse(parseTypeArgumentsInExpression);
if (!typeArguments) {
return expression;
@@ -18956,15 +16389,15 @@ var ts;
expression = parseTaggedTemplateRest(expression, typeArguments);
continue;
}
- var callExpr = createNode(187 /* CallExpression */, expression.pos);
+ var callExpr = createNode(187, expression.pos);
callExpr.expression = expression;
callExpr.typeArguments = typeArguments;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
continue;
}
- else if (token() === 19 /* OpenParenToken */) {
- var callExpr = createNode(187 /* CallExpression */, expression.pos);
+ else if (token() === 19) {
+ var callExpr = createNode(187, expression.pos);
callExpr.expression = expression;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
@@ -18974,217 +16407,191 @@ var ts;
}
}
function parseArgumentList() {
- parseExpected(19 /* OpenParenToken */);
- var result = parseDelimitedList(11 /* ArgumentExpressions */, parseArgumentExpression);
- parseExpected(20 /* CloseParenToken */);
+ parseExpected(19);
+ var result = parseDelimitedList(11, parseArgumentExpression);
+ parseExpected(20);
return result;
}
function parseTypeArgumentsInExpression() {
- if (!parseOptional(27 /* LessThanToken */)) {
+ if (!parseOptional(27)) {
return undefined;
}
- var typeArguments = parseDelimitedList(19 /* TypeArguments */, parseType);
- if (!parseExpected(29 /* GreaterThanToken */)) {
- // If it doesn't have the closing `>` then it's definitely not an type argument list.
+ var typeArguments = parseDelimitedList(19, parseType);
+ if (!parseExpected(29)) {
return undefined;
}
- // If we have a '<', then only parse this as a argument list if the type arguments
- // are complete and we have an open paren. if we don't, rewind and return nothing.
return typeArguments && canFollowTypeArgumentsInExpression()
? typeArguments
: undefined;
}
function canFollowTypeArgumentsInExpression() {
switch (token()) {
- case 19 /* OpenParenToken */: // foo(
- case 13 /* NoSubstitutionTemplateLiteral */: // foo `...`
- case 14 /* TemplateHead */: // foo `...${100}...`
- // these are the only tokens can legally follow a type argument
- // list. So we definitely want to treat them as type arg lists.
- case 23 /* DotToken */: // foo.
- case 20 /* CloseParenToken */: // foo)
- case 22 /* CloseBracketToken */: // foo]
- case 56 /* ColonToken */: // foo:
- case 25 /* SemicolonToken */: // foo;
- case 55 /* QuestionToken */: // foo